-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
The MessageChatMemoryAdvisor.before method does not properly handle the case when a user modifies an existing user message that has already received a response from the AI model.
Currently, when a user resends a modified message:
The old user message remains in the chat memory
The corresponding assistant response to that old message also remains in the chat memory
The new user message is simply appended to the memory
This leads to inconsistent chat history where both the old and new versions of a message (and their respective responses) exist in the conversation.
Environment
version: 1.0.0 and main
Steps to reproduce
- in before method add log for example:chatClientRequest.prompt().getInstructions();
- send userMessage and modify it;
- see log old userMessage is exist ;
Expected behavior
When a user sends a message that already exists in the chat history:
The existing user message should be removed from memory
The assistant response to that message should also be removed from memory
The new user message should be added to the memory
A new assistant response should be generated and added to the memory
Minimal Complete Reproducible example
in before method add log for example:chatClientRequest.prompt().getInstructions();
send userMessage and modify it; see log old userMessage is exist ;