summaryrefslogtreecommitdiffstats
path: root/unfinished/bard
diff options
context:
space:
mode:
authort.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-27 17:28:36 +0200
committerGitHub <noreply@github.com>2023-04-27 17:28:36 +0200
commitbbb4d69a933ff90e33e072ecba32519db7a22612 (patch)
tree6fec52831117ee43fe7141a153b7e123ff09d469 /unfinished/bard
parentMerge pull request #201 from DanielShemesh/patch-4 (diff)
parentReformat code using PyCharm (diff)
downloadgpt4free-bbb4d69a933ff90e33e072ecba32519db7a22612.tar
gpt4free-bbb4d69a933ff90e33e072ecba32519db7a22612.tar.gz
gpt4free-bbb4d69a933ff90e33e072ecba32519db7a22612.tar.bz2
gpt4free-bbb4d69a933ff90e33e072ecba32519db7a22612.tar.lz
gpt4free-bbb4d69a933ff90e33e072ecba32519db7a22612.tar.xz
gpt4free-bbb4d69a933ff90e33e072ecba32519db7a22612.tar.zst
gpt4free-bbb4d69a933ff90e33e072ecba32519db7a22612.zip
Diffstat (limited to 'unfinished/bard')
-rw-r--r--unfinished/bard/__init__.py31
-rw-r--r--unfinished/bard/typings.py2
2 files changed, 17 insertions, 16 deletions
diff --git a/unfinished/bard/__init__.py b/unfinished/bard/__init__.py
index ef8980d7..f1d68b92 100644
--- a/unfinished/bard/__init__.py
+++ b/unfinished/bard/__init__.py
@@ -1,12 +1,12 @@
-from requests import Session
-from re import search
-from random import randint
from json import dumps, loads
-from urllib.parse import urlencode
-from dotenv import load_dotenv
from os import getenv
+from random import randint
+from re import search
+from urllib.parse import urlencode
from bard.typings import BardResponse
+from dotenv import load_dotenv
+from requests import Session
load_dotenv()
token = getenv('1psid')
@@ -62,16 +62,17 @@ class Completion:
'rt': 'c',
})
- response = client.post(f'https://bard.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate?{params}',
- data={
- 'at': snlm0e,
- 'f.req': dumps([None, dumps([
- [prompt],
- None,
- [conversation_id, response_id, choice_id],
- ])])
- }
- )
+ response = client.post(
+ f'https://bard.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate?{params}',
+ data={
+ 'at': snlm0e,
+ 'f.req': dumps([None, dumps([
+ [prompt],
+ None,
+ [conversation_id, response_id, choice_id],
+ ])])
+ }
+ )
chat_data = loads(response.content.splitlines()[3])[0][2]
if not chat_data:
diff --git a/unfinished/bard/typings.py b/unfinished/bard/typings.py
index ddf803b6..75b73bf9 100644
--- a/unfinished/bard/typings.py
+++ b/unfinished/bard/typings.py
@@ -1,4 +1,4 @@
-from typing import Dict, List, Optional, Union
+from typing import Dict, List, Union
class BardResponse: