Explorar el Código

1.新版ai处理用户信息

jzp hace 3 semanas
padre
commit
d80ee23695

+ 1 - 0
fs-service/src/main/java/com/fs/fastGpt/domain/FastGptChatConversation.java

@@ -12,4 +12,5 @@ public class FastGptChatConversation {
     private String isRepository;
     private String userContent;
     private String aiContent;
+    private String eventInfo;
 }

+ 16 - 6
fs-service/src/main/java/com/fs/fastGpt/service/impl/AiHookServiceImpl.java

@@ -738,8 +738,16 @@ public class AiHookServiceImpl implements AiHookService {
                     }
                 }
             }
-
-            aiEventProcess(sender, uid, role, contentKh, user, fastGptChatSession, serverId,qwExternalContacts);
+            if(isNewVersion) {
+                Gson gson = new Gson();
+                FastGptChatConversation fastGptChatConversation = gson.fromJson(contentKh, FastGptChatConversation.class);
+                String eventInfo = fastGptChatConversation.getEventInfo();
+                if(eventInfo != null && !eventInfo.isEmpty()){
+                    aiEventProcess(sender, uid, role, eventInfo, user, fastGptChatSession, serverId, qwExternalContacts);
+                }
+            }else{
+                aiEventProcess(sender, uid, role, contentKh, user, fastGptChatSession, serverId, qwExternalContacts);
+            }
 
 
             if (result.isArtificial()){
@@ -754,10 +762,12 @@ public class AiHookServiceImpl implements AiHookService {
     private void addUserInfoNew(String word,FastGptChatSession fastGptChatSession)  {
         com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(word);
         String userInfo = jsonObject.getString("userInfo");
-        FastGptChatSession chatSession = new FastGptChatSession();
-        chatSession.setSessionId(fastGptChatSession.getSessionId());
-        chatSession.setUserInfo(userInfo);
-        fastGptChatSessionMapper.updateFastGptChatSession(chatSession);
+        if(userInfo != null && !userInfo.isEmpty()){
+            FastGptChatSession chatSession = new FastGptChatSession();
+            chatSession.setSessionId(fastGptChatSession.getSessionId());
+            chatSession.setUserInfo(userInfo);
+            fastGptChatSessionMapper.updateFastGptChatSession(chatSession);
+        }
     }
 
     private void sendImgMsg(String contentKh, Long sender, String uuid, Long serverId) {