feat: remove cookies.json requirement, update env

pull/69/head
Zack 2 years ago
parent 2bb9e407af
commit a606f504b1

@ -10,9 +10,7 @@ from swarms.models.bing_chat import BingChat
dotenv.load_dotenv(".env") dotenv.load_dotenv(".env")
# Initialize the EdgeGPTModel # Initialize the EdgeGPTModel
cookie = os.environ.get("BING_COOKIE") model = BingChat()
auth = os.environ.get("AUTH_COOKIE")
model = BingChat(cookies_path="./cookies.json", bing_cookie="BING_COOKIE",auth_cookie="AUTH_COOKIE")
response = model("Generate") response = model("Generate")

@ -28,7 +28,7 @@ class BingChat:
def __init__(self, cookies_path: str = None, auth_cookie: str = None, auth_cookie_SRCHHPGUSR: str = None): def __init__(self, cookies_path: str = None, auth_cookie: str = None, auth_cookie_SRCHHPGUSR: str = None):
auth_cookie = os.environ("AUTH_COOKIE") auth_cookie = os.environ("AUTH_COOKIE")
auth_cookie_SRCHHPGUSR auth_cookie_SRCHHPGUSR = os.enviro("AUTH_COOKIE_SRCHHPGUSR")
if cookies_path: if cookies_path:
self.cookies = json.loads(open(cookies_path, encoding="utf-8").read()) self.cookies = json.loads(open(cookies_path, encoding="utf-8").read())
elif auth_cookie: elif auth_cookie:

Loading…
Cancel
Save