From 0229ae490ba5e15f6a7cd4b6554ff2a71c89f976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Tue, 12 Nov 2024 10:08:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=90=E7=A4=BA=E8=AF=8D?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=20=E7=99=BB=E5=BD=95=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Layouts/BasicLayout.razor.cs | 13 + .../Pages/EvaluationProject.razor.cs | 2 + VideoAnalysis/Components/Pages/Login.razor | 53 ++++ VideoAnalysis/Components/Pages/Login.razor.cs | 71 ++++++ .../Components/Pages/Login.razor.css | 240 ++++++++++++++++++ .../Components/Pages/VideoTaskPage.razor.cs | 2 + VideoAnalysis/Controllers/ApiController.cs | 13 +- VideoAnalysis/Controllers/Dto/ApiDto.cs | 4 + VideoAnalysis/Learn.VideoAnalysis.csproj | 6 + VideoAnalysis/Program.cs | 8 +- .../AICore/ChatGPT/Dto/CallGPTRes.cs | 2 +- .../AICore/ChatGPT/Dto/QuestionRes.cs | 4 + .../AICore/ChatGPT/KIMI/KIMI_GPT.cs | 46 ++-- VideoAnalysisCore/Common/RedisExpand.cs | 6 + VideoAnalysisCore/Enum/QuestionTypeEnum.cs | 13 +- VideoAnalysisCore/Enum/RedisChannelEnum.cs | 14 +- .../Enum/TeacherAnswerTypeEnum.cs | 17 ++ .../Model/Dto/SpeakerCaptionsDto.cs | 20 +- VideoAnalysisCore/Model/VideoTask.cs | 13 +- 19 files changed, 500 insertions(+), 47 deletions(-) create mode 100644 VideoAnalysis/Components/Pages/Login.razor create mode 100644 VideoAnalysis/Components/Pages/Login.razor.cs create mode 100644 VideoAnalysis/Components/Pages/Login.razor.css create mode 100644 VideoAnalysisCore/Enum/TeacherAnswerTypeEnum.cs diff --git a/VideoAnalysis/Components/Layouts/BasicLayout.razor.cs b/VideoAnalysis/Components/Layouts/BasicLayout.razor.cs index af76e51..d2ccff0 100644 --- a/VideoAnalysis/Components/Layouts/BasicLayout.razor.cs +++ b/VideoAnalysis/Components/Layouts/BasicLayout.razor.cs @@ -1,6 +1,7 @@ using AntDesign.Extensions.Localization; using AntDesign.ProLayout; using Microsoft.AspNetCore.Components; +using Microsoft.Identity.Client.Extensions.Msal; using System.Globalization; using System.Net.Http.Json; @@ -9,7 +10,9 @@ namespace VideoAnalysisRazor.Layouts public partial class BasicLayout : LayoutComponentBase, IDisposable { private MenuDataItem[] _menuData; + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + [Inject] IHttpContextAccessor HttpContextAccessor { get; set; } = default!; [Inject] private ReuseTabsService TabService { get; set; } bool collapsed; @@ -17,8 +20,14 @@ namespace VideoAnalysisRazor.Layouts { collapsed = !collapsed; } + protected override async Task OnInitializedAsync() { + if (!CheckLogin()) + { + NavigationManager.NavigateTo("/Login"); + return; + } _menuData = [ new MenuDataItem { @@ -37,6 +46,10 @@ namespace VideoAnalysisRazor.Layouts ]; } + public bool CheckLogin() + { + return HttpContextAccessor.HttpContext?.Session.GetInt32("Login") == 1; + } void Reload() { TabService.ReloadPage(); diff --git a/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs b/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs index eb292fd..81c841c 100644 --- a/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs +++ b/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs @@ -1,4 +1,5 @@ using AntDesign.TableModels; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Components; using SqlSugar; using System.Linq.Expressions; @@ -7,6 +8,7 @@ using VideoAnalysisCore.Model; namespace Learn.VideoAnalysis.Components.Pages { + [Authorize] public partial class EvaluationProject : ComponentBase { diff --git a/VideoAnalysis/Components/Pages/Login.razor b/VideoAnalysis/Components/Pages/Login.razor new file mode 100644 index 0000000..8aedc23 --- /dev/null +++ b/VideoAnalysis/Components/Pages/Login.razor @@ -0,0 +1,53 @@ +@page "/Login" +@using AntDesign +@using AntDesign.TableModels +@using System.ComponentModel.DataAnnotations +@using SqlSugar +@using VideoAnalysisCore.Model +@using VideoAnalysisCore.Model.Dto + + +
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+

登录

+
+
+ +
+
+ + +
+
+ + +
+ @*

+ 忘记密码? + 点击这里 + +

+

+ 没有账户? + 注册 + +

*@ +
+
+
+
+ +
diff --git a/VideoAnalysis/Components/Pages/Login.razor.cs b/VideoAnalysis/Components/Pages/Login.razor.cs new file mode 100644 index 0000000..784447e --- /dev/null +++ b/VideoAnalysis/Components/Pages/Login.razor.cs @@ -0,0 +1,71 @@ +using AntDesign; +using AntDesign.TableModels; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.DataProtection.KeyManagement; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using System.Linq.Expressions; +using System.Threading.Tasks; +using VideoAnalysisCore.Common; +using VideoAnalysisCore.Enum; +using VideoAnalysisCore.Model; +using VideoAnalysisCore.Model.Dto; + +namespace Learn.VideoAnalysis.Components.Pages +{ + public partial class Login : ComponentBase + { + [Inject] IHttpContextAccessor HttpContextAccessor { get; set; } = default!; + [Inject] private Repository taskDB { get; set; } = default!; + [Inject] private NavigationManager NavigationManager { get; set; } = default!; + [Inject] private INotificationService _notice { get; set; } = default!; + + /// + /// 输入的账号 + /// + public string InputAccount = string.Empty; + /// + /// 输入的密码 + /// + public string InputPassword= string.Empty; + /// + /// 初始化 + /// + protected override void OnInitialized() + { + + } + /// + /// 登录函数 + /// + public async Task LoginFunAsync() + { + if (string.IsNullOrEmpty(InputAccount) || string.IsNullOrEmpty(InputPassword)) + { + await _notice.Open(new NotificationConfig() + { + Message = "提示", + Description = "账号/密码必填", + NotificationType = NotificationType.Warning + }); + } + if (InputAccount == "admin" && InputPassword == "q1w2e3!@#") + { + HttpContextAccessor.HttpContext?.Session + .SetInt32("Login", 1); + NavigationManager.NavigateTo("/"); + } + else + { + await _notice.Open(new NotificationConfig() + { + Message = "提示", + Description = "账号/密码输入错误", + NotificationType = NotificationType.Warning + }); + } + } + + } + +} diff --git a/VideoAnalysis/Components/Pages/Login.razor.css b/VideoAnalysis/Components/Pages/Login.razor.css new file mode 100644 index 0000000..78ee8be --- /dev/null +++ b/VideoAnalysis/Components/Pages/Login.razor.css @@ -0,0 +1,240 @@ +input[aria-hidden="true"] { + display: none !important; +} +/* Ĭϱ߾࣬ +ʹ߿ڱ߾ֵԪصwidthheight */ + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +/* ʹflex֣ݴֱˮƽ */ + +section { + /* Զλ */ + position: relative; + overflow: hidden; + display: flex; + justify-content: center; + align-items: center; + min-height: 100vh; + /* linear-gradient() ڴһʾֻɫԽͼƬ */ + background: linear-gradient(to bottom, #f1f4f9, #dff1ff); +} + + /* ɫ */ + + section .color { + /* Զλ */ + position: absolute; + /* ʹfilter(˾) ԣͼø˹ģ*/ + filter: blur(200px); + } + + /* :nth-child(n) ѡƥ丸Ԫеĵ n Ԫ */ + + section .color:nth-child(1) { + top: -350px; + width: 600px; + height: 600px; + background: #ff359b; + } + + section .color:nth-child(2) { + bottom: -150px; + left: 100px; + width: 500px; + height: 500px; + background: #fffd87; + } + + section .color:nth-child(3) { + bottom: 50px; + right: 100px; + width: 500px; + height: 500px; + background: #00d2ff; + } + +.box { + position: relative; +} + + /* Բʽ */ + + .box .circle { + position: absolute; + background: rgba(255, 255, 255, 0.1); + /* backdrop-filterΪһԪغģЧ */ + backdrop-filter: blur(5px); + box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1); + border: 1px solid rgba(255, 255, 255, 0.5); + border-right: 1px solid rgba(255, 255, 255, 0.2); + border-bottom: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 50%; + /* ʹfilter(˾) ԣıɫ + hue-rotate(deg) ͼӦɫת + calc() ڶ̬㳤ֵ + var() ԶCSSֵx*/ + filter: hue-rotate(calc(var(--x) * 70deg)); + /* öanimateҪ10sɶ + linearʾͷβٶͬģ + infiniteָӦѭ޴*/ + animation: animate 10s linear infinite; + /* ̬㶯ӳټ벥 */ + animation-delay: calc(var(--x) * -1s); + } + +/* Բ */ + +@keyframes animate { + 0%, 100%, { + transform: translateY(-50px); + } + + 50% { + transform: translateY(50px); + } +} + +.box .circle:nth-child(1) { + top: -50px; + right: -60px; + width: 100px; + height: 100px; +} + +.box .circle:nth-child(2) { + top: 150px; + left: -100px; + width: 120px; + height: 120px; + z-index: 2; +} + +.box .circle:nth-child(3) { + bottom: 50px; + right: -60px; + width: 80px; + height: 80px; + z-index: 2; +} + +.box .circle:nth-child(4) { + bottom: -80px; + left: 100px; + width: 60px; + height: 60px; +} + +.box .circle:nth-child(5) { + top: -80px; + left: 140px; + width: 60px; + height: 60px; +} + +/* ¼ʽ */ + +.container { + position: relative; + width: 400px; + min-height: 400px; + background: rgba(255, 255, 255, 0.1); + display: flex; + justify-content: center; + align-items: center; + backdrop-filter: blur(5px); + box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1); + border: 1px solid rgba(255, 255, 255, 0.5); + border-right: 1px solid rgba(255, 255, 255, 0.2); + border-bottom: 1px solid rgba(255, 255, 255, 0.2); +} + +.form { + position: relative; + width: 100%; + height: 100%; + padding: 50px; +} + + /* ¼ʽ */ + + .form h2 { + position: relative; + color: #fff; + font-size: 24px; + font-weight: 600; + letter-spacing: 5px; + margin-bottom: 30px; + cursor: pointer; + } + + /* ¼»ʽ */ + + .form h2::before { + content: ""; + position: absolute; + left: 0; + bottom: -10px; + width: 0px; + height: 3px; + background: #fff; + transition: 0.5s; + } + + .form h2:hover:before { + width: 53px; + } + + .form .inputBox { + width: 100%; + margin-top: 20px; + } + + /* ʽ */ + + .form .inputBox input { + width: 100%; + padding: 10px 20px; + background: rgba(255, 255, 255, 0.2); + outline: none; + border: none; + border-radius: 30px; + border: 1px solid rgba(255, 255, 255, 0.5); + border-right: 1px solid rgba(255, 255, 255, 0.2); + border-bottom: 1px solid rgba(255, 255, 255, 0.2); + font-size: 16px; + letter-spacing: 1px; + color: #fff; + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); + } + + .form .inputBox input::placeholder { + color: #fff; + } + + /* ¼ťʽ */ + + .form .inputBox input[type="submit"] { + background: #fff; + color: #666; + max-width: 100px; + margin-bottom: 20px; + font-weight: 600; + cursor: pointer; + } + +.forget { + margin-top: 6px; + color: #fff; + letter-spacing: 1px; +} + + .forget a { + color: #fff; + font-weight: 600; + text-decoration: none; + } diff --git a/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs b/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs index 863725e..41c1867 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs +++ b/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs @@ -34,6 +34,8 @@ namespace Learn.VideoAnalysis.Components.Pages async void ReStart(VideoTaskDto query) { var lastEnum = (await RedisExpand.Redis.HMGetAsync(RedisExpandKey.Task(query.Id), "LastEnum")).FirstOrDefault() ; + await taskDB.UpdateAsync(s => new VideoTask() + { ErrorMessage = string.Empty },s => s.Id == query.Id); RedisExpand.InsertChannel(lastEnum, query.Id); } /// diff --git a/VideoAnalysis/Controllers/ApiController.cs b/VideoAnalysis/Controllers/ApiController.cs index 54a370c..d140006 100644 --- a/VideoAnalysis/Controllers/ApiController.cs +++ b/VideoAnalysis/Controllers/ApiController.cs @@ -35,15 +35,18 @@ namespace Learn.VideoAnalysis.Controllers } /// - /// + /// ȡƵϢtaskId/tagIdѡһ /// /// - /// + /// Զid /// [HttpGet(Name = "TaskInfo")] - public async Task TaskInfo(long taskId) + public async Task TaskInfo(long taskId,string tagId) { - var task = await videoTaskDB.GetFirstAsync(s => s.Id == taskId); + var task = await videoTaskDB.AsQueryable() + .WhereIF(taskId!=0, s => s.Id == taskId) + .WhereIF(string.IsNullOrEmpty(tagId), s => s.TagId == tagId) + .FirstAsync(); if (task.LastEnum != RedisChannelEnum.EndTask) return BadRequest(new { Enum = task.LastEnum ,Task = task.ChatAnalysis}); return Ok(new { Enum = task.LastEnum, Task = task.ChatAnalysis }); @@ -79,7 +82,7 @@ namespace Learn.VideoAnalysis.Controllers MediaUrl = req.MediaUrl, ApiToken = req.ApiToken, Tag = req.Tag, - CallBackUrl = req.CallBackUrl, + TagId = req.TagId, }; // task.Id = await videoTaskDB.InsertReturnBigIdentityAsync(task); diff --git a/VideoAnalysis/Controllers/Dto/ApiDto.cs b/VideoAnalysis/Controllers/Dto/ApiDto.cs index 5c14576..fa0b0bc 100644 --- a/VideoAnalysis/Controllers/Dto/ApiDto.cs +++ b/VideoAnalysis/Controllers/Dto/ApiDto.cs @@ -23,6 +23,10 @@ namespace Learn.VideoAnalysis.Controllers.Dto /// public string Tag { get; set; } = string.Empty; /// + /// 自定义Id可用于任务完成之后的查询 + /// + public string? TagId { get; set; } + /// ///回调Api地址 /// //[Required(ErrorMessage = "回调Api地址是必填项")] diff --git a/VideoAnalysis/Learn.VideoAnalysis.csproj b/VideoAnalysis/Learn.VideoAnalysis.csproj index ea4259f..aa80bf3 100644 --- a/VideoAnalysis/Learn.VideoAnalysis.csproj +++ b/VideoAnalysis/Learn.VideoAnalysis.csproj @@ -31,4 +31,10 @@ + + + true + + + diff --git a/VideoAnalysis/Program.cs b/VideoAnalysis/Program.cs index 6b4d9c2..970f82e 100644 --- a/VideoAnalysis/Program.cs +++ b/VideoAnalysis/Program.cs @@ -81,8 +81,12 @@ namespace Learn.VideoAnalysis builder.Services.AddHttpClient(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); - - + builder.Services.AddSession(options => + { + options.IdleTimeout = TimeSpan.FromMinutes(30); + options.Cookie.HttpOnly = true; + options.Cookie.IsEssential = true; + }); var app = builder.Build(); diff --git a/VideoAnalysisCore/AICore/ChatGPT/Dto/CallGPTRes.cs b/VideoAnalysisCore/AICore/ChatGPT/Dto/CallGPTRes.cs index 0d09fa3..0d40e7d 100644 --- a/VideoAnalysisCore/AICore/ChatGPT/Dto/CallGPTRes.cs +++ b/VideoAnalysisCore/AICore/ChatGPT/Dto/CallGPTRes.cs @@ -37,7 +37,7 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto /// /// 教师提问类型 /// - public KeyValue[]? QuestionType { get; set; } + public Dictionary? QuestionType { get; set; } /// /// 时间段概览 diff --git a/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs b/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs index 3cc2613..52dee63 100644 --- a/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs +++ b/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs @@ -39,6 +39,10 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto /// public long Id { get; set; } /// + /// AI评估得分 + /// + public int Score { get; set; } + /// /// 提词 /// public string Prompt { get; set; } = string.Empty; diff --git a/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs b/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs index a51e65e..a3ce0b3 100644 --- a/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs +++ b/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs @@ -55,7 +55,7 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI criteriaBuilder.Append(item.Id); criteriaBuilder.Append(":"); criteriaBuilder.Append(item.NamePrompt); - criteriaBuilder.Append("结果类型 int (1-10分 5分不合格 10分满分)|"); + criteriaBuilder.Append("请基于解释打分(0-10分 6分为及格线) 结果类型 int |"); } //拼接枚举提问 foreach (var value in System.Enum.GetValues(typeof(QuestionTypeEnum))) @@ -99,6 +99,8 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI throw new Exception($"KIMI模型返回异常 Chat 请求参数: {System.Text.Json.JsonSerializer.Serialize(chatRep)} " + $" chatResp {System.Text.Json.JsonSerializer.Serialize(chatResp)}"); var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content; + + if (chatResContent is null) throw new Exception("KIMIGPT返回message无效结果"); @@ -114,18 +116,20 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI var criteriaDic = criteriaArr.ToDictionary(s => s.Id); gptRes.Assessment = new AssessmentDto() { - Bad = arr1.Where(s => !s.结果.ToObject()) + Bad = arr1.Where(s => s.结果.ToObject() < 6) .Select(s => new CourseCriteria() { Id = criteriaDic[s.问题编号].Id, ImprovedMethods = criteriaDic[s.问题编号].ImprovedMethods, Analyze = s.问题解释??string.Empty, + Score = s.结果.ToObject(), Prompt = criteriaDic[s.问题编号].Flaw, }).ToArray(), - Merit = arr1.Where(s => s.结果.ToObject()) + Merit = arr1.Where(s => s.结果.ToObject() >= 6) .Select(s => new CourseCriteria() { Id = criteriaDic[s.问题编号].Id, + Score = s.结果.ToObject(), //ImprovedMethods = criteriaDic[s.问题编号].ImprovedMethods, Analyze = s.问题解释 ?? string.Empty, Prompt = criteriaDic[s.问题编号].Advantage, @@ -134,35 +138,37 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI //高频词汇 gptRes.Hotwords = arr2[(int)QuestionTypeEnum.高频词].结果.ToObject()??["暂无数据"]; - //提问类型 - gptRes.QuestionType = arr2[(int)QuestionTypeEnum.提问类型].结果.ToObject[]>(); + //时间段概览 gptRes.TimeOverview = arr2[(int)QuestionTypeEnum.时间段概览] - .结果.ToObject[]>()?.Select(s => - new TimeBase - { - Start = double.Parse(s.key.Split(":")[1]??0.ToString()), - End = double.Parse(s.key.Split(":")[2]??0.ToString()), - Content = s.value, - }); + .结果.ToObject(); + //提问类型 + gptRes.QuestionType = arr2[(int)QuestionTypeEnum.提问类型] + .结果.ToObject>(); + //分析上课时间段情况 分析 独立学习 小组合作 随堂练习等情况 var extraTimeBase = arr2[(int)QuestionTypeEnum.额外课堂情况] - .结果.ToObject[]>()?.Select(s => - new TimeBase - { - Start = double.Parse(s.key.Split(":")[1] ?? 0.ToString()), - End = double.Parse(s.key.Split(":")[2] ?? 0.ToString()), - Content = s.value, - }); + .结果.ToObject>()?.Select(s => + new TimeBase(s.Value,s.Key.ToString())); var tId = long.Parse(task); var taskData = await videoTaskDB.GetFirstAsync(s => s.Id == tId); taskData.ChatAnalysis = gptRes; + taskData.ChatAnalysisScore = gptRes.Assessment.Merit?.Sum(s=>s.Score)??0; + taskData.ErrorMessage = string.Empty; + taskData.TotalTokens = chatResp.usage.total_tokens; taskData.LastEnum = RedisChannelEnum.EndTask; await videoTaskDB.AsUpdateable(taskData) - .UpdateColumns(it => new { it.ChatAnalysis }).ExecuteCommandAsync(); + .UpdateColumns(it => new + { + it.ChatAnalysis, + it.ChatAnalysisScore, + it.ErrorMessage, + it.TotalTokens, + it.LastEnum, + }).ExecuteCommandAsync(); return gptRes; } } diff --git a/VideoAnalysisCore/Common/RedisExpand.cs b/VideoAnalysisCore/Common/RedisExpand.cs index 60d5455..56f97d1 100644 --- a/VideoAnalysisCore/Common/RedisExpand.cs +++ b/VideoAnalysisCore/Common/RedisExpand.cs @@ -209,6 +209,12 @@ namespace VideoAnalysisCore.Common //执行任务时出现异常 var error = ex.Message + ex.StackTrace; await SetTaskErrorMessage(long.Parse(taskId), error); + + Console.WriteLine("====================[出现异常]===================="); + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); + Console.WriteLine("=============================================="); + } } else diff --git a/VideoAnalysisCore/Enum/QuestionTypeEnum.cs b/VideoAnalysisCore/Enum/QuestionTypeEnum.cs index 868a243..8dd19a6 100644 --- a/VideoAnalysisCore/Enum/QuestionTypeEnum.cs +++ b/VideoAnalysisCore/Enum/QuestionTypeEnum.cs @@ -10,14 +10,17 @@ namespace VideoAnalysisCore.Enum enum QuestionTypeEnum { - [Display(Prompt = "分析授课中使用的高频词10个频率从高到低 结果类型[]")] + [Display(Prompt = "分析授课中使用的高频词" + + "10个频率从高到低 结果类型[]")] 高频词 = 100, - [Display(Prompt = "分析字幕中每5分钟的一个概览 结果类型[{key:时间段,value:概览}]")] + [Display(Prompt = "总结字幕内容划分成10个时间段" + + "并且提取它们的内容概览 结果类型[{Start:开始时间,End:结束时间,Content:概览}]")] 时间段概览 = 101, - [Display(Prompt = "统计授课中教师提问类型的次数 类型[重复回答,老师追问,简单性表演,老师补充答案,表扬并补充答案] 结果类型[{key:类型,value:次数}]")] + [Display(Prompt = "统计授课中教师提问类型的次数 提问类型" + + "[重复回答,老师追问,简单性表扬,老师补充答案,表扬并补充答案] 结果类型{提问类型:次数}")] 提问类型 = 102, - - [Display(Prompt = " 分析授课中教师提到 类型[独立学习,小组合作,随堂练习]的时间段 结果类型[{key:类型,value:时间段/null}] ")] + [Display(Prompt = " 分析授课中教师提到 类型" + + "[独立学习,小组合作,随堂练习]的时间段 结果类型[{Start:开始时间/null,End:结束时间/null,Content:类型}]")] 额外课堂情况 = 103, } } diff --git a/VideoAnalysisCore/Enum/RedisChannelEnum.cs b/VideoAnalysisCore/Enum/RedisChannelEnum.cs index f8e1a68..187f0cc 100644 --- a/VideoAnalysisCore/Enum/RedisChannelEnum.cs +++ b/VideoAnalysisCore/Enum/RedisChannelEnum.cs @@ -8,30 +8,30 @@ /// /// 下载文件 /// - DownloadFile = 1, + DownloadFile, /// /// 分离音频 /// - SeparateAudio = 2, + SeparateAudio, /// /// 解析字幕 /// - ParsingCaptions = 3, + ParsingCaptions, /// /// 解析说话人 /// - ParsingSpeaker = 4, + ParsingSpeaker, /// /// Chat模型分析 /// - ChatModelAnalysis = 5, + ChatModelAnalysis, /// /// 回调三方系统 /// - CallBackSystem = 6, + CallBackSystem, /// /// 结束任务 /// - EndTask = 6, + EndTask, } } diff --git a/VideoAnalysisCore/Enum/TeacherAnswerTypeEnum.cs b/VideoAnalysisCore/Enum/TeacherAnswerTypeEnum.cs new file mode 100644 index 0000000..4c2e5fd --- /dev/null +++ b/VideoAnalysisCore/Enum/TeacherAnswerTypeEnum.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VideoAnalysisCore.Enum +{ + public enum TeacherAnswerTypeEnum + { + 重复回答, + 老师追问, + 简单性表扬, + 老师补充答案, + 表扬并补充答案 + } +} diff --git a/VideoAnalysisCore/Model/Dto/SpeakerCaptionsDto.cs b/VideoAnalysisCore/Model/Dto/SpeakerCaptionsDto.cs index 58e52bd..c46e933 100644 --- a/VideoAnalysisCore/Model/Dto/SpeakerCaptionsDto.cs +++ b/VideoAnalysisCore/Model/Dto/SpeakerCaptionsDto.cs @@ -1,4 +1,5 @@ -using VideoAnalysisCore.Enum; +using AntDesign; +using VideoAnalysisCore.Enum; namespace VideoAnalysisCore.Model.Dto { @@ -7,6 +8,23 @@ namespace VideoAnalysisCore.Model.Dto /// public class TimeBase { + /// + /// + /// + /// 时间端字符串 + /// 内容 + public TimeBase(string str, string content) + { + Content = content; + if (string.IsNullOrEmpty(str)) + return; + var arr = str.Split(":"); + if (arr !=null && arr.Length >= 3) + { + Start = double.Parse(arr[1]); + End = double.Parse(arr[2]); + } + } public TimeBase() { diff --git a/VideoAnalysisCore/Model/VideoTask.cs b/VideoAnalysisCore/Model/VideoTask.cs index be55213..07c3d67 100644 --- a/VideoAnalysisCore/Model/VideoTask.cs +++ b/VideoAnalysisCore/Model/VideoTask.cs @@ -48,10 +48,10 @@ namespace VideoAnalysisCore.Model [SugarColumn(Length = 500)] public string Tag { get; set; } /// - ///回调Api地址 + /// 自定义值Id 任务完成后的凭证 /// - [SugarColumn(Length = 500)] - public string CallBackUrl { get; set; } + [SugarColumn(Length = 500,IsNullable =true)] + public string? TagId { get; set; } /// /// 字幕缓存 /// @@ -94,9 +94,10 @@ namespace VideoAnalysisCore.Model get => JsonSerializer.Deserialize(_ChatAnalysis ?? "{}"); set => _ChatAnalysis = JsonSerializer.Serialize(value); } - - - + /// + /// AI模型评分 + /// + public decimal? ChatAnalysisScore { get; set; } /// /// 消耗token ///