transitive-bullshit / agentic

AI agent stdlib that works with any LLM and TypeScript AI SDK.
https://agentic.so
MIT License
16.47k stars 2.15k forks source link

Defer saving new message(question) in ChatGPTAPI.sendMessage #503

Closed 189 closed 1 year ago

189 commented 1 year ago

Verify latest release

Verify webapp is working

Environment details

Nodejs 16.17.0 Windows 11

Describe the Bug

Saving the new message/question before receive response from openAI will cause something unexpected.

For some reasons (bad network, rate-limit, or user cancel or withdraw the request, so on), the request send to api.openai.com will be failed/abort, and the result will not be saved. But the user's message(user's question) has been saved before request sent, make it become orphan in database, no parentMessageId will point to it。If we query all message according conversationId from database, the orphan message will be received, it's redundant

transitive-bullshit commented 1 year ago

merged #504 – thanks @189 🙏

new release will be published shortly