From 7824bf7987c128f1724973984667a7a8aa1e6963 Mon Sep 17 00:00:00 2001 From: limin Date: Fri, 24 Jan 2025 10:07:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9E=8B=E6=8E=A8?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../llm/service/conversation/ConversationServiceImpl.java | 6 +++++- .../yudao/module/llm/service/http/vo/ChatCompletion.java | 2 ++ yudao-server/src/main/resources/application-dev.yaml | 2 +- yudao-server/src/main/resources/application-local.yaml | 2 +- yudao-server/src/main/resources/application-prod.yaml | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java index dad9d5160..31d1f9b99 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/conversation/ConversationServiceImpl.java @@ -201,8 +201,12 @@ public class ConversationServiceImpl implements ConversationService { } ChatRespVO chatRespVO = BeanUtils.toBean(chatReqVO, ChatRespVO.class); chatRespVO.setResponse(modelCompletionsRespVO.getAnswer()); - // 将聊天记录放入缓存 + // 将聊天记录放入缓存 先注释 TODO stringRedisTemplate.opsForList().rightPush(CHAT_HIStORY_REDIS_KEY + ":" + chatReqVO.getUuid(), JsonUtils.toJsonString(message)); + ModelCompletionsReqVO.ModelCompletionsMessage responseMessage = new ModelCompletionsReqVO.ModelCompletionsMessage(); + responseMessage.setRole("assistant"); + responseMessage.setContent(modelCompletionsRespVO.getAnswer()); + stringRedisTemplate.opsForList().rightPush(CHAT_HIStORY_REDIS_KEY + ":" + chatReqVO.getUuid(), JsonUtils.toJsonString(responseMessage)); DataRefluxDataSaveReqVO dataRefluxDataSaveReqVO = new DataRefluxDataSaveReqVO(); dataRefluxDataSaveReqVO.setModelServiceId(chatReqVO.getModelId()); dataRefluxDataSaveReqVO.setModelType(chatReqVO.getModelType()); diff --git a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/vo/ChatCompletion.java b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/vo/ChatCompletion.java index 4526b0c33..2dd340c62 100644 --- a/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/vo/ChatCompletion.java +++ b/yudao-module-llm/yudao-module-llm-biz/src/main/java/cn/iocoder/yudao/module/llm/service/http/vo/ChatCompletion.java @@ -26,6 +26,7 @@ public class ChatCompletion { private int index; private Message message; private String finish_reason; + private String logprobs; } @Data @@ -34,6 +35,7 @@ public class ChatCompletion { public static class Message { private String role; private String content; + private String tool_calls; } @Data diff --git a/yudao-server/src/main/resources/application-dev.yaml b/yudao-server/src/main/resources/application-dev.yaml index c572b54a8..cbc116277 100644 --- a/yudao-server/src/main/resources/application-dev.yaml +++ b/yudao-server/src/main/resources/application-dev.yaml @@ -260,7 +260,7 @@ llm: # 基础模型列表 GET base_model_list: http://36.103.199.104:9997/model/v1/models # 模型对话 POST - model_completions: http://36.103.199.104:9997/model/v1/chat/completions + model_completions: http://36.103.199.104:9997/v1/chat/completions # aigc表数据查询接口 table_data_query: http://36.103.199.104:5123/table/%s # aigc模型推理 diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index abf8aaf6d..e594b1814 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -300,7 +300,7 @@ llm: # 模型列表 GET base_model_list: http://36.103.199.104:9997/model/v1/models # 模型对话 POST - model_completions: http://36.103.199.104:9997/model/v1/chat/completions + model_completions: http://36.103.199.104:9997/v1/chat/completions # aigc表数据查询接口 table_data_query: http://36.103.199.104:5123/table/%s # aigc模型推理 diff --git a/yudao-server/src/main/resources/application-prod.yaml b/yudao-server/src/main/resources/application-prod.yaml index d357d5338..350142be0 100644 --- a/yudao-server/src/main/resources/application-prod.yaml +++ b/yudao-server/src/main/resources/application-prod.yaml @@ -300,7 +300,7 @@ llm: # 模型列表 GET base_model_list: http://36.103.199.104:9997/model/v1/models # 模型对话 POST - model_completions: http://36.103.199.104:9997/model/v1/chat/completions + model_completions: http://36.103.199.104:9997/v1/chat/completions # aigc表数据查询接口 table_data_query: http://36.133.1.230:5123/table/%s # aigc模型推理