askrella / whatsapp-chatgpt

ChatGPT + DALL-E + WhatsApp = AI Assistant :rocket: :robot:
3.43k stars 828 forks source link

Maximum token reach in latest pull #165

Closed joejoe168168 closed 1 year ago

joejoe168168 commented 1 year ago

The program was running perfectly 2 days ago. However, when I fetch from the latest master, I always receive the following error when I use !gpt (most of the time), while !dalle is working. I have tried to use smaller prompt like (!gpt who are you?) or (!gpt hello), it still shows the below message. Nothing changed even I execute the !reset command.

The same happen when I use the docker image too.

Appreciate if anyone would look at this:

whatsapp-chatgpt_1 | ◇ [GPT] Received prompt from 123456@c.us: hello whatsapp-chatgpt_1 | An error occured Error: This model's maximum context length is 4097 tokens. However, you requested 4333 tokens (237 in the messages, 4096 in the completion). Please reduce the length of the messages or completion. whatsapp-chatgpt_1 | at ChatGPT.askStream (file:///app/node_modules/chatgpt-official/src/classes/chatgpt.ts:152:11) whatsapp-chatgpt_1 | at processTicksAndRejections (node:internal/process/task_queues:95:5) whatsapp-chatgpt_1 | at ChatGPT.ask (file:///app/node_modules/chatgpt-official/src/classes/chatgpt.ts:97:10) whatsapp-chatgpt_1 | at Module.handleMessageGPT (/app/src/handlers/gpt.ts:44:15) whatsapp-chatgpt_1 | at Module.handleIncomingMessage (/app/src/handlers/message.ts:131:3) whatsapp-chatgpt_1 | at Client. (/app/src/index.ts:70:3)

law108000 commented 1 year ago

Please check if issue #162 help your problem.

joejoe168168 commented 1 year ago

thanks @law108000 , actually i have set the max token to be 2000, but still got issue. however, i'm not sure why the same script all in a sudden that works after like 24 hours.