mirror of
				https://github.com/amithkoujalgi/ollama4j.git
				synced 2025-11-03 18:10:42 +01:00 
			
		
		
		
	Compare commits
	
		
			4 Commits
		
	
	
		
			snyk-upgra
			...
			v1.0.72-1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 33ebd088c4 | |||
| caf632ec8b | |||
| 62f3c3efa5 | |||
| 613e152e7d | 
							
								
								
									
										17
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								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>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -16,17 +16,11 @@ 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());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user