Coder Social home page Coder Social logo

pyroedgegptbot's Introduction

PyroEdgeGPTBot

A telegram bot with Bing AI ( using EdgeGPT API )

English - 中文

Features

  • Multiple users with different sessions (No group support now)
  • Response with reference (and correct ref label)
  • Response with normal and stream mode
  • Can allow every one to use
  • Allow you set your own cookie at runtime
  • Allow you set a bot name to you
  • Prompt Support
  • Image generation (inline query and command mode)
  • Export conversation to Notion
  • Hot update the EdgeGPT dependence

Setup

Requirements

Checking bing AI access (Required)

PS: Everyone can access Bing AI for chat now, even anonymous users.

  • Install the latest version of Microsoft Edge
  • Alternatively, you can use any browser and set the user-agent to look like you're using Edge. You can do this easily with an extension like "User-Agent Switcher and Manager" for Chrome and Firefox.
  • Open bing.com/chat
  • If you see a chat feature, you are good to go

Getting authentication (Optional)

PS: This column is needed by image creator, or ask more questions and have longer conversations

  • Install the cookie editor extension for Chrome or Firefox or Edge
  • Go to bing.com
  • Open the extension
  • Click "Export" on the bottom right, then "Export as JSON" (This saves your cookies to clipboard)
  • Paste your cookies into a file ./cookie.json (The filename depends on your .env settings)

Install requirements

pip install -r requirements.txt

Set environment variables

cp .env.example .env

Then edit .env file and set API_ID, API_KEY, BOT_TOKEN and ALLOWED_USER_IDS. Or you can set environment variables like this:

export API_ID='1234567'
export API_KEY='abcdefg2hijk5lmnopq8rstuvwxyz9'
export BOT_TOKEN='123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'
export ALLOWED_USER_IDS='112113115,567568569'

Run

python PyroEdgeGptBot.py

Run it on Back4app

  • Fork this repo
  • Login into Back4app (Suggests login with github account)
  • Click Build new app and Containers as a Service
  • Link the repo you forked.
  • Set the Required ENVS (Explain here)

Note that you can run python base64_encode_cookie.py locally then get COOKIE_BASE64 value from base64_encoded_cookie.txt

  • Deploy!

Run it on Railway (Recommend)

Deploy on Railway

(Optional) Set bot commands

  • Contact @botfather
  • Send /mybots then select your bot and click Edit Bot -> Edit Commands
  • Paste below and send.
start - Start the bot!
help - Get help
reset - Reset the bot
new - Create new conversation
switch - Switch the conversation style
interval - Set edit interval
suggest_mode - Set the suggest mode
image_gen - Generate images
update - Update the EdgeGPT dependence
cookie - Set you own cookie
bot_name - Set the bot name display to you

pyroedgegptbot's People

Contributors

tom-snow avatar yorddyyorddy avatar

Stargazers

 avatar  avatar  avatar VGX.LEO avatar Shekhar  avatar KAC CHAN avatar CDNER avatar Arvib Fazriansyah avatar  avatar  avatar  avatar  avatar zhai holy avatar  avatar  avatar AhmadReza Saghari avatar Mehdi avatar KV avatar  avatar Reynard avatar Linda Huang avatar  avatar  avatar  avatar  avatar baiiylu avatar lex avatar

Watchers

Kostas Georgiou avatar  avatar CHANDAN SINGH avatar

pyroedgegptbot's Issues

image gen not fixed !

ImageGenerator Error: Redirect failed.

ImageGenerator Usage: /image_gen

also I tried the script on Render
it got build and running well...
but as script not end the building/deploying process at any istance
it always shows deploying
as of the conditions of render anything not deployed within 15 mins , get terminated and shows deployed failed

pls fixed these bugs !

hay , can You update this code such that it can deployed

like can You update this code
so that it can be deployed on plaform like render , railways etc.

I tried on render , it got deployed because its running script
so can You make it devployable ??

also image gen is not working in updated code !

always says this error

ImageGenerator Error: quote_from_bytes() expected bytes.

ImageGenerator Usage: /image_gen

Update in EdgeGPt

New update in EdgeGPt don't requires Cookie .
Do will get updated version of this Edge Version in this project?

Error on first run

image

