apply java formatting
This commit is contained in:
@@ -10,6 +10,7 @@ import org.springframework.ai.chat.messages.Message;
|
||||
|
||||
/**
|
||||
* Advisor for standard ChatMemory implementations
|
||||
*
|
||||
* @author Mark Pollack
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@@ -19,8 +20,8 @@ public abstract class AbstractConversationHistoryAdvisor extends AbstractChatMem
|
||||
this(chatMemory, ChatMemory.DEFAULT_CONVERSATION_ID, true, DEFAULT_CHAT_MEMORY_PRECEDENCE_ORDER);
|
||||
}
|
||||
|
||||
public AbstractConversationHistoryAdvisor(ChatMemory chatMemory, String defaultConversationId, boolean protectFromBlocking,
|
||||
int order) {
|
||||
public AbstractConversationHistoryAdvisor(ChatMemory chatMemory, String defaultConversationId,
|
||||
boolean protectFromBlocking, int order) {
|
||||
super(chatMemory, defaultConversationId, protectFromBlocking, order);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,13 +78,13 @@ public class MessageChatMemoryAdvisor extends AbstractConversationHistoryAdvisor
|
||||
@Override
|
||||
protected ChatClientRequest before(ChatClientRequest request) {
|
||||
String conversationId = this.doGetConversationId(request.context());
|
||||
|
||||
|
||||
// Add the new user messages from the current prompt to memory
|
||||
List<UserMessage> newUserMessages = request.prompt().getUserMessages();
|
||||
for (UserMessage userMessage : newUserMessages) {
|
||||
this.getChatMemoryStore().add(conversationId, userMessage);
|
||||
}
|
||||
|
||||
|
||||
// Use the parent class implementation to handle retrieving and applying messages
|
||||
return super.before(request);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PromptChatMemoryAdvisor extends AbstractConversationHistoryAdvisor
|
||||
@Override
|
||||
protected ChatClientRequest before(ChatClientRequest chatClientRequest) {
|
||||
String conversationId = this.doGetConversationId(chatClientRequest.context());
|
||||
|
||||
|
||||
// 1. Add all user messages from the current prompt to memory
|
||||
List<UserMessage> userMessages = chatClientRequest.prompt().getUserMessages();
|
||||
for (UserMessage userMessage : userMessages) {
|
||||
@@ -126,7 +126,7 @@ public class PromptChatMemoryAdvisor extends AbstractConversationHistoryAdvisor
|
||||
logger.info("[PromptChatMemoryAdvisor.before] Added USER message to memory for conversationId={}: {}",
|
||||
conversationId, userMessage.getText());
|
||||
}
|
||||
|
||||
|
||||
// 2. Retrieve the chat memory for the current conversation.
|
||||
List<Message> memoryMessages = this.getChatMemoryStore().get(conversationId);
|
||||
logger.info("[PromptChatMemoryAdvisor.before] Memory after USER add for conversationId={}: {}", conversationId,
|
||||
|
||||
Reference in New Issue
Block a user