Explorar el Código

cid大模型配置调整

lmx hace 1 mes
padre
commit
3d786003e2

+ 24 - 0
fs-company/src/main/java/com/fs/company/controller/aicall/CcLlmAgentAccountController.java

@@ -12,12 +12,15 @@ import com.fs.aicall.utils.StringUtils;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
+import com.fs.system.domain.SysConfig;
+import com.fs.system.mapper.SysConfigMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Controller;
@@ -52,6 +55,9 @@ public class CcLlmAgentAccountController extends BaseController
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    SysConfigMapper sysConfigMapper;
+
     private static List<String> hideKeys = Arrays.asList("apiKey", "oauthPrivateKey", "oauthPublicKeyId", "patToken");
 
 
@@ -157,6 +163,17 @@ public class CcLlmAgentAccountController extends BaseController
         if (null == ccLlmAgentAccount.getKbCatId()) {
             ccLlmAgentAccount.setKbCatId(-1);
         }
+        if("DeepSeekChat".equalsIgnoreCase(ccLlmAgentAccount.getProviderClassName())){
+            JSONObject jsonObject = JSONObject.parseObject( ccLlmAgentAccount.getAccountJson());
+            if(null != jsonObject && jsonObject.containsKey("apiKey") && jsonObject.getString("apiKey").contains("**")){
+                SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("cId.config");
+                if(null != sysConfig && StringUtils.isNotBlank(sysConfig.getConfigValue())){
+                    JSONObject configValue = JSONObject.parseObject(sysConfig.getConfigValue());
+                    jsonObject.put("apiKey", configValue.getString("apiKey"));
+                    ccLlmAgentAccount.setAccountJson(JSONObject.toJSONString(jsonObject));
+                }
+            }
+        }
         
         // 新增模型
         int result = ccLlmAgentAccountService.insertCcLlmAgentAccount(ccLlmAgentAccount);
@@ -330,4 +347,11 @@ public class CcLlmAgentAccountController extends BaseController
         }
     }
 
+    @GetMapping("/getCidConfig")
+    @ResponseBody
+    public R getCidConfig()
+    {
+        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey("cId.config");
+        return R.ok().put("data",sysConfig.getConfigValue());
+    }
 }

+ 6 - 0
fs-service/src/main/java/com/fs/company/service/impl/GeneralCustomerEntryServiceImpl.java

@@ -25,6 +25,7 @@ import com.fs.crm.domain.CrmCustomer;
 import com.fs.crm.domain.CrmCustomerPropertyTemplate;
 import com.fs.crm.dto.CrmCustomerAiAutoTagVo;
 import com.fs.crm.mapper.CrmCustomerMapper;
+import com.fs.crm.service.ICrmCustomerAnalyzeService;
 import com.fs.crm.service.ICrmCustomerPropertyTemplateService;
 import com.fs.crm.utils.CrmCustomerAiTagUtil;
 import com.fs.crm.vo.CrmCustomerAiTagVo;
@@ -43,6 +44,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalTime;
+import java.time.temporal.ChronoField;
 import java.util.*;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.Executor;
@@ -72,6 +74,8 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
 
     @Autowired
     ICompanyConfigService companyConfigService;
+    @Autowired
+    ICrmCustomerAnalyzeService crmCustomerAnalyzeService;
     /**
      * 录入客户
      *
@@ -229,6 +233,8 @@ public class GeneralCustomerEntryServiceImpl implements IGeneralCustomerEntrySer
                     data.setTags(sb.toString());
                 }
                 //todo 意向度分析
+                String s = crmCustomerAnalyzeService.aiIntentionDegree(data.getDialogue(), LocalTime.now().getLong(ChronoField.MILLI_OF_SECOND));
+
             } catch (JsonProcessingException e) {
                 log.error("导入用户标签数据解析异常", e);
             }