mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-05-15 11:57:12 +02:00
Updates Model.java to be up to date with current OllamaAPI
Also adds Jackson-JSR310 for java.time JSON Mapping
This commit is contained in:
parent
b7cd81a7f5
commit
3ed3187ba9
7
pom.xml
7
pom.xml
@ -149,7 +149,12 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.15.3</version>
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
|
@ -1,5 +1,7 @@
|
||||
package io.github.amithkoujalgi.ollama4j.core.models;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.github.amithkoujalgi.ollama4j.core.utils.Utils;
|
||||
@ -11,7 +13,9 @@ public class Model {
|
||||
private String name;
|
||||
private String model;
|
||||
@JsonProperty("modified_at")
|
||||
private String modifiedAt;
|
||||
private LocalDateTime modifiedAt;
|
||||
@JsonProperty("expires_at")
|
||||
private LocalDateTime expiresAt;
|
||||
private String digest;
|
||||
private long size;
|
||||
@JsonProperty("details")
|
||||
|
@ -8,10 +8,18 @@ import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
|
||||
public class Utils {
|
||||
|
||||
private static ObjectMapper objectMapper;
|
||||
|
||||
public static ObjectMapper getObjectMapper() {
|
||||
return new ObjectMapper();
|
||||
if(objectMapper == null) {
|
||||
objectMapper = new ObjectMapper();
|
||||
objectMapper.registerModule(new JavaTimeModule());
|
||||
}
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
public static byte[] loadImageBytesFromUrl(String imageUrl)
|
||||
|
Loading…
x
Reference in New Issue
Block a user