forked from Mirror/ollama4j
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
33ebd088c4 | |||
caf632ec8b | |||
62f3c3efa5 | |||
613e152e7d |
19
pom.xml
19
pom.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>io.github.amithkoujalgi</groupId>
|
||||
<artifactId>ollama4j</artifactId>
|
||||
<version>1.0.73-SNAPSHOT</version>
|
||||
<version>1.0.72-1</version>
|
||||
|
||||
<name>Ollama4j</name>
|
||||
<description>Java library for interacting with Ollama API.</description>
|
||||
@ -139,6 +139,13 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.seeseepuff.be/api/packages/seeseemelk/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
@ -189,12 +196,12 @@
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.seeseepuff.be/api/packages/seeseemelk/maven</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2</url>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.seeseepuff.be/api/packages/seeseemelk/maven</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
@ -308,4 +315,4 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user