mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-05 00:01:00 +00:00
added method for deleting poe account
This commit is contained in:
parent
2ae26bfa7e
commit
4b86f50120
@ -285,6 +285,11 @@ class Account:
|
|||||||
cookies = open(Path(__file__).resolve().parent / 'cookies.txt', 'r').read().splitlines()
|
cookies = open(Path(__file__).resolve().parent / 'cookies.txt', 'r').read().splitlines()
|
||||||
return choice(cookies)
|
return choice(cookies)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def delete_account(token: str, proxy: Optional[str] = None):
|
||||||
|
client = PoeClient(token, proxy=proxy)
|
||||||
|
client.delete_account()
|
||||||
|
|
||||||
|
|
||||||
class StreamingCompletion:
|
class StreamingCompletion:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -293,11 +298,11 @@ class StreamingCompletion:
|
|||||||
custom_model: bool = None,
|
custom_model: bool = None,
|
||||||
prompt: str = 'hello world',
|
prompt: str = 'hello world',
|
||||||
token: str = '',
|
token: str = '',
|
||||||
proxy: Optional[str] = None
|
proxy: Optional[str] = None,
|
||||||
) -> Generator[PoeResponse, None, None]:
|
) -> Generator[PoeResponse, None, None]:
|
||||||
_model = MODELS[model] if not custom_model else custom_model
|
_model = MODELS[model] if not custom_model else custom_model
|
||||||
|
|
||||||
proxies = { 'http': 'http://' + proxy, 'https': 'http://' + proxy } if proxy else False
|
proxies = {'http': 'http://' + proxy, 'https': 'http://' + proxy} if proxy else False
|
||||||
client = PoeClient(token)
|
client = PoeClient(token)
|
||||||
client.proxy = proxies
|
client.proxy = proxies
|
||||||
|
|
||||||
@ -333,7 +338,7 @@ class Completion:
|
|||||||
custom_model: str = None,
|
custom_model: str = None,
|
||||||
prompt: str = 'hello world',
|
prompt: str = 'hello world',
|
||||||
token: str = '',
|
token: str = '',
|
||||||
proxy: Optional[str] = None
|
proxy: Optional[str] = None,
|
||||||
) -> PoeResponse:
|
) -> PoeResponse:
|
||||||
_model = MODELS[model] if not custom_model else custom_model
|
_model = MODELS[model] if not custom_model else custom_model
|
||||||
|
|
||||||
@ -454,14 +459,7 @@ class Poe:
|
|||||||
response = chunk['text']
|
response = chunk['text']
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def create_bot(
|
def create_bot(self, name: str, /, prompt: str = '', base_model: str = 'ChatGPT', description: str = '') -> None:
|
||||||
self,
|
|
||||||
name: str,
|
|
||||||
/,
|
|
||||||
prompt: str = '',
|
|
||||||
base_model: str = 'ChatGPT',
|
|
||||||
description: str = '',
|
|
||||||
) -> None:
|
|
||||||
if base_model not in MODELS:
|
if base_model not in MODELS:
|
||||||
raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')
|
raise RuntimeError('Sorry, the base_model you provided does not exist. Please check and try again.')
|
||||||
|
|
||||||
@ -475,3 +473,6 @@ class Poe:
|
|||||||
|
|
||||||
def list_bots(self) -> list:
|
def list_bots(self) -> list:
|
||||||
return list(self.client.bot_names.values())
|
return list(self.client.bot_names.values())
|
||||||
|
|
||||||
|
def delete_account(self) -> None:
|
||||||
|
self.client.delete_account()
|
||||||
|
@ -541,5 +541,11 @@ class Client:
|
|||||||
self.get_bots()
|
self.get_bots()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
def delete_account(self) -> None:
|
||||||
|
response = self.send_query('SettingsDeleteAccountButton_deleteAccountMutation_Mutation', {})
|
||||||
|
data = response['data']['deleteAccount']
|
||||||
|
if 'viewer' not in data:
|
||||||
|
raise RuntimeError(f'Error occurred while deleting the account, Please try again!')
|
||||||
|
|
||||||
|
|
||||||
load_queries()
|
load_queries()
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
mutation SettingsDeleteAccountButton_deleteAccountMutation_Mutation{ deleteAccount { viewer { uid id } }}
|
Loading…
Reference in New Issue
Block a user