优化 提取试题判断界限

This commit is contained in:
小肥羊 2025-06-20 18:18:51 +08:00
parent 4ab527c388
commit 73d4fbd8c1
4 changed files with 55 additions and 29 deletions

View File

@ -72,7 +72,7 @@ namespace VideoAnalysisRazor.Layouts
Name = "文件订阅", Name = "文件订阅",
Key = "NodeSubscriptionPage", Key = "NodeSubscriptionPage",
Icon="clock-circle", Icon="clock-circle",
HideInMenu = false, HideInMenu = true,
} }
]; ];
} }

View File

@ -22,20 +22,18 @@
<Selection /> <Selection />
<PropertyColumn Property="c=>c.Id" Width="110px" Filterable="true" Sortable="true" /> <PropertyColumn Property="c=>c.Id" Width="110px" Filterable="true" Sortable="true" />
<PropertyColumn Property="c=>c.TagId" Width="160px" /> <PropertyColumn Property="c=>c.TagId" Width="160px" />
<PropertyColumn Property="c=>c.VideoType" Width="100px" />
<PropertyColumn Property="c=>c.LastEnum" Width="150px" /> <PropertyColumn Property="c=>c.LastEnum" Width="150px" />
<PropertyColumn Property="c=>c.Subject" Width="100px" /> <PropertyColumn Property="c=>c.Subject" Width="100px" />
<PropertyColumn Property="c=>c.ComeFrom" Width="100px" /> <PropertyColumn Property="c=>c.ComeFrom" Width="100px" />
<PropertyColumn Property="c=>c.MediaUrl" Width="320px" /> <PropertyColumn Property="c=>c.MediaUrl" Width="320px" />
<PropertyColumn Property="c=>c.CreateTime" /> <PropertyColumn Property="c=>c.CreateTime" />
</ColumnDefinitions> </ColumnDefinitions>
<ExpandTemplate Context="rowData"> <ExpandTemplate Context="rowData">
<Descriptions Title="任务详情" Bordered> <Descriptions Title="任务详情" Bordered>
<DescriptionsItem Title="@rowData.Data.LastEnum.ToString()"> <DescriptionsItem Title="@rowData.Data.LastEnum.ToString()">
@rowData.Data.Progress @rowData.Data.Progress
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem Title="操作" Span="2"> <DescriptionsItem Title="操作" Span="2">
<Button Type="@ButtonType.Primary" <Button Type="@ButtonType.Primary"
Loading="rowRestartLoading" Loading="rowRestartLoading"

View File

