diff --git a/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs b/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs index fa79c72..50bd345 100644 --- a/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs +++ b/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs @@ -163,9 +163,13 @@ namespace VideoAnalysisCore.AICore.GPT.Dto /// public decimal Score { get; set; } /// - /// 评分 + /// 扣分原因 /// - public string Evaluation { get; set; } + public string MinusScore { get; set; } + /// + /// 改进建议 + /// + public string Suggestion { get; set; } public VideoKnowRes[] Data { get; set; } } diff --git a/VideoAnalysisCore/AICore/GPT/GPTClient.cs b/VideoAnalysisCore/AICore/GPT/GPTClient.cs index b2ac97e..67c7f45 100644 --- a/VideoAnalysisCore/AICore/GPT/GPTClient.cs +++ b/VideoAnalysisCore/AICore/GPT/GPTClient.cs @@ -71,7 +71,7 @@ namespace VideoAnalysisCore.AICore.GPT var chatResp = await PostJsonStreamAsync(Config.Host + Config.Path, chatReq, Config.ApiKey); if (!chatResp.IsSuccessStatusCode) { - await redisManager.AddTaskLog(chatReq.taskId, "=>请求GPT服务器异常 " + chatResp?.StatusCode + " " + await chatResp.Content.ReadAsStringAsync()); + await redisManager.AddTaskLog(chatReq.taskId, "==>请求GPT服务器异常 " + chatResp?.StatusCode + " " + await chatResp.Content.ReadAsStringAsync()); if (--i < 0) { throw new Exception("请求GPT服务器失败次数过多"); @@ -140,8 +140,8 @@ namespace VideoAnalysisCore.AICore.GPT } } } - throw new Exception(DateTime.Now + "=>AI请求超时 " + chatReq.taskId); - //await redisManager.AddTaskLog(chatReq.taskId, DateTime.Now + "=>AI请求超时 " + chatReq.taskId); + throw new Exception(DateTime.Now + "==>AI请求超时 " + chatReq.taskId); + //await redisManager.AddTaskLog(chatReq.taskId, DateTime.Now + "==>AI请求超时 " + chatReq.taskId); //return null; } @@ -206,11 +206,11 @@ namespace VideoAnalysisCore.AICore.GPT } catch (Exception ex) { - await redisManager.AddTaskLog(chatRep.taskId, $"=>GPT结果解析错误 重试剩余{tryCount} {ex.Message} {ex.StackTrace}"); + await redisManager.AddTaskLog(chatRep.taskId, $"==>GPT结果解析错误 重试剩余{tryCount} {ex.Message} {ex.StackTrace}"); } } - await redisManager.AddTaskLog(chatRep.taskId, $"=>GPT请求失败次数过多!!!"); - throw new Exception(DateTime.Now + "=>GPT请求失败次数过多!!!"); + await redisManager.AddTaskLog(chatRep.taskId, $"==>GPT请求失败次数过多!!!"); + throw new Exception(DateTime.Now + "==>GPT请求失败次数过多!!!"); } public async Task PostJsonStreamAsync( @@ -249,7 +249,7 @@ namespace VideoAnalysisCore.AICore.GPT {e.StackTrace} ============================================== """; - await redisManager.AddTaskLog(data.taskId, $"=>GPT Http请求失败 {msg} 1秒后重试"); + await redisManager.AddTaskLog(data.taskId, $"==>GPT Http请求失败 {msg} 1秒后重试"); Thread.Sleep(1000); } } diff --git a/VideoAnalysisCore/AICore/GPT/GTP_Analysis_1.cs b/VideoAnalysisCore/AICore/GPT/GTP_Analysis_1.cs index e313d6d..bd2e285 100644 --- a/VideoAnalysisCore/AICore/GPT/GTP_Analysis_1.cs +++ b/VideoAnalysisCore/AICore/GPT/GTP_Analysis_1.cs @@ -90,7 +90,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek $"输出内容只返回json格式({checkResFormat1})\n" + $" 格式 (方法点Id|方法点名称) \n" + $"提供的`知识点名称({knows})。\n"; - await redisManager.AddTaskLog(taskInfo.Id, "=>2.开始分析视频内容知识点"); + await redisManager.AddTaskLog(taskInfo.Id, "==>2.开始分析视频内容知识点"); VideoKnowRes[] konwRes; var knowOK = false; var chatClentArr = new GPTClient[] { chatGPTClient, geminiClient,deepSeekClient }; @@ -189,7 +189,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek var pptFormat = taskInfo.VideoType == AttachmentsInfoType.复习 ? "这堂课是习题课,所讲解内容几乎都是试题。" : string.Empty; - var checkResFormat = """{"Score":打分(number),"Evaluation":扣分原因/改进建议(string)""";//,"Data":优化后的分段(array)}"""; + var checkResFormat = """{"Score":打分(number),"MinusScore":简洁的扣分原因(string)",Suggestion":改进建议(string)""";//,"Data":优化后的分段(array)}"""; var checkMessage = $""" 请你担任一位专业的视频内容分析教研老师,擅长评估视频内容的结构和逻辑流暢度。 @@ -227,7 +227,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek var newCaptionsList = new List(captionsArr.Length); var spanCount = 75; var totalCount = captionsArr.Length / spanCount + 1; - await redisManager.AddTaskLog(taskInfo.Id, $"=>字幕优化"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>字幕优化"); var chatClentArr = new GPTClient[] { deepSeekClient,chatGPTClient, geminiClient }; await Parallel.ForAsync(0, totalCount, @@ -263,13 +263,13 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek if (resData.Count() == cArr.Count()) break; else - await redisManager.AddTaskLog(taskInfo.Id, $"=>字幕优化 分段{s} AI结果数量不匹配 重试{i}"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>字幕优化 分段{s} AI结果数量不匹配 重试{i}"); } if (resData.Count() != cArr.Count()) { resData = cStrArr.ToArray(); - await redisManager.AddTaskLog(taskInfo.Id, $"=>字幕优化 分段{s} AI结果数量不匹配 采用原始值"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>字幕优化 分段{s} AI结果数量不匹配 采用原始值"); } newCaptionsList.AddRange(resData.Select((text, i) => new SenseVoiceRes() { @@ -349,7 +349,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek /// private async Task AnalysisVideoQuestions(VideoTask taskInfo, List knowledgeInfos) { - await redisManager.AddTaskLog(taskInfo.Id, $"=>{taskInfo.Id} 提取试题"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>{taskInfo.Id} 提取试题"); if (taskInfo is null || string.IsNullOrEmpty(taskInfo.PPTKeyFrame)) return null; var farmeArr = JsonSerializer.Deserialize(taskInfo.PPTKeyFrame); @@ -390,7 +390,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek break; #if DEBUG - await redisManager.AddTaskLog(taskInfo.Id, $"=>{taskInfo.Id} 提取{knowInfoArr.StartTime}秒试题的试题内容"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>{taskInfo.Id} 提取{knowInfoArr.StartTime}秒试题的试题内容"); #endif //var knowArr=JsonSerializer.Serialize(knowInfoArr.Select(s => new { s.KnowPointId, s.KnowPoint })); @@ -449,7 +449,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek } catch (Exception ex) { - await redisManager.AddTaskLog(taskInfo.Id, $"=>{taskInfo.Id} 提取{knowInfoArr.StartTime}秒试题出现错误 {ex.Message}"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>{taskInfo.Id} 提取{knowInfoArr.StartTime}秒试题出现错误 {ex.Message}"); } } } @@ -531,12 +531,13 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek if (questionRes is null) continue; //处理分段 知识点 - var insertData = await GetVideoKnow(questionRes, taskInfo, sections, knowledgeInfos);//ChatGPT + var insertData = await GetVideoKnow(questionRes, taskInfo, sections, knowledgeInfos); //校验结果质量 var checkRes = await VerifySpanQuality(questionRes, taskInfo, captions, sections, Course_Id); - await redisManager.AddTaskLog(taskInfo.Id, $"=>课堂内容AI分析结果 得分=>{checkRes.Score} "); - await redisManager.AddTaskLog(taskInfo.Id, checkRes.Evaluation); + await redisManager.AddTaskLog(taskInfo.Id, $"==>课堂内容AI分析结果 得分=>{checkRes.Score}"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>改进意见 {checkRes.Suggestion}"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>扣分原因 {checkRes.MinusScore}"); if (checkRes != null && checkRes.Score >= 85) { @@ -546,10 +547,10 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek break; } else - await redisManager.AddTaskLog(taskInfo.Id, $"=>课堂内容AI分析结果不合格!即将重试 剩余次数{tryCount}"); + await redisManager.AddTaskLog(taskInfo.Id, $"==>课堂内容AI分析结果不合格!即将重试 剩余次数{tryCount}"); if (questionRes.Any(s => s.KeepTime < 30)) { - await redisManager.AddTaskLog(taskInfo.Id, "=>视频分段过短!! 重新进行AI分析"); + await redisManager.AddTaskLog(taskInfo.Id, "==>视频分段过短!! 重新进行AI分析"); continue; } } diff --git a/VideoAnalysisCore/AICore/SherpaOnnx/SenseVoice.cs b/VideoAnalysisCore/AICore/SherpaOnnx/SenseVoice.cs index 14f74e8..5eaa927 100644 --- a/VideoAnalysisCore/AICore/SherpaOnnx/SenseVoice.cs +++ b/VideoAnalysisCore/AICore/SherpaOnnx/SenseVoice.cs @@ -196,7 +196,7 @@ namespace VideoAnalysisCore.AICore.SherpaOnnx //如果携带任务ID if (!string.IsNullOrEmpty(task)) { - await redisManager.AddTaskLog(task, "=> SenseVoice 字幕数量" + res.Count); + await redisManager.AddTaskLog(task, "==> SenseVoice 字幕数量" + res.Count); var captionsStr = res.ToJson(); await videoTaskDB.AsUpdateable() .SetColumns(it => it.Captions == captionsStr) diff --git a/VideoAnalysisCore/Common/RedisExpand.cs b/VideoAnalysisCore/Common/RedisExpand.cs index 59bebe8..028b295 100644 --- a/VideoAnalysisCore/Common/RedisExpand.cs +++ b/VideoAnalysisCore/Common/RedisExpand.cs @@ -282,7 +282,7 @@ namespace VideoAnalysisCore.Common throw new Exception(@enum + " 未实现"); var tId = taskId.ToString(); - await AddTaskLog(tId, "-------------> 开始执行任务 "); + await AddTaskLog(tId, "==> 开始执行任务 "); try { while (true)