Compare commits

...

2 Commits

2 changed files with 1 additions and 10 deletions

View File

@ -16,16 +16,10 @@ public class OllamaChatResult extends OllamaResult{
List<OllamaChatMessage> chatHistory) {
super(response, responseTime, httpStatusCode);
this.chatHistory = chatHistory;
appendAnswerToChatHistory(response);
}
public List<OllamaChatMessage> getChatHistory() {
return chatHistory;
}
private void appendAnswerToChatHistory(String answer){
OllamaChatMessage assistantMessage = new OllamaChatMessage(OllamaChatMessageRole.ASSISTANT, answer);
this.chatHistory.add(assistantMessage);
}

View File

@ -11,8 +11,6 @@ public class OllamaChatStreamObserver {
private List<OllamaChatResponseModel> responseParts = new ArrayList<>();
private String message = "";
public OllamaChatStreamObserver(OllamaStreamHandler streamHandler) {
this.streamHandler = streamHandler;
}
@ -23,8 +21,7 @@ public class OllamaChatStreamObserver {
}
protected void handleCurrentResponsePart(OllamaChatResponseModel currentResponsePart){
message = message + currentResponsePart.getMessage().getContent();
streamHandler.accept(message);
streamHandler.accept(currentResponsePart.getMessage().getContent());
}