mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-11-02 09:30:41 +01:00
Cleanup
This commit is contained in:
@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import io.github.ollama4j.utils.FileToBase64Serializer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -33,13 +34,13 @@ public class OllamaChatMessage {
|
||||
|
||||
@JsonSerialize(using = FileToBase64Serializer.class)
|
||||
private List<byte[]> images;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return getObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(this);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
*/
|
||||
@Getter
|
||||
public class OllamaChatMessageRole {
|
||||
private static final List<OllamaChatMessageRole> ROLES = new ArrayList<>();
|
||||
private static final List<OllamaChatMessageRole> roles = new ArrayList<>();
|
||||
|
||||
public static final OllamaChatMessageRole SYSTEM = new OllamaChatMessageRole("system");
|
||||
public static final OllamaChatMessageRole USER = new OllamaChatMessageRole("user");
|
||||
@@ -24,21 +24,21 @@ public class OllamaChatMessageRole {
|
||||
|
||||
private OllamaChatMessageRole(String roleName) {
|
||||
this.roleName = roleName;
|
||||
ROLES.add(this);
|
||||
roles.add(this);
|
||||
}
|
||||
|
||||
public static OllamaChatMessageRole newCustomRole(String roleName) {
|
||||
OllamaChatMessageRole customRole = new OllamaChatMessageRole(roleName);
|
||||
ROLES.add(customRole);
|
||||
roles.add(customRole);
|
||||
return customRole;
|
||||
}
|
||||
|
||||
public static List<OllamaChatMessageRole> getRoles() {
|
||||
return new ArrayList<>(ROLES);
|
||||
return new ArrayList<>(roles);
|
||||
}
|
||||
|
||||
public static OllamaChatMessageRole getRole(String roleName) throws RoleNotFoundException {
|
||||
for (OllamaChatMessageRole role : ROLES) {
|
||||
for (OllamaChatMessageRole role : roles) {
|
||||
if (role.roleName.equals(roleName)) {
|
||||
return role;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user