Compare commits

..

2 commits

Author SHA1 Message Date
1ce2658b55 bot: Add missing ChatGptResponse field
All checks were successful
ci/woodpecker/tag/java/1 Pipeline was successful
ci/woodpecker/tag/java/2 Pipeline was successful
ci/woodpecker/tag/java/3 Pipeline was successful
ci/woodpecker/tag/java/4 Pipeline was successful
ci/woodpecker/tag/nodejs Pipeline was successful
ci/woodpecker/tag/oci-image-build/1 Pipeline was successful
ci/woodpecker/tag/oci-image-build/2 Pipeline was successful
ci/woodpecker/tag/oci-image-build/3 Pipeline was successful
ci/woodpecker/tag/oci-image-build/4 Pipeline was successful
ci/woodpecker/push/java/1 Pipeline was successful
ci/woodpecker/push/java/2 Pipeline was successful
ci/woodpecker/push/java/3 Pipeline was successful
ci/woodpecker/push/java/4 Pipeline was successful
ci/woodpecker/push/nodejs Pipeline was successful
ci/woodpecker/push/oci-image-build/1 Pipeline was successful
ci/woodpecker/push/oci-image-build/2 Pipeline was successful
ci/woodpecker/push/oci-image-build/3 Pipeline was successful
ci/woodpecker/push/oci-image-build/4 Pipeline was successful
This field was newly introduced an broke the serialization.
I opted against using the ignore-unknown Jackson annotation to get
informed about model changes. It might be a interesting field...
This just a hobby project :)
2023-12-09 22:27:39 +01:00
f0731e6754 bot: Reduce MessageCacheSize to reduce memory usage
I don't care that much in this case about speed I just want it to host
it on as few resources as possible :)
2023-12-09 22:14:52 +01:00
2 changed files with 8 additions and 1 deletions

View file

@ -38,6 +38,7 @@ public class DiscordBot implements Runnable {
.setToken(discordApiKey)
.login()
.join();
discordApi.setMessageCacheSize(10, 60*60);
var future = new CompletableFuture<Void>();
Runtime.getRuntime().addShutdownHook(Thread.ofVirtual().unstarted(() -> {
logger.info("Shutting down Discord application");

View file

@ -4,7 +4,13 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
public record ChatGPTResponse(String id, String object, long created, String model, Usage usage, List<Choice> choices) {
public record ChatGPTResponse(String id,
String object,
long created,
String model,
Usage usage,
List<Choice> choices,
@JsonProperty("system_fingerprint") String systemFingerprint) {
public record Usage(@JsonProperty("prompt_tokens") int promptTokens,
@JsonProperty("completion_tokens") int completionTokens,