summaryrefslogtreecommitdiffstats
path: root/unfinished/gptbz/__init__.py
diff options
context:
space:
mode:
authort.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-20 16:34:19 +0200
committert.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-20 16:34:19 +0200
commita485cfb180094f14b3fe27ea218d2890033768a3 (patch)
tree8cf4b2f08fb79271a9dc30a0f8843c5561c5d9c9 /unfinished/gptbz/__init__.py
parentora.sh (diff)
downloadgpt4free-a485cfb180094f14b3fe27ea218d2890033768a3.tar
gpt4free-a485cfb180094f14b3fe27ea218d2890033768a3.tar.gz
gpt4free-a485cfb180094f14b3fe27ea218d2890033768a3.tar.bz2
gpt4free-a485cfb180094f14b3fe27ea218d2890033768a3.tar.lz
gpt4free-a485cfb180094f14b3fe27ea218d2890033768a3.tar.xz
gpt4free-a485cfb180094f14b3fe27ea218d2890033768a3.tar.zst
gpt4free-a485cfb180094f14b3fe27ea218d2890033768a3.zip
Diffstat (limited to 'unfinished/gptbz/__init__.py')
-rw-r--r--unfinished/gptbz/__init__.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/unfinished/gptbz/__init__.py b/unfinished/gptbz/__init__.py
new file mode 100644
index 00000000..6762b4ab
--- /dev/null
+++ b/unfinished/gptbz/__init__.py
@@ -0,0 +1,31 @@
+import asyncio
+import websockets
+
+from json import dumps, loads
+
+async def test():
+ async with websockets.connect('wss://chatgpt.func.icu/conversation+ws') as wss:
+
+ await wss.send(dumps(separators=(',', ':'), obj = {
+ 'content_type':'text',
+ 'engine':'chat-gpt',
+ 'parts':['hello world'],
+ 'options':{}
+ }
+ ))
+
+ ended = None
+
+ while not ended:
+ try:
+ response = await wss.recv()
+ json_response = loads(response)
+ ended = json_response.get('eof')
+
+ if not ended:
+ print(json_response['content']['parts'][0])
+
+ except websockets.ConnectionClosed:
+ break
+
+asyncio.run(test()) \ No newline at end of file