Call of extend(dialog_message["user"]) for the dialog message saved in message_handle_fn results in splitting dialog_message["user"]= _message of type str into symbols, thus the structure in response is messed and API returns
something 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/completions
and finally ignores the conversation context.
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_fn
introduced new format for saving user messagesand
_generate_prompt_messages
has been changed accordingly. But inmessage_handle_fn
it is stillCall of
extend(dialog_message["user"])
for the dialog message saved inmessage_handle_fn
results in splittingdialog_message["user"]
=_message
of typestr
into symbols, thus the structure inresponse
is messed and API returns something likeerror_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/completions
and finally ignores the conversation context.