From 3c444051d4203ff0ba0a1e7d50d424881425eda7 Mon Sep 17 00:00:00 2001 From: Oleh Astappiev Date: Wed, 14 Aug 2024 11:55:23 +0200 Subject: [PATCH] fix: save all Conversations by default --- .../java/de/l3s/interweb/core/chat/Conversation.java | 9 +++++++++ .../l3s/interweb/server/features/chat/ChatsResource.java | 1 + 2 files changed, 10 insertions(+) diff --git a/interweb-core/src/main/java/de/l3s/interweb/core/chat/Conversation.java b/interweb-core/src/main/java/de/l3s/interweb/core/chat/Conversation.java index 4fa0ae0d..84e0379a 100644 --- a/interweb-core/src/main/java/de/l3s/interweb/core/chat/Conversation.java +++ b/interweb-core/src/main/java/de/l3s/interweb/core/chat/Conversation.java @@ -15,13 +15,22 @@ public class Conversation extends CompletionsQuery implements Serializable { @JsonProperty("title") private String title; + @JsonProperty("used_tokens") private Integer usedTokens; + @JsonProperty("estimated_cost") private Double estimatedCost; + @JsonProperty("created") private Instant created; + public Conversation() { + super(); + + this.setSave(true); + } + public String getTitle() { return title; } diff --git a/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatsResource.java b/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatsResource.java index 6b6a2bcb..924f595f 100644 --- a/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatsResource.java +++ b/interweb-server/src/main/java/de/l3s/interweb/server/features/chat/ChatsResource.java @@ -47,6 +47,7 @@ public Uni chat(@PathParam("uuid") UUID id) { return Chat.findById(apikey, id).call(chat -> Mutiny.fetch(chat.getMessages())).map(chat -> { Conversation conversation = new Conversation(); conversation.setId(chat.id); + conversation.setModel(chat.model); conversation.setTitle(chat.title); conversation.setUsedTokens(chat.usedTokens); conversation.setEstimatedCost(chat.estimatedCost);