@ -178,7 +178,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
$"字幕格式(说话人:开始秒:结束秒:内容|下一段字幕).以下是包含时间的视频字幕文本。字幕列表 {captions.Captions}。" + $"字幕格式(说话人:开始秒:结束秒:内容|下一段字幕).以下是包含时间的视频字幕文本。字幕列表 {captions.Captions}。" +
$"最后输出格式为json({checkResFormat})"; $"最后输出格式为json({checkResFormat})";
Console.WriteLine(DateTime.Now + "=>3.开始检查视频分段结果"); Console.WriteLine(DateTime.Now + "=>3.开始检查视频分段结果");
return await ChatAsync<CheckMessageDto>(taskInfo.Id.ToString(), checkMessage, "结果检查"); return await ChatAsync<CheckMessageDto>(taskInfo.Id.ToString(), checkMessage, "结果检查", "deepseek-chat");
} }
/// <summary> /// <summary>
@ -209,10 +209,11 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
var nowCaptionStr =JsonSerializer.Serialize(cArr.Select(s =>s.Text)); var nowCaptionStr =JsonSerializer.Serialize(cArr.Select(s =>s.Text));
var resFormat = """[string(修改结果)]"""; var resFormat = """[string(修改结果)]""";
var postMessages = var postMessages =
$"这是一堂中国课的字幕由结果是语音识别提供。" + $"这是一堂中国{subject}的字幕,由结果是语音识别提供。" +
$"字幕内容与{subject}学科{sections}章节相关。" + $"字幕内容与{subject}学科{sections}章节相关。" +
$"需要你帮我修复其中的错别字,修复公式。" + $"但是识别出来的字幕包含错误的关键字 例如应当是'数列'被识别为'树列'。" +
$"请注意 只允许对字幕进行修改不允许删除字幕的字或者添加字。" + $"所以需要你帮我修复其中的错别字,修复公式排版。" +
$"请注意,只允许对字幕进行修改。" +
$"输出内容只返回json格式({resFormat})" + $"输出内容只返回json格式({resFormat})" +
$"字幕内容(JSON字符串)" + $"字幕内容(JSON字符串)" +
$"`{nowCaptionStr}`" + $"`{nowCaptionStr}`" +
@ -259,31 +260,53 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
{ {
var keyFrameArr = string.IsNullOrEmpty(taskInfo?.PPTVideoCode) var keyFrameArr = string.IsNullOrEmpty(taskInfo?.PPTVideoCode)
? string.Empty ? string.Empty
: $"图像视频中授课内容PPT发生了变化的时间节点是{taskInfo.PPTKeyFrame},授课阶段结果可以参考这些时间节点。"; : $"授课PPT发生了变化的时间是{taskInfo.PPTKeyFrame},所以在这些时间段附近应该发生了授课内容得变化,授课阶段结果尽量参考这些时间节点(PPT与字幕有一定的延时)。";
var resFormat = """[{"StartTime":开始秒(number),"EndTime":结束秒(number),"Stage":阶段(string),"Theme":主题(string),"Content":内容总结(string)}]"""; var resFormat = """[{"StartTime":开始秒(number),"EndTime":结束秒(number),"Stage":阶段(string),"Theme":主题(string),"Content":内容总结(string)}]""";
var exerciseClass = taskInfo?.VideoType == AttachmentsInfoType. var postMessages = string.Empty;
? $"但是本堂课是习题课,所以每个阶段是不同的例题讲解内容。" switch (taskInfo?.VideoType)
: string.Empty; {
//$"请注意 本次分析的视频字幕只是其中一部分 不需要分析出所有类型的授课阶段。"; case AttachmentsInfoType.:
var postMessages = case AttachmentsInfoType.:
$"请通过视频字幕内容分析出视频中课堂的授课阶段。" + postMessages =
$"课堂内容与{taskInfo.Subject}学科下的{sections}章节相关。" + $"请通过视频字幕内容分析出视频中课堂的授课阶段。" +
$"{keyFrameArr}" + $"课堂内容与{taskInfo.Subject}学科下的{sections}章节相关。" +
$"完整的课堂标准流程包含以下5个阶段课程引入/新知讲解/例题精讲/课堂练习/知识总结。"+ $"{keyFrameArr}" +
$"{exerciseClass}" + $"完整的课堂标准流程包含以下5个阶段课程引入/新知讲解/例题精讲/课堂练习/知识总结。" +
$"通过授课阶段的主要讲解内容分析出对应的授课阶段内容总结。" + $"每个类型的授课阶段允许有多个 例如 多个新知讲解/例题精讲..." +
$"通过生成的内容总结分析出对应的授课阶段主题。 "+ $"授课阶段主要由每个知识点或者例题内容的讲解或练习组成。" +
$"最后请检查每个授课阶段的时长,不允许出现低于50秒的阶段。" + $"通过授课阶段的主要讲解内容分析出对应的授课阶段内容总结。" +
$"输出内容只返回json格式({resFormat})" + $"通过生成的内容总结分析出对应的授课阶段主题。 " +
$"字幕格式(开始秒:内容|下一段字幕).以下是包含时间的视频字幕文本。" + $"最后请检查每个授课阶段的时长,不允许出现超出800秒或者低于50秒的授课阶段。" +
$"字幕列表 {captions.Captions} 字幕结束!"; $"如果授课阶段的时长不符合标准那么请合并/拆分附近相邻内容相近的阶段。" +
$"输出内容只返回json格式({resFormat})" +
$"字幕格式(开始秒:内容|下一段字幕).以下是包含时间的视频字幕文本。" +
$"字幕列表 {captions.Captions} 字幕结束!";
break;
case AttachmentsInfoType.:
postMessages =
$"请通过视频字幕内容分析出视频中课堂的授课阶段。" +
$"课堂内容与{taskInfo.Subject}学科下的{sections}章节相关。" +
$"授课阶段是每个知识点。" +
$"{keyFrameArr}" +
$"完整的课堂标准流程包含以下5个阶段课程引入/新知讲解/例题精讲/课堂练习/知识总结。" +
$"但本堂课是习题课,所以大部分阶段是不同的例题讲解内容。" +
$"通过授课阶段的主要讲解内容分析出对应的授课阶段内容总结。" +
$"通过生成的内容总结分析出对应的授课阶段主题。 " +
$"最后请检查每个授课阶段的时长,不允许出现低于50秒的阶段。" +
$"输出内容只返回json格式({resFormat})" +
$"字幕格式(开始秒:内容|下一段字幕).以下是包含时间的视频字幕文本。" +
$"字幕列表 {captions.Captions} 字幕结束!";
break;
case AttachmentsInfoType.:
case AttachmentsInfoType.:
throw new Exception("无效的课程类型");
default:
break;
}
Console.WriteLine(DateTime.Now + $"=>{taskInfo.Id.ToString()}.开始分析视频内容 {tryCount}"); Console.WriteLine(DateTime.Now + $"=>{taskInfo.Id.ToString()}.开始分析视频内容 {tryCount}");
var resData = await ChatAsync<VideoKnowRes[]>(taskInfo.Id.ToString(), postMessages, "分析字幕"); var resData = await ChatAsync<VideoKnowRes[]>(taskInfo.Id.ToString(), postMessages, "分析字幕");
if (taskInfo?.VideoType == AttachmentsInfoType.)
foreach (var item in resData)
item.Stage = StageEnum..ToString();
questionRes.AddRange(resData); questionRes.AddRange(resData);
break; break;
} }
@ -386,7 +409,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
foreach (var item in farmeArr) foreach (var item in farmeArr)
{ {
var knowInfoArr = videoKnowArr var knowInfoArr = videoKnowArr
.Where(s => item+20 >= s.StartTime && item < s.EndTime) .Where(s => item+20 >= s.StartTime && item <= s.EndTime)
.ToArray(); .ToArray();
if (knowInfoArr is null || knowInfoArr.Count() ==0) if (knowInfoArr is null || knowInfoArr.Count() ==0)
continue; continue;

View File

@ -41,6 +41,11 @@ namespace VideoAnalysisCore.Model.Dto
[DisplayName("学科")] [DisplayName("学科")]
public SubjectEnum? Subject { get; set; } public SubjectEnum? Subject { get; set; }
/// <summary> /// <summary>
/// 任务类型
/// </summary>
[DisplayName("任务类型")]
public AttachmentsInfoType? VideoType { get; set; }
/// <summary>
/// 执行进度 /// 执行进度
/// </summary> /// </summary>
[DisplayName("进度")] [DisplayName("进度")]