Good afternoon I got this error, maybe I'm doing something wrong, because I'm not very good at it. I tried to run through the command line, and also tried to run through powershell. Thanks in advance for your reply.

Bot not working

2023-05-22 16:33:47 - root - ERROR - [chat_handle, unexpected error]: 502, message='Invalid response status', url=URL('wss://sydney.bing.com/sydney/ChatHub')
2023-05-22 16:33:47 - pyrogram.dispatcher - ERROR - 502, message='Invalid response status', url=URL('wss://sydney.bing.com/sydney/ChatHub')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pyrogram/dispatcher.py", line 240, in handler_worker
    await handler.callback(self.client, *args)
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 345, in chat_handle
    raise e
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 332, in chat_handle
    async for final, response, reply_markup in bingAIStream(update.chat.id, update.text):
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 547, in bingAIStream
    async for final, rsp in  EDGES[user_id]["bot"].ask_stream(prompt=messageText, conversation_style=EDGES[user_id]["style"]):
  File "/usr/local/lib/python3.10/dist-packages/EdgeGPT.py", line 673, in ask_stream
    async for response in self.chat_hub.ask_stream(
  File "/usr/local/lib/python3.10/dist-packages/EdgeGPT.py", line 453, in ask_stream
    self.wss = await self.session.ws_connect(
  File "/usr/local/lib/python3.10/dist-packages/aiohttp/client.py", line 792, in _ws_connect
    raise WSServerHandshakeError(
aiohttp.client_exceptions.WSServerHandshakeError: 502, message='Invalid response status', url=URL('wss://sydney.bing.com/sydney/ChatHub')

facing some error

File "/PyroEdgeGptBot/PyroEdgeGptBot.py", line 755, in bingAI
rsp = await EDGES[user_id]["bot"].ask(prompt=messageText, conversation_style=EDGES[user_id]["style"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/EdgeGPT.py", line 659, in ask
async for final, response in self.chat_hub.ask_stream(
File "/usr/local/lib/python3.11/site-packages/EdgeGPT.py", line 556, in ask_stream
raise Exception(
Exception: CaptchaChallenge: User needs to solve CAPTCHA to continue.

getting this error , what to do ?

2023-05-19 09:27:55 - pyrogram.dispatcher - ERROR - Throttled: Request is throttled.
Traceback (most recent call last):
File "/PyroEdgeGptBot/PyroEdgeGptBot.py", line 663, in bingAI
rsp = await EDGES[user_id]["bot"].ask(prompt=messageText, conversation_style=EDGES[user_id]["style"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/EdgeGPT.py", line 659, in ask
async for final, response in self.chat_hub.ask_stream(
File "/usr/local/lib/python3.11/site-packages/EdgeGPT.py", line 556, in ask_stream
raise Exception(
Exception: Throttled: Request is throttled.

Replit issue when I try to Run it

2024-02-03 17:45:38 - root - INFO - BING_COOKIE loaded from ./cookie.json
2024-02-03 17:45:38 - root - WARNING - Allow everyone mode
2024-02-03 17:45:38 - root - WARNING - You set BING_COOKIE to not None, but you allowed everyone to use this bot
2024-02-03 17:45:39 - httpx - INFO - HTTP Request: GET https://www.bing.com/turing/conversation/create "HTTP/1.1 200 OK"
Traceback (most recent call last):
File "/home/runner/PyroEdgeGPTBot/main.py", line 130, in
"bot": tmpLoop.run_until_complete(EdgeGPT.Chatbot.create(proxy=PROXY_BING, cookies=BING_COOKIE)), # 共用一个 cookie.json 文件
File "/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/runner/PyroEdgeGPTBot/.pythonlibs/lib/python3.10/site-packages/EdgeGPT/EdgeGPT.py", line 41, in create
self.chat_hub = ChatHub(
File "/home/runner/PyroEdgeGPTBot/.pythonlibs/lib/python3.10/site-packages/EdgeGPT/chathub.py", line 42, in init
conversation_signature=conversation.struct["conversationSignature"],
KeyError: 'conversationSignature'

how to fix this issue?

#[FeatureRequest]

is it possible to use reverse chat gpt instead of the reverse Edge gpt ??(Free version of chat gpt)
if yes then pls allows new code of it

ImageGenerationError

2023-05-30 13:18:26 - root - WARNING - Allow everyone mode
2023-05-30 13:18:26 - root - WARNING - You set BING_COOKIE to None, but you allowed everyone to use this bot
2023-05-30 13:18:54 - root - ERROR - ImageGenerator Error: Redirect failed
Traceback (most recent call last):
File "F:\AI\PyroEdgeGPTBot-master\PyroEdgeGPTBot-master\PyroEdgeGptBot.py", line 597, in set_suggest_mode_handle
images = await image_gen_main(prompt,image_gen_cookie_u)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\AI\PyroEdgeGPTBot-master\PyroEdgeGPTBot-master\PyroEdgeGptBot.py", line 1310, in image_gen_main
images = await image_generator.get_images(prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\BingImageCreator.py", line 257, in get_images
raise Exception("Redirect failed")
Exception: Redirect failed
2023-05-30 13:21:20 - root - WARNING - User [6249895422] try to set cookie but been rejected (not initialized).
2023-05-30 13:22:14 - root - ERROR - ImageGenerator Error: Redirect failed
Traceback (most recent call last):
File "F:\AI\PyroEdgeGPTBot-master\PyroEdgeGPTBot-master\PyroEdgeGptBot.py", line 597, in set_suggest_mode_handle
images = await image_gen_main(prompt,image_gen_cookie_u)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "F:\AI\PyroEdgeGPTBot-master\PyroEdgeGPTBot-master\PyroEdgeGptBot.py", line 1310, in image_gen_main
images = await image_generator.get_images(prompt)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\BingImageCreator.py", line 257, in get_images
raise Exception("Redirect failed")
Exception: Redirect failed

SUDENELY SOME ERROR Pl do help

Traceback (most recent call last):
File "C:\Users\CSROF\Downloads\PyroEdgeGPTBot-master\PyroEdgeGPTBot-master\PyroEdgeGptBot.py", line 100, in
"bot": Chatbot(cookie_path=COOKIE_FILE), # 共用一个 cookie.json 文件
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\EdgeGPT.py", line 596, in init
self.chat_hub: _ChatHub = _ChatHub(
^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\EdgeGPT.py", line 408, in init
conversation_signature=conversation.struct["conversationSignature"],
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'conversationSignature'

traceback error

Traceback (most recent call last):
File "PyroEdgeGptBot.py", line 80, in
if not check_conversation_style(DEFAULT_CONVERSATION_STYLE_TYPE):
File "PyroEdgeGptBot.py", line 76, in check_conversation_style
if style in EdgeGPT.ConversationStyle.members:
AttributeError: module 'EdgeGPT' has no attribute 'ConversationStyle'

Error In Inline Image Genration

2023-06-13 15:53:34 - root - INFO - Receive inline_query image_gen result [india %] from [6249895422]
Sending request...
2023-06-13 15:53:34 - httpx - INFO - HTTP Request: POST https://www.bing.com/images/create?q=india&rt=3&FORM=GENCRE "HTTP/1.1 302 Found"
2023-06-13 15:53:35 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create?q=india&rt=3&FORM=GENCRE&id=648843a857c249a1a6b7c2d089e1170b "HTTP/1.1 200 OK"
Waiting for results...
.2023-06-13 15:53:35 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:36 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:37 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:39 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:40 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:41 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:42 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:44 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
.2023-06-13 15:53:45 - httpx - INFO - HTTP Request: GET https://www.bing.com/images/create/async/results/648843a857c249a1a6b7c2d089e1170b?q=india "HTTP/1.1 200 OK"
2023-06-13 15:53:45 - root - ERROR - Image generation error: Telegram says: [400 QUERY_ID_INVALID] - The callback query id is invalid (caused by "messages.SetInlineBotResults")
2023-06-13 15:53:45 - root - ERROR - [inline_query_image_gen_handle, unexpected error]: Telegram says: [400 QUERY_ID_INVALID] - The callback query id is invalid (caused by "messages.SetInlineBotResults")
Traceback (most recent call last):
File "F:\chatGptAdv-master\PyroEdgeGptBot.py", line 1242, in inline_query_image_gen_handle
await update.answer(
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\types\inline_mode\inline_query.py", line 172, in answer
return await self._client.answer_inline_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\bots\answer_inline_query.py", line 97, in answer_inline_query
return await self.invoke(
^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\advanced\invoke.py", line 77, in invoke
r = await self.session.invoke(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 361, in invoke
return await self.send(query, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 331, in send
RPCError.raise_it(result, type(data))
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\errors\rpc_error.py", line 91, in raise_it
raise getattr(
pyrogram.errors.exceptions.bad_request_400.QueryIdInvalid: Telegram says: [400 QUERY_ID_INVALID] - The callback query id is invalid (caused by "messages.SetInlineBotResults")
2023-06-13 15:53:45 - pyrogram.dispatcher - ERROR - Telegram says: [400 QUERY_ID_INVALID] - The callback query id is invalid (caused by "messages.SetInlineBotResults")
Traceback (most recent call last):
File "F:\chatGptAdv-master\PyroEdgeGptBot.py", line 1242, in inline_query_image_gen_handle
await update.answer(
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\types\inline_mode\inline_query.py", line 172, in answer
return await self._client.answer_inline_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\bots\answer_inline_query.py", line 97, in answer_inline_query
return await self.invoke(
^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\advanced\invoke.py", line 77, in invoke
r = await self.session.invoke(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 361, in invoke
return await self.send(query, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 331, in send
RPCError.raise_it(result, type(data))
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\errors\rpc_error.py", line 91, in raise_it
raise getattr(
pyrogram.errors.exceptions.bad_request_400.QueryIdInvalid: Telegram says: [400 QUERY_ID_INVALID] - The callback query id is invalid (caused by "messages.SetInlineBotResults")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\dispatcher.py", line 240, in handler_worker
await handler.callback(self.client, *args)
File "F:\chatGptAdv-master\PyroEdgeGptBot.py", line 1256, in inline_query_image_gen_handle
await update.answer(
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\types\inline_mode\inline_query.py", line 172, in answer
return await self._client.answer_inline_query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\bots\answer_inline_query.py", line 97, in answer_inline_query
return await self.invoke(
^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\methods\advanced\invoke.py", line 77, in invoke
r = await self.session.invoke(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 361, in invoke
return await self.send(query, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\session\session.py", line 331, in send
RPCError.raise_it(result, type(data))
File "C:\Users\CSROF\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyrogram\errors\rpc_error.py", line 91, in raise_it
raise getattr(
pyrogram.errors.exceptions.bad_request_400.QueryIdInvalid: Telegram says: [400 QUERY_ID_INVALID] - The callback query id is invalid (caused by "messages.SetInlineBotResults")

Error on every second message

File "/opt/render/project/src/.venv/lib/python3.8/site-packages/EdgeGPT.py", line 555, in ask_stream
May 14 07:21:33 PM response["item"]["messages"][-1]["contentOrigin"] == "Apology"
May 14 07:21:33 PM KeyError: 'messages'

Railway deployment issue

Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 662, in await_impl
await protocol.handshake(
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 329, in handshake
raise InvalidStatusCode(status_code, response_headers)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 655, in await_impl_timeout
return await self.await_impl()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 676, in await_impl
await protocol.wait_closed()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/PyroEdgeGptBot/PyroEdgeGptBot.py", line 544, in chat_handle
async for final, response, reply_markup in bingAIStream(update.chat.id, update.text):
File "/PyroEdgeGptBot/PyroEdgeGptBot.py", line 813, in bingAIStream
async for final, rsp in EDGES[user_id]["bot"].ask_stream(prompt=messageText, conversation_style=EDGES[user_id]["style"]):
File "/usr/local/lib/python3.11/site-packages/EdgeGPT/EdgeGPT.py", line 185, in ask_stream
async for response in self.chat_hub.ask_stream(
File "/usr/local/lib/python3.11/site-packages/EdgeGPT/chathub.py", line 102, in ask_stream
async with connect(
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 637, in aenter
return await self
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 654, in await_impl_timeout
async with asyncio_timeout(self.open_timeout):
File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in aexit
raise TimeoutError from exc_val
TimeoutError
2023-07-17 18:08:47 - pyrogram.dispatcher - ERROR -
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 662, in await_impl
await protocol.handshake(
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 329, in handshake
raise InvalidStatusCode(status_code, response_headers)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 200
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 655, in await_impl_timeout
return await self.await_impl()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 676, in await_impl
await protocol.wait_closed()
asyncio.exceptions.CancelledError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pyrogram/dispatcher.py", line 240, in handler_worker
await handler.callback(self.client, *args)
File "/PyroEdgeGptBot/PyroEdgeGptBot.py", line 558, in chat_handle
raise e
File "/PyroEdgeGptBot/PyroEdgeGptBot.py", line 544, in chat_handle
async for final, response, reply_markup in bingAIStream(update.chat.id, update.text):
File "/PyroEdgeGptBot/PyroEdgeGptBot.py", line 813, in bingAIStream
async for final, rsp in EDGES[user_id]["bot"].ask_stream(prompt=messageText, conversation_style=EDGES[user_id]["style"]):
File "/usr/local/lib/python3.11/site-packages/EdgeGPT/EdgeGPT.py", line 185, in ask_stream
async for response in self.chat_hub.ask_stream(
File "/usr/local/lib/python3.11/site-packages/EdgeGPT/chathub.py", line 102, in ask_stream
async with connect(
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 637, in aenter
return await self
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/websockets/legacy/client.py", line 654, in await_impl_timeout
async with asyncio_timeout(self.open_timeout):
File "/usr/local/lib/python3.11/asyncio/timeouts.py", line 111, in aexit
raise TimeoutError from exc_val
TimeoutError

Ask two prompts in a row

It gives this error when prompted twice in a row:

root@kelime:~/PyroEdgeGPTBot# sudo python3 PyroEdgeGptBot.py 
/root/PyroEdgeGPTBot/PyroEdgeGptBot.py:106: DeprecationWarning: There is no current event loop
  tmpLoop = asyncio.get_event_loop()
2023-05-22 17:52:36 - root - ERROR - [chat_handle, unexpected error]: 'NoneType' object has no attribute 'split'
2023-05-22 17:52:36 - asyncio - ERROR - Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7faa98a08340>
2023-05-22 17:52:36 - pyrogram.dispatcher - ERROR - 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pyrogram/dispatcher.py", line 240, in handler_worker
    await handler.callback(self.client, *args)
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 345, in chat_handle
    raise e
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 332, in chat_handle
    async for final, response, reply_markup in bingAIStream(update.chat.id, update.text):
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 547, in bingAIStream
    async for final, rsp in  EDGES[user_id]["bot"].ask_stream(prompt=messageText, conversation_style=EDGES[user_id]["style"]):
  File "/usr/local/lib/python3.10/dist-packages/EdgeGPT.py", line 673, in ask_stream
    async for response in self.chat_hub.ask_stream(
  File "/usr/local/lib/python3.10/dist-packages/EdgeGPT.py", line 510, in ask_stream
    objects = msg.data.split(DELIMITER)
AttributeError: 'NoneType' object has no attribute 'split'
2023-05-22 17:52:36 - root - ERROR - [chat_handle, unexpected error]: 'messages'
2023-05-22 17:52:36 - pyrogram.dispatcher - ERROR - 'messages'
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pyrogram/dispatcher.py", line 240, in handler_worker
    await handler.callback(self.client, *args)
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 345, in chat_handle
    raise e
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 332, in chat_handle
    async for final, response, reply_markup in bingAIStream(update.chat.id, update.text):
  File "/root/PyroEdgeGPTBot/PyroEdgeGptBot.py", line 547, in bingAIStream
    async for final, rsp in  EDGES[user_id]["bot"].ask_stream(prompt=messageText, conversation_style=EDGES[user_id]["style"]):
  File "/usr/local/lib/python3.10/dist-packages/EdgeGPT.py", line 673, in ask_stream
    async for response in self.chat_hub.ask_stream(
  File "/usr/local/lib/python3.10/dist-packages/EdgeGPT.py", line 575, in ask_stream
    response["item"]["messages"][-1]["contentOrigin"] == "Apology"
KeyError: 'messages'
^C^C^Z
[1]+  Stopped                 sudo python3 PyroEdgeGptBot.py
root@kelime:~/PyroEdgeGPTBot# 

what about image generation ?

this script only send those 5 stored images for every prompt , was this error on my side or its issue in script only ?

if its on my side then do pls explain me that how I can solve this issue ?

Back4app NO RESPONSE

HOW MUCH TIME IT WILL TAKE TO GET DEPLOYED ?

showing deploying from last 10 mins ...............

no response after hiting deploy button
JUST SHOWING DEPLOYING

image
image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.