using AntDesign; using AntDesign.TableModels; using FFmpeg.NET.Services; using Learn.VideoAnalysis.Controllers.Dto; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.DataProtection.KeyManagement; using SqlSugar; using System.Linq.Expressions; using System.Threading.Tasks; using VideoAnalysisCore.AICore.GPT.Dto; using VideoAnalysisCore.AICore.SherpaOnnx; using VideoAnalysisCore.Common; using VideoAnalysisCore.Enum; using VideoAnalysisCore.Model; using VideoAnalysisCore.Model.Dto; namespace Learn.VideoAnalysis.Components.Pages { public partial class VideoTaskShow : ComponentBase { [Inject] private ConfirmService ComfirmService { get; set; } = default!; [Inject] private IHttpContextAccessor HttpContext { get; set; } = default!; [Inject] private Repository taskDB { get; set; } = default!; private VideoTask nowTask { get; set; } = default!; private string videoPath { get; set; } = default!; /// /// 字幕 /// private SenseVoiceRes[] captionsArr { get; set; } = default!; /// /// 分段 /// private VideoKnowRes[] videoKnows { get; set; } = default!; /// /// 在渲染页面之后 /// /// /// protected override async Task OnAfterRenderAsync(bool firstRender) { } /// /// 初始化 /// protected override async void OnInitialized() { var routeData = HttpContext.HttpContext.GetRouteData(); if (routeData is null) return; long taskId = (long)routeData.Values["id"]; 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()); } private async Task Comfirm(string message) { return await ComfirmService.Show(message, "提示", ConfirmButtons.YesNo, ConfirmIcon.Warning) == ConfirmResult.Yes; } } }