|
@@ -122,16 +122,14 @@ public class ChatServiceImpl implements ChatService {
|
|
|
);
|
|
|
System.out.println("chatList size: " + chatList.size());
|
|
|
|
|
|
-
|
|
|
// [INSERT][提问] 内容
|
|
|
Chat userChat = new Chat();
|
|
|
BeanUtil.copyProperties(chat, userChat);
|
|
|
chatDao.insert(userChat);
|
|
|
|
|
|
-
|
|
|
ChatResult chatResult = null;
|
|
|
// -- [Deepseek R1] -------------------------------------------------------
|
|
|
- if ("DEEPSEEK".equals(model) || "GEMMA".equals(model)) {
|
|
|
+ if ("DEEPSEEK_R1".equals(model) || "GEMMA".equals(model)) {
|
|
|
chatResult = ollamaUtil.chatDeepSeek(user_id, model_version, prompt, final_history_code, chatList);
|
|
|
}
|
|
|
// -- [Deepseek Api] ------------------------------------------------------
|
|
@@ -145,32 +143,38 @@ public class ChatServiceImpl implements ChatService {
|
|
|
}
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
|
- // [INSERT][思考] THINK
|
|
|
- String reasoningContent = chatResult.getReasoning_content();
|
|
|
- if (StrUtil.isNotEmpty(reasoningContent)) {
|
|
|
- //
|
|
|
- Chat thinkChat = new Chat();
|
|
|
- BeanUtil.copyProperties(chat, thinkChat);
|
|
|
- //
|
|
|
- thinkChat.setRole("assistant");
|
|
|
- thinkChat.setContent_type("THINK");
|
|
|
- thinkChat.setContent(reasoningContent);
|
|
|
- thinkChat.setDuration(chatResult.getReasoning_duration());
|
|
|
- chatDao.insert(thinkChat);
|
|
|
- }
|
|
|
-
|
|
|
- // [INSERT][回复] REPLY
|
|
|
- String content = chatResult.getContent();
|
|
|
- if (StrUtil.isNotEmpty(content)) {
|
|
|
- //
|
|
|
- Chat replyChat = new Chat();
|
|
|
- BeanUtil.copyProperties(chat, replyChat);
|
|
|
- //
|
|
|
- replyChat.setRole("assistant");
|
|
|
- replyChat.setContent_type("REPLY");
|
|
|
- replyChat.setContent(content);
|
|
|
- replyChat.setDuration(chatResult.getContent_duration());
|
|
|
- chatDao.insert(replyChat);
|
|
|
+ if (chatResult != null) {
|
|
|
+
|
|
|
+ // [INSERT][思考] THINK
|
|
|
+ String reasoningContent = chatResult.getReasoning_content();
|
|
|
+ if (StrUtil.isNotEmpty(reasoningContent)) {
|
|
|
+ //
|
|
|
+ Chat thinkChat = new Chat();
|
|
|
+ BeanUtil.copyProperties(chat, thinkChat);
|
|
|
+ //
|
|
|
+ thinkChat.setRole("assistant");
|
|
|
+ thinkChat.setContent_type("THINK");
|
|
|
+ thinkChat.setContent(reasoningContent);
|
|
|
+ thinkChat.setDuration(chatResult.getReasoning_duration());
|
|
|
+ chatDao.insert(thinkChat);
|
|
|
+ }
|
|
|
+
|
|
|
+ // [INSERT][回复] REPLY
|
|
|
+ String content = chatResult.getContent();
|
|
|
+ if (StrUtil.isNotEmpty(content)) {
|
|
|
+ //
|
|
|
+ Chat replyChat = new Chat();
|
|
|
+ BeanUtil.copyProperties(chat, replyChat);
|
|
|
+ //
|
|
|
+ replyChat.setRole("assistant");
|
|
|
+ replyChat.setContent_type("REPLY");
|
|
|
+ replyChat.setContent(content);
|
|
|
+ replyChat.setDuration(chatResult.getContent_duration());
|
|
|
+ chatDao.insert(replyChat);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ System.out.println("chatResult 结果为空! 请检查当前 (model: " + model + ") 是否正确");
|
|
|
}
|
|
|
|
|
|
|