Просмотр исходного кода

调整kimi 模型,优化单个拜访生成提示词。

yuanrf 23 часов назад
Родитель
Сommit
6aadb2a7bf

+ 36 - 2
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -36698,16 +36698,50 @@ And (UnitName != '' Or UnitName != null) {sqlWhere}");
 
             KiMiApiClient kiMi = new KiMiApiClient();
 
+
+            string chat = $@"参考这个模板格式来编写一份{dto.ClientName}拜访{dto.ClientPurpose},结合{dto.ClientName}的业务,描述拜访目的,字数在200字内(直接给出拜访目的,不输出其他内容)";
+            var templateSetting = await _sqlSugar.Queryable<Sys_SetData>().FirstAsync(x => x.Id == 1557 && x.IsDel == 0);
+            if (templateSetting != null && !string.IsNullOrEmpty(templateSetting.Remark))
+            {
+                var stringFormatResp = await GeneralMethod.StringFormatAsync(new StringFormatDto
+                {
+                    FormatTemplate = templateSetting.Remark,
+                    Parameters = new List<string>
+                    {
+                        dto.ClientName,
+                        dto.ClientPurpose
+                    }
+                });
+
+                if (stringFormatResp.Success)
+                {
+                    _logger.LogInformation("【Ai续写】模板格式化成功! templateSetting.Id: " + templateSetting.Id + ",结果:" + stringFormatResp.FormattedResult);
+                    chat = stringFormatResp.FormattedResult;
+                }
+                else
+                {
+                    _logger.LogError("【Ai续写】模板格式化失败! templateSetting.Id: " + templateSetting.Id + ",错误:" + stringFormatResp.Message);
+                    jw.Msg = "对话内容模板格式化失败! templateSetting.Id: " + templateSetting.Id + ",错误:" + stringFormatResp.Message;
+                    return Ok(jw);
+                }
+            }
+            else
+            {
+                _logger.LogError("【Ai续写】获取对话内容模板失败! templateSetting.Id: " + templateSetting.Id);
+                jw.Msg = "获取对话内容模板失败! templateSetting.Id: " + templateSetting.Id;
+                return Ok(jw);
+            }
+
             List<SeedMessages> messages = new List<SeedMessages>() {
                  new SeedMessages
                     {
                         Role = KimiRole.system,
                         Content = "你是 Kimi,由 Moonshot AI 提供的人工智能助手,你更擅长中文和英文的对话。你会为用户提供安全,有帮助,准确的回答。"
                     },
-                new SeedMessages
+                 new SeedMessages
                     {
                          Role = KimiRole.user,
-                         Content = $@"参考这个模板格式来编写一份{dto.ClientName}拜访{dto.ClientPurpose},结合{dto.ClientName}的业务,描述拜访目的,字数在200字内(直接给出拜访目的,不输出其他内容)"
+                         Content = chat
                     }
             };
 

+ 1 - 1
OASystem/OASystem.Api/appsettings.json

@@ -476,7 +476,7 @@
     }
   ],
   "KiMiSetting": {
-    "Model": "moonshot-v1-8k",
+    "Model": "kimi-k2.5",
     "BaseUrl": "https://api.moonshot.cn/v1",
     "Key": "sk-AY1Sv4rLnSUgGGHcC8SGSWYYKzGID7leZJcFfxAYozLC8dIc"
     //"Key": "sk-b6jgRbgU4ZtIFLkgMSjtHeU67q8OHzPTqIVuKuNLG50zd5IY" //leiyi kimi key