summaryrefslogtreecommitdiffstats
path: root/g4f/.v1/unfinished/gptbz/__init__.py
diff options
context:
space:
mode:
authorMIDORIBIN <aquarion123@gmail.com>2023-07-28 12:07:17 +0200
committerMIDORIBIN <aquarion123@gmail.com>2023-08-14 04:46:32 +0200
commitf6ef3cb2237d8c336e915ef77ddbe6f37934c4fd (patch)
treec8bc44917ea03909cf586140f984ff0814bc30ea /g4f/.v1/unfinished/gptbz/__init__.py
parent~ | small fixes & new pypi version | v-0.0.1.9 (diff)
downloadgpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.gz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.bz2
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.lz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.xz
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.tar.zst
gpt4free-f6ef3cb2237d8c336e915ef77ddbe6f37934c4fd.zip
Diffstat (limited to 'g4f/.v1/unfinished/gptbz/__init__.py')
-rw-r--r--g4f/.v1/unfinished/gptbz/__init__.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/g4f/.v1/unfinished/gptbz/__init__.py b/g4f/.v1/unfinished/gptbz/__init__.py
deleted file mode 100644
index e95d5716..00000000
--- a/g4f/.v1/unfinished/gptbz/__init__.py
+++ /dev/null
@@ -1,46 +0,0 @@
-from json import dumps, loads
-
-import websockets
-
-
-# Define the asynchronous function to test the WebSocket connection
-
-
-async def test():
- # Establish a WebSocket connection with the specified URL
- async with websockets.connect('wss://chatgpt.func.icu/conversation+ws') as wss:
-
- # Prepare the message payload as a JSON object
- payload = {
- 'content_type': 'text',
- 'engine': 'chat-gpt',
- 'parts': ['hello world'],
- 'options': {}
- }
-
- # Send the payload to the WebSocket server
- await wss.send(dumps(obj=payload, separators=(',', ':')))
-
- # Initialize a variable to track the end of the conversation
- ended = None
-
- # Continuously receive and process messages until the conversation ends
- while not ended:
- try:
- # Receive and parse the JSON response from the server
- response = await wss.recv()
- json_response = loads(response)
-
- # Print the entire JSON response
- print(json_response)
-
- # Check for the end of the conversation
- ended = json_response.get('eof')
-
- # If the conversation has not ended, print the received message
- if not ended:
- print(json_response['content']['parts'][0])
-
- # Handle cases when the connection is closed by the server
- except websockets.ConnectionClosed:
- break