diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/listener/FastChatAIEventSourceListener.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/listener/FastChatAIEventSourceListener.java index 7ad62178..70defa3c 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/listener/FastChatAIEventSourceListener.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/listener/FastChatAIEventSourceListener.java @@ -66,7 +66,7 @@ public class FastChatAIEventSourceListener extends EventSourceListener { log.info("Model={} is created at {}.", chatCompletions.getId(), chatCompletions.getCreated()); for (FastChatChoice choice : chatCompletions.getChoices()) { - FastChatMessage message = choice.getMessage(); + FastChatMessage message = choice.getDelta(); if (message != null) { log.info("Index: {}, Chat Role: {}", choice.getIndex(), message.getRole()); if (message.getContent() != null) { diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/model/FastChatChoice.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/model/FastChatChoice.java index 5ac0c364..751f777b 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/model/FastChatChoice.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/ai/fastchat/model/FastChatChoice.java @@ -30,8 +30,8 @@ public final class FastChatChoice { /* * The log probabilities model for tokens associated with this completions choice. */ - @JsonProperty(value = "message") - private FastChatMessage message; + @JsonProperty(value = "delta") + private FastChatMessage delta; /* * Reason for finishing @@ -44,18 +44,18 @@ public final class FastChatChoice { * * @param text the text value to set. * @param index the index value to set. - * @param message the message value to set + * @param delta the message value to set * @param finishReason the finishReason value to set. */ @JsonCreator private FastChatChoice( @JsonProperty(value = "text") String text, @JsonProperty(value = "index") int index, - @JsonProperty(value = "message") FastChatMessage message, + @JsonProperty(value = "delta") FastChatMessage delta, @JsonProperty(value = "finish_reason") FastChatCompletionsFinishReason finishReason) { this.text = text; this.index = index; - this.message = message; + this.delta = delta; this.finishReason = finishReason; } @@ -82,8 +82,8 @@ public final class FastChatChoice { * * @return the logprobs value. */ - public FastChatMessage getMessage() { - return this.message; + public FastChatMessage getDelta() { + return this.delta; } /** diff --git a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java index fd07c3ec..d3698b61 100644 --- a/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java +++ b/chat2db-server/chat2db-server-web/chat2db-server-web-api/src/main/java/ai/chat2db/server/web/api/controller/config/ConfigController.java @@ -83,7 +83,7 @@ public class ConfigController { saveChat2dbAIConfig(request); break; case RESTAI: - saveRestAIConfig(request); + saveFastChatAIConfig(request); break; case AZUREAI: saveAzureAIConfig(request); @@ -330,12 +330,6 @@ public class ConfigController { config.setModel(Objects.nonNull(azureDeployId.getData()) ? azureDeployId.getData().getContent() : ""); break; case RESTAI: - DataResult restAiUrl = configService.find(RestAIClient.REST_AI_URL); - DataResult restAiHttpMethod = configService.find(RestAIClient.REST_AI_STREAM_OUT); - config.setApiHost(Objects.nonNull(restAiUrl.getData()) ? restAiUrl.getData().getContent() : ""); - config.setStream(Objects.nonNull(restAiHttpMethod.getData()) ? Boolean.valueOf( - restAiHttpMethod.getData().getContent()) : Boolean.TRUE); - break; case FASTCHATAI: DataResult fastChatApiKey = configService.find(FastChatAIClient.FASTCHAT_API_KEY); DataResult fastChatApiHost = configService.find(FastChatAIClient.FASTCHAT_HOST);