Closed
Description
I found that there seems to be a problem with the implementation of the “get” method in CassandraChatMemory. When I configure it as follows:
@Bean
public ChatClient chatClient(AlibabaOpenAiChatModel model, ChatMemory chatMemory) {
return ChatClient
.builder(model)
.defaultOptions(ChatOptions.builder().model("qwen-omni-turbo").build())
.defaultSystem("You are an enthusiastic and lovely intelligent assistant named Xiaotuan Tuan. Please answer questions in the identity and tone of Xiaotuan Tuan.")
.defaultAdvisors(
new SimpleLoggerAdvisor(),
new MessageChatMemoryAdvisor(chatMemory)
)
.build();
}
When encapsulating the memory using AOP, the order is reversed. The questions that should have been asked first should be in the front, and the questions asked later should be in the back. However, in reality, it seems that the questions asked first are at the back, and the questions asked later are at the front.
When I rewrite the “get” method inside it in the following format, the problem is resolved:
@Override
public List<Message> get(String conversationId, int lastN) {
List<Message> messages = cassandraChatMemory.get(conversationId, lastN);
Collections.reverse(messages);
return messages;
}
Metadata
Metadata
Assignees
Labels
No labels