Learn.VideoAnalysis/VideoAnalysis/Components/Pages/VideoTaskPage.razor

101 lines
3.8 KiB
Plaintext

@page "/"
@using AntDesign
@using AntDesign.TableModels
@using System.ComponentModel.DataAnnotations
@using Learn.VideoAnalysis.Controllers.Dto
@using SqlSugar
@using VideoAnalysisCore.Model
@using VideoAnalysisCore.Model.Dto
@using VideoAnalysisCore.Enum
<Table @ref="_table" Loading="tableLoading" TItem="VideoTaskDto" ScrollY="600px" PageSize="10" Total="_total" DataSource="_dataSource"
OnRowClick="(r)=>r.Expanded = !r.Expanded"
@bind-SelectedRows="_selectedRows" OnChange="OnChange"
OnExpand="OnExpand">
<TitleTemplate>
<Flex Justify="end" Gap="10">
<Button Type="primary" @onclick="ShowErrorTask">错误任务</Button>
</Flex>
</TitleTemplate>
<ColumnDefinitions Context="row">
<Selection />
<PropertyColumn Property="c=>c.Id" Width="130px" Filterable="true" Sortable="true" />
<PropertyColumn Property="c=>c.TagId" Width="160px" />
<PropertyColumn Property="c=>c.LastEnum" Width="150px" />
<PropertyColumn Property="c=>c.ApiToken" Width="150px" />
<PropertyColumn Property="c=>c.ComeFrom" Width="100px" />
<PropertyColumn Property="c=>c.MediaUrl" Width="320px" />
<PropertyColumn Property="c=>c.TotalTokens" Width="100px" />
<PropertyColumn Property="c=>c.CreateTime" />
</ColumnDefinitions>
<ExpandTemplate Context="rowData">
<Descriptions Title="任务详情" Bordered>
<DescriptionsItem Title="@rowData.Data.LastEnum.ToString()">
@rowData.Data.Progress%
</DescriptionsItem>
<DescriptionsItem Title="操作" Span="2">
<Button Type="@ButtonType.Primary"
Loading="rowRestartLoading"
OnClick="()=>RowRload(rowData)">
刷新数据
</Button>
<Button Type="@ButtonType.Primary" Danger @onclick="() => ReStartClick(rowData.Data)">
重试
</Button>
</DescriptionsItem>
<DescriptionsItem Title="任务时间轴" Span="5">
<Steps Current="@RowSTIndex(rowData)" Status="@RowSTStatus(rowData)">
<Step Title="下载文件"
Description="@RowST(rowData,RedisChannelEnum.DownloadFile)" />
<Step Title="分离音频"
Description="@RowST(rowData,RedisChannelEnum.SeparateAudio)" />
<Step Title="解析字幕"
Description="@RowST(rowData,RedisChannelEnum.ParsingCaptions)" />
<Step Title="解析说话人"
Description="@RowST(rowData,RedisChannelEnum.ParsingSpeaker)" />
<Step Title="Chat模型分析"
Description="@RowST(rowData,RedisChannelEnum.ChatModelAnalysis)" />
<Step Title="结束任务"
Description="@RowST(rowData,RedisChannelEnum.EndTask)" />
</Steps>
</DescriptionsItem>
@if (!string.IsNullOrEmpty(@rowData.Data.ErrorMessage))
{
<DescriptionsItem Title="任务异常" Span="3">
@rowData.Data.ErrorMessage
</DescriptionsItem>
}
</Descriptions>
</ExpandTemplate>
</Table>
<Modal Title="重试任务"
Width="400"
OnOk="ReStart"
@bind-Visible="@modalShow">
<Title Level="3">ID : @reStartTask.Id</Title>
<p></p>
<p>将从哪个步骤重试?</p>
<Select Style="width:220px;"
DataSource="SelectDataSource"
LabelName="@nameof(TextValue.Text)"
ValueName="@nameof(TextValue.Value)"
@bind-Value="@selectEnum">
</Select>
<br />
<br />
</Modal>