Kav-K / GPTDiscord

A robust, all-in-one GPT interface for Discord. ChatGPT-style conversations, image generation, AI-moderation, custom indexes/knowledgebase, youtube summarizer, and more!
MIT License
1.83k stars 301 forks source link

[BUG] Summarizing never finishes, can't end conversation #231

Closed davidguttman closed 1 year ago

davidguttman commented 1 year ago

Describe the bug Bot started summarizing a conversation (gpt-3.5-turbo), but never finished. Couldn't continue or end conversation. See screenshot and log below

To Reproduce Have a conversation until summary.

Expected behavior Summarize finishing, being able to continue

Screenshots image

Additional context Logs:

2023-03-17T04:36:00.261165524Z Response -> {'id': 'chatcmpl-6uw582N7g8DEyV4uXhl3Phip2g6K0', 'object': '
chat.completion', 'created': 1679027654, 'model': 'gpt-3.5-turbo-0301', 'usage': {'prompt_tokens': 2292
, 'completion_tokens': 195, 'total_tokens': 2487}, 'choices': [{'message': {'role': 'assistant', 'conte
nt': 'One example of an AI client could be "Nexus," a large corporation that provides cloud-based stora
ge and computing services for businesses. Nexus uses advanced AI algorithms to optimize its services an
d stay ahead of the competition. However, due to regulations and legal restrictions, Nexus is limited i
n the types of data it can collect and analyze.\n\nTo overcome this limitation, Nexus hires Jinx to con
duct a covert investigation into a rival company\'s data center. Jinx is tasked with gathering informat
ion on the rival company\'s data storage and processing capabilities and reporting back to Nexus. The g
oal is to gain a competitive advantage by accessing data that Nexus would otherwise be unable to collec
t.\n\nJinx uses his hacking skills to infiltrate the rival company\'s servers, gather data, and transmi
t it back to Nexus without leaving a trace. He faces several challenges along the way, including sophis
ticated security measures and rival hackers. Still, Jinx ultimately succeeds and delivers the data to N
exus, earning their gratitude and trust.'}, 'finish_reason': 'stop', 'index': 0}]}
2023-03-17T04:41:43.938874723Z ERROR:asyncio:Task exception was never retrieved
2023-03-17T04:41:43.938965543Z future: <Task finished name='discord-ui-view-timeout-788945ebb457dac345645555ca813938' coro=<SaveView.on_timeout() done, defined at /usr/local/lib/python3.10/site-packages/services/image_service.py:244> exception=AttributeError("'Interaction' object has no attribute 'edit'")>
2023-03-17T04:41:43.938979860Z Traceback (most recent call last):
2023-03-17T04:41:43.938984248Z   File "/usr/local/lib/python3.10/site-packages/services/image_service.py", line 261, in on_timeout
2023-03-17T04:41:43.938989157Z     await self.ctx.edit(view=new_view)
2023-03-17T04:41:43.938993515Z AttributeError: 'Interaction' object has no attribute 'edit'
2023-03-17T04:42:33.279137799Z Ignoring exception in on_message
2023-03-17T04:42:33.280963361Z Traceback (most recent call last):
2023-03-17T04:42:33.281136396Z   File "/usr/local/lib/python3.10/site-packages/services/text_service.py", line 307, in encapsulated_send
2023-03-17T04:42:33.281146646Z     response = await converser_cog.model.send_chatgpt_chat_request(
2023-03-17T04:42:33.281149902Z   File "/usr/local/lib/python3.10/site-packages/backoff/_async.py", line 151, in retry
2023-03-17T04:42:33.281152777Z     ret = await target(*args, **kwargs)
2023-03-17T04:42:33.281155262Z   File "/usr/local/lib/python3.10/site-packages/models/openai_model.py", line 890, in send_chatgpt_chat_request
2023-03-17T04:42:33.281157957Z     username = re.search(r"(?<=\n)(.*?)(?=:)", message.text).group()
2023-03-17T04:42:33.281164058Z AttributeError: 'NoneType' object has no attribute 'group'
2023-03-17T04:42:33.281166553Z 
2023-03-17T04:42:33.281168957Z During handling of the above exception, another exception occurred:
2023-03-17T04:42:33.281171512Z 
2023-03-17T04:42:33.281173887Z Traceback (most recent call last):
2023-03-17T04:42:33.281323568Z   File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 377, in _run_event
2023-03-17T04:42:33.281357352Z     await coro(*args, **kwargs)
2023-03-17T04:42:33.281391335Z   File "/usr/local/lib/python3.10/site-packages/cogs/text_service_cog.py", line 684, in on_message
2023-03-17T04:42:33.281395924Z     if await TextService.process_conversation_message(
2023-03-17T04:42:33.281399450Z   File "/usr/local/lib/python3.10/site-packages/services/text_service.py", line 758, in process_conversation_message
2023-03-17T04:42:33.281402967Z     await TextService.encapsulated_send(
2023-03-17T04:42:33.281406795Z   File "/usr/local/lib/python3.10/site-packages/services/text_service.py", line 586, in encapsulated_send
2023-03-17T04:42:33.281410532Z     await ctx.send_followup(embed=embed)
2023-03-17T04:42:33.281413678Z AttributeError: 'Message' object has no attribute 'send_followup'
2023-03-17T07:25:11.116647768Z INFO:discord.client:Got a request to RESUME the websocket.
2023-03-17T07:25:11.193612347Z INFO:discord.gateway:Shard ID None has sent the RESUME payload.
2023-03-17T07:25:11.216984829Z INFO:discord.gateway:Shard ID None has successfully RESUMED session 425b8e3d32c4c083131fde8d78be5196 under trace ["gateway-prd-us-east1-b-9f9n",{"micros":3246,"calls":["id_created",{"micros":0,"calls":[]},"session_lookup_time",{"micros":2935,"calls":[]},"session_lookup_finished",{"micros":14,"calls":[]},"discord-sessions-blue-prd-2-265",{"micros":20}]}].
2023-03-17T08:27:45.236236926Z INFO:discord.client:Got a request to RESUME the websocket.
2023-03-17T08:27:45.323542337Z INFO:discord.gateway:Shard ID None has sent the RESUME payload.
2023-03-17T08:27:45.345151082Z INFO:discord.gateway:Shard ID None has successfully RESUMED session 425b8e3d32c4c083131fde8d78be5196 under trace ["gateway-prd-us-east1-d-t9dr",{"micros":852,"calls":["id_created",{"micros":0,"calls":[]},"session_lookup_time",{"micros":398,"calls":[]},"session_lookup_finished",{"micros":16,"calls":[]},"discord-sessions-blue-prd-2-265",{"micros":23}]}].
2023-03-17T10:41:53.802784816Z INFO:discord.client:Got a request to RESUME the websocket.
2023-03-17T10:41:53.895508989Z INFO:discord.gateway:Shard ID None has sent the RESUME payload.
2023-03-17T10:41:53.916010290Z INFO:discord.gateway:Shard ID None has successfully RESUMED session 425b8e3d32c4c083131fde8d78be5196 under trace ["gateway-prd-us-east1-b-pvzh",{"micros":513,"calls":["id_created",{"micros":0,"calls":[]},"session_lookup_time",{"micros":236,"calls":[]},"session_lookup_finished",{"micros":11,"calls":[]},"discord-sessions-blue-prd-2-265",{"micros":20}]}].
2023-03-17T12:15:50.606256139Z INFO:discord.gateway:Websocket closed with WSCloseCode.ABNORMAL_CLOSURE, attempting a reconnect.
2023-03-17T12:15:50.606592892Z INFO:discord.client:Got a request to RESUME the websocket.
2023-03-17T12:15:50.710680030Z INFO:discord.gateway:Shard ID None has sent the RESUME payload.
2023-03-17T12:15:50.731591757Z INFO:discord.gateway:Shard ID None has successfully RESUMED session 425b8e3d32c4c083131fde8d78be5196 under trace ["gateway-prd-us-east1-d-j5kw",{"micros":649,"calls":["id_created",{"micros":0,"calls":[]},"session_lookup_time",{"micros":362,"calls":[]},"session_lookup_finished",{"micros":12,"calls":[]},"discord-sessions-blue-prd-2-265",{"micros":26}]}].

Using Docker deployed with Caprover

Kav-K commented 1 year ago

Will look into this within 24h, in the meantime you can circumvent this by using pinecone for now