tom-snow / PyroEdgeGPTBot

A telegram bot with Bing AI ( using EdgeGPT API )
MIT License
28 stars 24 forks source link

Error In Inline Image Genration #21

Closed TechyCSR closed 1 year ago

TechyCSR commented 1 year ago

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")

TechyCSR commented 1 year ago

the above is the error we got for the every inline query pl reslove it

TechyCSR commented 1 year ago

@tom-snow Pl help

Yorddyyorddy commented 1 year ago

the above is the error we got for the every inline query pl reslove it

btw I'm wondering how he could still thought to Genrate image in inline bc EdgeGPT is slow even can take 2 minutes to give results so how could a user wait that much all

the errors were generated bc of being laziness of ImageGen maybe you can solve it by setting cache Time in send inline results[pyro] or adjusting the wait time (timeout)

tom-snow commented 1 year ago

https://github.com/tom-snow/PyroEdgeGPTBot/issues/3#issuecomment-1546522427

works fine for me.

Check your cookie may help.

Yorddyyorddy commented 1 year ago

#3 (comment)

works fine for me.

Check your cookie may help.

are you using good proxy or mine server is dump

TechyCSR commented 1 year ago

No it's not working Cookie file is working well for image generation & text generation but when comes to inline image generation it counters that error

Also @Yorddyyorddy You are correct we are facing the error because of time lag .

Yorddyyorddy commented 1 year ago

btw how your are retrieving the the chat id from bing for continued conversation @tom-snow

Yorddyyorddy commented 1 year ago

No it's not working Cookie file is working well for image generation & text generation but when comes to inline image generation it counters that error

Also @Yorddyyorddy You are correct we are facing the error because of time lag .

I don't think it's good practice to use image generation in inline mainly with pyro as it affects the bot performance and pyro is slow in nature ,bing too so two lazies when overcome.....

but you can use telethon for tg bot api it fast compared to pyro

TechyCSR commented 1 year ago

using the dictionary and creating thread to use as template for continued conversation

tom-snow commented 1 year ago

This is the limit from telegram( so cause error while using inline mode ), using other framework will not help.

Image get takes long time.

tom-snow commented 1 year ago

If you like other framework, you can do it.

TechyCSR commented 1 year ago

Alright thx

Yorddyyorddy commented 1 year ago

using the dictionary and creating thread to use as template for continued conversation

nah,I just wanted the process from the api endpoint

TechyCSR commented 1 year ago

But like I saw the logs when the user give inline command it actually gets image's url but it tries to get more than 5+ image's url due to image the time get's over & inline message id renews

Any how we can limit the link generation?

Yorddyyorddy commented 1 year ago

using the dictionary and creating thread to use as template for continued conversation

can you show with code example I'm getting error with that

TechyCSR commented 1 year ago

Why don't You refer to Main file of the repo. There it's all given

Yorddyyorddy commented 1 year ago

Why don't You refer to Main file of the repo. There it's all given

I'm using my phone right now and I don't have access to desktop so it's hard for me to open a code in a little monitor