From a485cfb180094f14b3fe27ea218d2890033768a3 Mon Sep 17 00:00:00 2001 From: "t.me/xtekky" <98614666+xtekky@users.noreply.github.com> Date: Thu, 20 Apr 2023 15:34:19 +0100 Subject: unfinished api's (help is welcome) --- unfinished/gptbz/README.md | 4 ++++ unfinished/gptbz/__init__.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 unfinished/gptbz/README.md create mode 100644 unfinished/gptbz/__init__.py (limited to 'unfinished/gptbz') diff --git a/unfinished/gptbz/README.md b/unfinished/gptbz/README.md new file mode 100644 index 00000000..05bc2770 --- /dev/null +++ b/unfinished/gptbz/README.md @@ -0,0 +1,4 @@ +https://chat.gpt.bz + +to do: +- code refractoring \ No newline at end of file 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 -- cgit v1.2.3