mirror of
https://github.com/amithkoujalgi/ollama4j.git
synced 2025-05-15 03:47:13 +02:00
Cleanup
This commit is contained in:
parent
3fc7e9423c
commit
ecb04d6d82
4
Makefile
4
Makefile
@ -11,9 +11,9 @@ doxygen:
|
||||
doxygen Doxyfile
|
||||
|
||||
list-releases:
|
||||
curl 'https://central.sonatype.com/api/internal/browse/component/versions?sortField=normalizedVersion&sortDirection=asc&page=0&size=12&filter=namespace%3Aio.github.amithkoujalgi%2Cname%3Aollama4j' \
|
||||
curl 'https://central.sonatype.com/api/internal/browse/component/versions?sortField=normalizedVersion&sortDirection=desc&page=0&size=20&filter=namespace%3Aio.github.ollama4j%2Cname%3Aollama4j' \
|
||||
--compressed \
|
||||
--silent | jq '.components[].version'
|
||||
--silent | jq -r '.components[].version'
|
||||
|
||||
build-docs:
|
||||
npm i --prefix docs && npm run build --prefix docs
|
||||
|
@ -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;
|
||||
@ -34,12 +35,12 @@ 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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user