Fix storing and passing previous messages to API - #449
Open
niquepolice wants to merge 1 commit into
Open
Conversation
Merged
father-bot
force-pushed
the
main
branch
4 times, most recently
from
June 14, 2026 09:30
fd778d9 to
755f0a7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Critical bug: conversation history is lost, bot remembers only the current message
Current version does not pass chat history to the API correctly:
vision_message_handle_fnintroduced new format for saving user messagesand
_generate_prompt_messageshas been changed accordingly.But in
message_handle_fnit is stillCall of
extend(dialog_message["user"])for the dialog message saved inmessage_handle_fnresults in splittingdialog_message["user"]=_messageof typestrinto symbols, thus the structure inresponseis messed and API returnssomething like
error_code=None error_message="'$.messages[3].content' is invalid. Please check the API reference: https://platform.openai.com/docs/api-reference." error_param=None error_type=invalid_request_error message='OpenAI API error received' stream_error=False chatgpt_telegram_bot | 2024-04-09 18:47:58 DEBUG: message='Request to OpenAI API' method=post path=https://api.openai.com/v1/chat/completionsand finally ignores the conversation context.