返回提交历史
Modified
gpt4free/forefront/typing.py
+1
-1
Modified
gpt4free/quora/__init__.py
+3
-3
Modified
gpt4free/quora/api.py
+3
-3
XFEstudio/gpt4free
refactored the code
c7f9f44f
代码差异
3 个文件
+7
-7
@@ -23,4 +23,4 @@ class ForeFrontResponse(BaseModel):
23
23
model: str
24
24
choices: List[Choice]
25
25
usage: Usage
26
text: str
26
text: str
@@ -377,10 +377,10 @@ class Poe:
377
377
raise RuntimeError('Sorry, the model you provided does not exist. Please check and try again.')
378
378
self.model = MODELS[model]
379
379
self.cookie_path = cookie_path
380
self.cookie = self.__load_cookie(driver, download_driver, driver_path=driver_path)
380
self.cookie = self.__load_cookie(driver, driver_path=driver_path)
381
381
self.client = PoeClient(self.cookie)
382
382
383
def __load_cookie(self, driver: str, download_driver: bool, driver_path: Optional[str] = None) -> str:
383
def __load_cookie(self, driver: str, driver_path: Optional[str] = None) -> str:
384
384
if (cookie_file := Path(self.cookie_path)).exists():
385
385
with cookie_file.open() as fp:
386
386
cookie = json.load(fp)
@@ -468,4 +468,4 @@ class Poe:
468
468
print(f'Successfully created bot with name: {response["bot"]["displayName"]}')
469
469
470
470
def list_bots(self) -> list:
471
return list(self.client.bot_names.values())
471
return list(self.client.bot_names.values())
@@ -225,7 +225,7 @@ class Client:
225
225
r = request_with_retries(self.session.post, self.gql_url, data=payload, headers=headers)
226
226
227
227
data = r.json()
228
if data["data"] == None:
228
if data["data"] is None:
229
229
logger.warn(f'{query_name} returned an error: {data["errors"][0]["message"]} | Retrying ({i + 1}/20)')
230
230
time.sleep(2)
231
231
continue
@@ -316,7 +316,7 @@ class Client:
316
316
return
317
317
318
318
# indicate that the response id is tied to the human message id
319
elif key != "pending" and value == None and message["state"] != "complete":
319
elif key != "pending" and value is None and message["state"] != "complete":
320
320
self.active_messages[key] = message["messageId"]
321
321
self.message_queues[key].put(message)
322
322
return
@@ -402,7 +402,7 @@ class Client:
402
402
logger.info(f"Downloading {count} messages from {chatbot}")
403
403
404
404
messages = []
405
if cursor == None:
405
if cursor is None:
406
406
chat_data = self.get_bot(self.bot_names[chatbot])
407
407
if not chat_data["messagesConnection"]["edges"]:
408
408
return []