diff --git a/VideoAnalysis/Components/App.razor b/VideoAnalysis/Components/App.razor index afc1961..78db69e 100644 --- a/VideoAnalysis/Components/App.razor +++ b/VideoAnalysis/Components/App.razor @@ -18,7 +18,7 @@ - + @* *@ diff --git a/VideoAnalysis/Components/Pages/Dto/TaskShowRoute.cs b/VideoAnalysis/Components/Pages/Dto/TaskShowRoute.cs new file mode 100644 index 0000000..bb90b83 --- /dev/null +++ b/VideoAnalysis/Components/Pages/Dto/TaskShowRoute.cs @@ -0,0 +1,15 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Security.Policy; + +namespace Learn.VideoAnalysis.Components.Pages.Dto +{ + public class TaskShowRoute : PageModel + { + + public int ID; + public void OnGet(int id) + { + ID = id; + } + } +} diff --git a/VideoAnalysis/Components/Pages/VideoTaskShow.razor b/VideoAnalysis/Components/Pages/VideoTaskShow.razor index fd8cd11..99c6d36 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskShow.razor +++ b/VideoAnalysis/Components/Pages/VideoTaskShow.razor @@ -1,80 +1,72 @@ -@page "/VideoTaskShow/{tid}" -
- - - -
+@page "/VideoTaskShow/{taskId:long}"
- + @if (videoKnows != null) + { +
+ @for (int i = 0; i < videoKnows.Length; i++) + { + var item = videoKnows[i]; + + } +
+ } +
+
-
- - -@code { - -} diff --git a/VideoAnalysis/Components/Pages/VideoTaskShow.razor.cs b/VideoAnalysis/Components/Pages/VideoTaskShow.razor.cs index 87a9449..c41e07d 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskShow.razor.cs +++ b/VideoAnalysis/Components/Pages/VideoTaskShow.razor.cs @@ -5,6 +5,7 @@ using Learn.VideoAnalysis.Controllers.Dto; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.DataProtection.KeyManagement; +using Microsoft.JSInterop; using SqlSugar; using System.Linq.Expressions; using System.Threading.Tasks; @@ -14,15 +15,21 @@ using VideoAnalysisCore.Common; using VideoAnalysisCore.Enum; using VideoAnalysisCore.Model; using VideoAnalysisCore.Model.Dto; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace Learn.VideoAnalysis.Components.Pages { public partial class VideoTaskShow : ComponentBase { - + /// + /// 任务id + /// + [Parameter] + public long? taskId { get; set; } [Inject] private ConfirmService ComfirmService { get; set; } = default!; [Inject] private IHttpContextAccessor HttpContext { get; set; } = default!; [Inject] private Repository taskDB { get; set; } = default!; + [Inject] private IJSRuntime JSRuntime { get; set; } = default!; private VideoTask nowTask { get; set; } = default!; private string videoPath { get; set; } = default!; @@ -42,24 +49,37 @@ namespace Learn.VideoAnalysis.Components.Pages /// protected override async Task OnAfterRenderAsync(bool firstRender) { + if (firstRender) + { + } } + public string getF(VideoKnowRes segment) + { + var sf = (int)((segment.StartTime ?? 0) / 60); + var sm = (int)((segment.StartTime ?? 0) % 60); + var ef = (int)((segment.EndTime ?? 0) / 60); + var em = (int)((segment.EndTime ?? 0) % 60); + return $"{sf}:{sm} - {ef}: {em}"; + } /// /// 初始化 /// protected override async void OnInitialized() { - var routeData = HttpContext.HttpContext.GetRouteData(); - if (routeData is null) + if (this.taskId is null) return; - long taskId = (long)routeData.Values["id"]; + long taskId = this.taskId.Value; nowTask = await taskDB.GetFirstAsync(s => s.Id == taskId); if(nowTask is null) return; captionsArr = RedisExpand.Redis.HMGet(RedisExpandKey.Task(taskId), "Captions").FirstOrDefault(); videoKnows = RedisExpand.Redis.HMGet(RedisExpandKey.Task(taskId), "VideoKnows").FirstOrDefault(); videoPath = AppCommon.GetVideoPath(nowTask.Id.ToString()); + + await JSRuntime.InvokeVoidAsync("setDB", captionsArr,videoKnows, videoPath); + StateHasChanged(); } private async Task Comfirm(string message) diff --git a/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css b/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css index 9ca6b8f..cd3fe16 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css +++ b/VideoAnalysis/Components/Pages/VideoTaskShow.razor.css @@ -6,27 +6,37 @@ #video-container { position: relative; - width: 1600px; + width: 1660px; height: 850px; float: left; + overflow-x: hidden; } video { - width: 100%; - height: 100%; + width: 94%; + height: 85%; } .subtitles { position: absolute; - bottom: -40px; + bottom: 200px; width: 100%; text-align: center; color: white; background-color: rgba(0, 0, 0, 0.7); font-size: 18px; } - +#segmentsContainer:is(:hover) { + width: 400px; + right: 0px; +} #segmentsContainer { + transition:right 0.7s; + z-index:999; + overflow-x: hidden; + background-color: #e3e3e3c2; + position: absolute; + right: -180px; display: flex; flex-direction: column; width: 265px; diff --git a/VideoAnalysis/Program.cs b/VideoAnalysis/Program.cs index f8e077b..ae26073 100644 --- a/VideoAnalysis/Program.cs +++ b/VideoAnalysis/Program.cs @@ -101,6 +101,7 @@ namespace Learn.VideoAnalysis // app.UseExceptionHandler("/Login"); //} + app.UseStaticFiles(); app.UseStaticFiles(new StaticFileOptions { diff --git a/VideoAnalysisCore/AICore/GPT/ChatGPT/Chat_GPT.cs b/VideoAnalysisCore/AICore/GPT/ChatGPT/Chat_GPT.cs index 5edd72d..c64144f 100644 --- a/VideoAnalysisCore/AICore/GPT/ChatGPT/Chat_GPT.cs +++ b/VideoAnalysisCore/AICore/GPT/ChatGPT/Chat_GPT.cs @@ -46,10 +46,10 @@ namespace VideoAnalysisCore.AICore.GPT.ChatGPT foreach (var next in timeBases) { // 如果类型相同,则扩展时间段 - if (current.主题 == next.主题) + if (current.Theme == next.Theme) { - current.结束秒 = Math.Max(current.结束秒.Value, next.结束秒.Value); - current.内容总结 += next.内容总结; + current.EndTime = Math.Max(current.EndTime.Value, next.EndTime.Value); + current.Content += next.Content; } else { diff --git a/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs b/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs index d760934..2519d60 100644 --- a/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs +++ b/VideoAnalysisCore/AICore/GPT/Dto/QuestionRes.cs @@ -15,12 +15,24 @@ namespace VideoAnalysisCore.AICore.GPT.Dto /// /// 问题解释 /// - public float? 开始秒 { get; set; } - public float? 结束秒 { get; set; } - public float? 持续时间 => (结束秒 ?? 0) - 开始秒??0; - public string? 主题 { get; set; } - public string? 章节 { get; set; } - public string? 内容总结 { get; set; } + public float? StartTime { get; set; } + public float? EndTime { get; set; } + /// + /// 持续时间 + /// + public float? KeepTime => (EndTime ?? 0) - StartTime ?? 0; + /// + /// 主题 + /// + public string? Theme { get; set; } + /// + /// 章节 + /// + public string? Section { get; set; } + /// + /// 内容总结 + /// + public string? Content { get; set; } } public class FileNameInfo diff --git a/VideoAnalysisCore/Common/AppCommon.cs b/VideoAnalysisCore/Common/AppCommon.cs index 9f9c210..0b7de74 100644 --- a/VideoAnalysisCore/Common/AppCommon.cs +++ b/VideoAnalysisCore/Common/AppCommon.cs @@ -79,8 +79,7 @@ namespace VideoAnalysisCore.Common /// /// /// - public static string GetVideoPath(string tid) => - Path.Combine(TaskCachedFile, tid, tid + ".mp4"); + public static string GetVideoPath(string tid) => $"./video/{tid}/{tid}.mp4"; } /// diff --git a/VideoAnalysisCore/Common/RedisExpand.cs b/VideoAnalysisCore/Common/RedisExpand.cs index bd6f154..320cff3 100644 --- a/VideoAnalysisCore/Common/RedisExpand.cs +++ b/VideoAnalysisCore/Common/RedisExpand.cs @@ -167,7 +167,7 @@ namespace VideoAnalysisCore.Common var taskData = await DbScoped.SugarScope.Queryable() .FirstAsync(s => s.Id == tId); taskData.ChatAnalysis = gptRes; - taskData.ChatAnalysisScore = gptRes.Assessment.Merit?.Sum(s => s.Score) ?? 0; + taskData.ChatAnalysisScore = gptRes?.Assessment?.Merit?.Sum(s => s.Score) ?? 0; taskData.ErrorMessage = string.Empty; taskData.LastEnum = RedisChannelEnum.EndTask; await DbScoped.SugarScope.Updateable(taskData)