diff --git a/VideoAnalysis/Components/Pages/VideoTaskShow.razor b/VideoAnalysis/Components/Pages/VideoTaskShow.razor index c0f2c25..6ef2722 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskShow.razor +++ b/VideoAnalysis/Components/Pages/VideoTaskShow.razor @@ -11,19 +11,24 @@ @for (int i = 0; i < videoKnows.Length; i++) { var item = videoKnows[i]; -
+
-
@getF(item) @item.Theme
- #@item.KnowPointId @item.KnowPoint +
+
@getF(item) @item.Theme
+ #@item.KnowPointId @item.KnowPoint +
概览: @item.Content

@foreach (var q in item.QuestionArr) { -

问题:

-
@q.Question
- -
+ +
+

问题: @q.StartTime 秒

+
@q.TopicStem
+
@q.Question
+ +

}
@@ -112,6 +117,9 @@ function spClick(i, button) { videoPlayer.currentTime = displayButton[i].startTime; } + function spClickTime(startTime) { + videoPlayer.currentTime = startTime; + } function gd(btn) { let e = btn.parentElement.parentElement if (e.style.right == "0px") { diff --git a/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css b/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css index aac7f01..506a52d 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css +++ b/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css @@ -11,20 +11,24 @@ float: left; overflow-x: hidden; } + .kSpan { color: rgba(120, 120, 120,0.66); font-size: 0.8rem; width: 330px; } + .textEllipsis { white-space: nowrap; /* 禁止换行 */ overflow: hidden; /* 隐藏溢出内容 */ text-overflow: ellipsis; /* 显示省略号 */ } + video { width: 94%; height: 85%; } + .gudingBtn { width: 32px; height: 32px; @@ -32,6 +36,7 @@ video { line-height: 27px; text-align: center; } + .subtitles { position: absolute; bottom: 200px; @@ -41,9 +46,11 @@ video { background-color: rgba(0, 0, 0, 0.7); font-size: 18px; } + #segmentsContainer:is(:hover) { - right: 0px!important; + right: 0px !important; } + #segmentsContainer { transition: right 0.7s; z-index: 999; @@ -62,7 +69,7 @@ video { padding: 10px; align-content: flex-start; justify-content: flex-start; - align-items: flex-end + align-items: center; } .kBtn { @@ -75,8 +82,9 @@ video { background-color: rgb(240, 249, 235); border: 1px solid rgb(179, 225, 157); } + .knowTtileTheme { - font-size: 1.3rem; + font-size: 1.3rem; cursor: pointer; color: rgb(103, 194, 58); } @@ -85,20 +93,26 @@ video { background-color: rgb(248, 230, 191) !important; border: 1px solid rgb(206, 187, 81); } + .knowDiv { - cursor: pointer; } + .knowQuestion { cursor: pointer; + border: 2px solid #ff000059; + border-radius: 10px; + background-color: #cddc393d; } - .knowDiv:hover .knowTtile { - width: 340px; - display:block; - background-color: rgb(240, 249, 235); - border: 1px solid rgb(179, 225, 157); - } + +.knowDiv:hover .knowTtile { + width: 340px; + display: block; + background-color: rgb(240, 249, 235); + border: 1px solid rgb(179, 225, 157); +} + .knowTtile { position: absolute; text-align: left; display: none; -} \ No newline at end of file +} diff --git a/VideoAnalysis/Program.cs b/VideoAnalysis/Program.cs index 5d1ef8f..25a8e03 100644 --- a/VideoAnalysis/Program.cs +++ b/VideoAnalysis/Program.cs @@ -15,6 +15,8 @@ using Microsoft.AspNetCore.Mvc.Formatters; using System.Security.Cryptography; using System.Diagnostics; using VideoAnalysisCore.AICore.FFMPGE; +using System.Text.Encodings.Web; +using System.Text.Unicode; @@ -39,7 +41,11 @@ namespace Learn.VideoAnalysis loggingBuilder.SetMinimumLevel(LogLevel.Warning); // С־Ϊ Warning }); - builder.Services.AddControllers(); + builder.Services.AddControllers() + .AddJsonOptions(options => + { + options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All); + }); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(c => diff --git a/VideoAnalysisCore/AICore/GPT/DeepSeek/DeepSeek_GPT.cs b/VideoAnalysisCore/AICore/GPT/DeepSeek/DeepSeek_GPT.cs index 686461b..ffc4bd6 100644 --- a/VideoAnalysisCore/AICore/GPT/DeepSeek/DeepSeek_GPT.cs +++ b/VideoAnalysisCore/AICore/GPT/DeepSeek/DeepSeek_GPT.cs @@ -410,36 +410,46 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek Console.WriteLine(DateTime.Now + $"=>{taskInfo.Id} 提取{knowInfoArr.First().StartTime}秒试题的试题内容"); Console.WriteLine( sRes.Result.res.value); var knowArr=JsonSerializer.Serialize(knowInfoArr.Select(s => new { s.KnowPointId, s.KnowPoint })); - var resFormat = """[{"TopicStem":string(试题题干),"Question:string(问题)","KnowPointId":(string)知识点ID}]"""; + var resFormat = """[{"Type":string(试题类型),"TopicStem":string(试题题干),"QuestionArr":[{"Question":string(子问题),"KnowPointId":(string)知识点ID}]}]"""; var postMessages = $"我将提供一段内容是md格式的试题内容字符串。" + - $"请提取出其中的试题内容以及每个试题的问题。并且为每个试题关联上在我限定范围内的知识点(多个则用逗号分割)。" + + $"请提取出其中的试题内容试,题干以及每个试题的问题。并且为每个试题关联上在我限定范围内的知识点(多个则用逗号分割)。" + $"知识点格式(json格式)范围[{knowArr}]。" + - $"排除不是试题内容的文字,优化公式排版并且去除题号。" + - $"如果存在多道题(或者小问),则需要拆分成为多个试题对象!" + + $"排除不是试题内容的文字,优化公式排版并且去除题号,但不要修改latex数学公式。" + + $"如果存在多道题,则需要拆分成为多个试题对象!" + + $"试题的类型约束在 填空题/判断题/选择题/解答题 范围内。" + + $"请检查我提供的字符串内容,如不包含问题试题则返回`[]`" + $"输出内容只返回json格式为({resFormat})" + $"以下是试题内容" + $"`{sRes.Result.res.value}`"; var resData = await ChatAsync(taskInfo.Id.ToString(), postMessages, "提取试题", "deepseek-chat"); foreach (var q in resData) { - q.Id = YitIdHelper.NextId(); - q.FilePath = filePath; - q.VideoTaskId = taskInfo.Id; - q.StageId = knowInfoArr.First().StageId; - foreach (var kid in q.KnowPointId.Split(",")) + var TopicId = YitIdHelper.NextId(); + foreach (var qt in q.QuestionArr) { - insertQuestionKonw.Add(new VideoQuestionKonw() + var vq = q.Adapt(); + vq.Id = YitIdHelper.NextId(); + vq.StartTime = item; + vq.FilePath = filePath; + vq.VideoTaskId = taskInfo.Id; + vq.StageId = knowInfoArr.First().StageId; + vq.Question = qt.Question; + vq.TopicId = TopicId; + insertData.Add(vq); + foreach (var kid in qt.KnowPointId.Split(",")) { - KnowPoint = knowInfoArr.First(s => s.KnowPointId == kid).KnowPoint, - KnowPointId= kid, - StageId =q.StageId, - VideoTaskId = q.VideoTaskId, - VideoQuestionId = q.Id, - }); + insertQuestionKonw.Add(new VideoQuestionKonw() + { + KnowPoint = knowInfoArr.First(s => s.KnowPointId == kid).KnowPoint, + KnowPointId = kid, + StageId = q.StageId, + VideoTaskId = q.VideoTaskId, + VideoQuestionId = q.Id, + }); + } } } - insertData.AddRange(resData); break; } catch (Exception ex) @@ -448,13 +458,6 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek } } } - //分组共同题干试题ID - foreach (var item in insertData.GroupBy(x => x.TopicStem)) - { - var keyId=YitIdHelper.NextId(); - foreach (var s in item) - s.TopicId = keyId; - } //上传oss 并更新imageUrl ossClient.AddVideoQuestionUrl(insertData); diff --git a/VideoAnalysisCore/Controllers/ApiController.cs b/VideoAnalysisCore/Controllers/ApiController.cs index 16d26e7..6df1a0b 100644 --- a/VideoAnalysisCore/Controllers/ApiController.cs +++ b/VideoAnalysisCore/Controllers/ApiController.cs @@ -15,6 +15,7 @@ using VideoAnalysisCore.Model; using Microsoft.AspNetCore.Http; using VideoAnalysisCore.Model.Dto; using VideoAnalysisCore.Controllers.Dto; +using VideoAnalysisCore.Common.Expand; namespace VideoAnalysisCore.Controllers { @@ -44,6 +45,29 @@ namespace VideoAnalysisCore.Controllers throw new Exception("δܻȡͻipַ"); } + +#if DEBUG + + + /// + /// ʼ + /// + /// ļ + /// + [HttpGet(Name = "InitDbTable")] + public IActionResult InitDbTable() + { + var b = AppCommon.Config.DB.UpdateTable; + AppCommon.Config.DB.UpdateTable= true; + SqlSugarExpand.InitDbTable(); + AppCommon.Config.DB.UpdateTable = b; + return Ok(); + } + + +#endif + + /// /// ʶ /// diff --git a/VideoAnalysisCore/Model/Dto/VideoQuestionOSSDto.cs b/VideoAnalysisCore/Model/Dto/VideoQuestionOSSDto.cs index 4f66acf..d7d7248 100644 --- a/VideoAnalysisCore/Model/Dto/VideoQuestionOSSDto.cs +++ b/VideoAnalysisCore/Model/Dto/VideoQuestionOSSDto.cs @@ -1,4 +1,5 @@ -using System; +using SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,9 +7,26 @@ using System.Threading.Tasks; namespace VideoAnalysisCore.Model.Dto { + public class AIQuestionDto + { + + /// + /// 问题 + /// + public string Question { get; set; } + /// + /// 知识点id + /// + public string KnowPointId { get; set; } + } public class VideoQuestionOSSDto: VideoQuestion { + /// + /// 问题 + /// + public AIQuestionDto[]? QuestionArr { get; set; } public string FilePath { get; set; } + public string Type { get; set; } public string KnowPointId { get; set; } } public class VideoQuestionShowDto : VideoQuestion diff --git a/VideoAnalysisCore/Model/VideoQuestion.cs b/VideoAnalysisCore/Model/VideoQuestion.cs index 0df2c89..943aab7 100644 --- a/VideoAnalysisCore/Model/VideoQuestion.cs +++ b/VideoAnalysisCore/Model/VideoQuestion.cs @@ -52,5 +52,9 @@ namespace VideoAnalysisCore.Model /// 问题(设问) /// public string? Question { get; set; } + /// + /// 试题开始时间 + /// + public int StartTime { get; set; } } }