XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

added method for deleting poe account

4b86f501
Raju Komati <komatiraju032@gmail.com>
提交于

代码差异

3 个文件 +19 -11
Modified gpt4free/quora/__init__.py +12 -11
@@ -285,6 +285,11 @@ class Account:
285 285 cookies = open(Path(__file__).resolve().parent / 'cookies.txt', 'r').read().splitlines()
286 286 return choice(cookies)
287 287
288 @staticmethod
289 def delete_account(token: str, proxy: Optional[str] = None):
290 client = PoeClient(token, proxy=proxy)
291 client.delete_account()
292
288 293
289 294 class StreamingCompletion:
290 295 @staticmethod
@@ -293,11 +298,11 @@ class StreamingCompletion:
293 298 custom_model: bool = None,
294 299 prompt: str = 'hello world',
295 300 token: str = '',
296 proxy: Optional[str] = None
301 proxy: Optional[str] = None,
297 302 ) -> Generator[PoeResponse, None, None]:
298 303 _model = MODELS[model] if not custom_model else custom_model
299 304
300 proxies = { 'http': 'http://' + proxy, 'https': 'http://' + proxy } if proxy else False
305 proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else False
301 306 client = PoeClient(token)
302 307 client.proxy = proxies
303 308
@@ -333,7 +338,7 @@ class Completion:
333 338 custom_model: str = None,
334 339 prompt: str = 'hello world',
335 340 token: str = '',
336 proxy: Optional[str] = None
341 proxy: Optional[str] = None,
337 342 ) -> PoeResponse:
338 343 _model = MODELS[model] if not custom_model else custom_model
339 344
@@ -454,14 +459,7 @@ class Poe:
454 459 response = chunk['text']
455 460 return response
456 461
457 def create_bot(
458 self,
459 name: str,
460 /,
461 prompt: str = '',
462 base_model: str = 'ChatGPT',
463 description: str = '',
464 ) -> None:
462 def create_bot(self, name: str, /, prompt: str = '', base_model: str = 'ChatGPT', description: str = '') -> None:
465 463 if base_model not in MODELS:
466 464 raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')
467 465
@@ -475,3 +473,6 @@ class Poe:
475 473
476 474 def list_bots(self) -> list:
477 475 return list(self.client.bot_names.values())
476
477 def delete_account(self) -> None:
478 self.client.delete_account()
Modified gpt4free/quora/api.py +6 -0
@@ -541,5 +541,11 @@ class Client:
541 541 self.get_bots()
542 542 return data
543 543
544 def delete_account(self) -> None:
545 response = self.send_query('SettingsDeleteAccountButton_deleteAccountMutation_Mutation', {})
546 data = response['data']['deleteAccount']
547 if 'viewer' not in data:
548 raise RuntimeError(f'Error occurred while deleting the account, Please try again!')
549
544 550
545 551 load_queries()
Added gpt4free/quora/graphql/SettingsDeleteAccountButton_deleteAccountMutation_Mutation.graphql +1 -0
@@ -0,0 +1 @@
1 mutation SettingsDeleteAccountButton_deleteAccountMutation_Mutation{ deleteAccount { viewer { uid id } }}