优化 重试流程
This commit is contained in:
parent
90cf56efec
commit
a2c9831a0a
|
|
@ -5,7 +5,7 @@
|
||||||
@using SqlSugar
|
@using SqlSugar
|
||||||
@using VideoAnalysisCore.Model
|
@using VideoAnalysisCore.Model
|
||||||
|
|
||||||
<Table @ref="_table" Loading="tableLoading" TItem="CourseGradingCriteria" PageSize="15" Total="_total" DataSource="_dataSource" @bind-SelectedRows="_selectedRows" OnChange="OnChange">
|
<Table @ref="_table" Loading="tableLoading" TItem="CourseGradingCriteria" ScrollY="600px" PageSize="15" Total="_total" DataSource="_dataSource" @bind-SelectedRows="_selectedRows" OnChange="OnChange">
|
||||||
<TitleTemplate>
|
<TitleTemplate>
|
||||||
<Flex Justify="end" Gap="10">
|
<Flex Justify="end" Gap="10">
|
||||||
<Button Type="primary" @onclick="()=> StartEdit(default)">新增</Button>
|
<Button Type="primary" @onclick="()=> StartEdit(default)">新增</Button>
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,13 @@
|
||||||
@using AntDesign
|
@using AntDesign
|
||||||
@using AntDesign.TableModels
|
@using AntDesign.TableModels
|
||||||
@using System.ComponentModel.DataAnnotations
|
@using System.ComponentModel.DataAnnotations
|
||||||
|
@using Learn.VideoAnalysis.Controllers.Dto
|
||||||
@using SqlSugar
|
@using SqlSugar
|
||||||
@using VideoAnalysisCore.Model
|
@using VideoAnalysisCore.Model
|
||||||
@using VideoAnalysisCore.Model.Dto
|
@using VideoAnalysisCore.Model.Dto
|
||||||
@using VideoAnalysisCore.Enum
|
@using VideoAnalysisCore.Enum
|
||||||
|
|
||||||
<Table @ref="_table" Loading="tableLoading" TItem="VideoTaskDto" PageSize="15" Total="_total" DataSource="_dataSource" @bind-SelectedRows="_selectedRows" OnChange="OnChange"
|
<Table @ref="_table" Loading="tableLoading" TItem="VideoTaskDto" ScrollY="600px" PageSize="10" Total="_total" DataSource="_dataSource" @bind-SelectedRows="_selectedRows" OnChange="OnChange"
|
||||||
OnExpand="OnExpand">
|
OnExpand="OnExpand">
|
||||||
<TitleTemplate>
|
<TitleTemplate>
|
||||||
<Flex Justify="end" Gap="10">
|
<Flex Justify="end" Gap="10">
|
||||||
|
|
@ -16,16 +17,16 @@
|
||||||
</TitleTemplate>
|
</TitleTemplate>
|
||||||
<ColumnDefinitions Context="row">
|
<ColumnDefinitions Context="row">
|
||||||
<Selection />
|
<Selection />
|
||||||
<PropertyColumn Property="c=>c.Id" Width="100" Filterable="true" Sortable="true"/>
|
<PropertyColumn Property="c=>c.Id" Width="130px" Filterable="true" Sortable="true" />
|
||||||
<PropertyColumn Property="c=>c.TagId" Width="100" />
|
<PropertyColumn Property="c=>c.TagId" Width="160px" />
|
||||||
<PropertyColumn Property="c=>c.LastEnum" Width="120" />
|
<PropertyColumn Property="c=>c.LastEnum" Width="150px" />
|
||||||
<PropertyColumn Property="c=>c.ApiToken" Width="120" />
|
<PropertyColumn Property="c=>c.ApiToken" Width="150px" />
|
||||||
<PropertyColumn Property="c=>c.ComeFrom" Width="120" />
|
<PropertyColumn Property="c=>c.ComeFrom" Width="100px" />
|
||||||
<PropertyColumn Property="c=>c.MediaUrl" Width="300" />
|
<PropertyColumn Property="c=>c.MediaUrl" Width="320px" />
|
||||||
<PropertyColumn Property="c=>c.TotalTokens" Width="100" />
|
<PropertyColumn Property="c=>c.TotalTokens" Width="100px" />
|
||||||
<PropertyColumn Property="c=>c.CreateTime" />
|
<PropertyColumn Property="c=>c.CreateTime" />
|
||||||
</ColumnDefinitions>
|
</ColumnDefinitions>
|
||||||
<ExpandTemplate Context="rowData" >
|
<ExpandTemplate Context="rowData">
|
||||||
<Descriptions Title="任务详情" Bordered>
|
<Descriptions Title="任务详情" Bordered>
|
||||||
|
|
||||||
<DescriptionsItem Title="@rowData.Data.LastEnum.ToString()">
|
<DescriptionsItem Title="@rowData.Data.LastEnum.ToString()">
|
||||||
|
|
@ -38,7 +39,7 @@
|
||||||
OnClick="()=>RowRestart(rowData)">
|
OnClick="()=>RowRestart(rowData)">
|
||||||
刷新数据
|
刷新数据
|
||||||
</Button>
|
</Button>
|
||||||
<Button Type="@ButtonType.Primary" Danger @onclick="() => ReStart(rowData.Data)">
|
<Button Type="@ButtonType.Primary" Danger @onclick="() => ReStartClick(rowData.Data)">
|
||||||
重试
|
重试
|
||||||
</Button>
|
</Button>
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
|
|
@ -46,26 +47,26 @@
|
||||||
<DescriptionsItem Title="任务时间轴" Span="5">
|
<DescriptionsItem Title="任务时间轴" Span="5">
|
||||||
<Steps Current="@RowSTIndex(rowData)" Status="@RowSTStatus(rowData)">
|
<Steps Current="@RowSTIndex(rowData)" Status="@RowSTStatus(rowData)">
|
||||||
<Step Title="下载文件"
|
<Step Title="下载文件"
|
||||||
Description="@RowST(rowData,RedisChannelEnum.DownloadFile)" />
|
Description="@RowST(rowData,RedisChannelEnum.DownloadFile)" />
|
||||||
|
|
||||||
<Step Title="分离音频"
|
<Step Title="分离音频"
|
||||||
Description="@RowST(rowData,RedisChannelEnum.SeparateAudio)" />
|
Description="@RowST(rowData,RedisChannelEnum.SeparateAudio)" />
|
||||||
|
|
||||||
<Step Title="解析字幕"
|
<Step Title="解析字幕"
|
||||||
Description="@RowST(rowData,RedisChannelEnum.ParsingCaptions)" />
|
Description="@RowST(rowData,RedisChannelEnum.ParsingCaptions)" />
|
||||||
|
|
||||||
<Step Title="解析说话人"
|
<Step Title="解析说话人"
|
||||||
Description="@RowST(rowData,RedisChannelEnum.ParsingSpeaker)" />
|
Description="@RowST(rowData,RedisChannelEnum.ParsingSpeaker)" />
|
||||||
|
|
||||||
<Step Title="Chat模型分析"
|
<Step Title="Chat模型分析"
|
||||||
Description="@RowST(rowData,RedisChannelEnum.ChatModelAnalysis)" />
|
Description="@RowST(rowData,RedisChannelEnum.ChatModelAnalysis)" />
|
||||||
|
|
||||||
<Step Title="结束任务"
|
<Step Title="结束任务"
|
||||||
Description="@RowST(rowData,RedisChannelEnum.EndTask)" />
|
Description="@RowST(rowData,RedisChannelEnum.EndTask)" />
|
||||||
</Steps>
|
</Steps>
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty( @rowData.Data.ErrorMessage))
|
@if (!string.IsNullOrEmpty(@rowData.Data.ErrorMessage))
|
||||||
{
|
{
|
||||||
<DescriptionsItem Title="任务异常" Span="3">
|
<DescriptionsItem Title="任务异常" Span="3">
|
||||||
@rowData.Data.ErrorMessage
|
@rowData.Data.ErrorMessage
|
||||||
|
|
@ -73,6 +74,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
|
|
||||||
</ExpandTemplate>
|
</ExpandTemplate>
|
||||||
</Table>
|
</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>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using AntDesign;
|
using AntDesign;
|
||||||
using AntDesign.TableModels;
|
using AntDesign.TableModels;
|
||||||
using FFmpeg.NET.Services;
|
using FFmpeg.NET.Services;
|
||||||
|
using Learn.VideoAnalysis.Controllers.Dto;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
||||||
|
|
@ -28,19 +29,41 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
List<VideoTaskDto> _dataSource = null;
|
List<VideoTaskDto> _dataSource = null;
|
||||||
RefAsync<int> _total = 0;
|
RefAsync<int> _total = 0;
|
||||||
|
|
||||||
|
bool modalShow = false;
|
||||||
|
|
||||||
bool tableLoading = false;
|
bool tableLoading = false;
|
||||||
private VideoTaskDto selectData;
|
private VideoTaskDto selectData;
|
||||||
private bool rowRestartLoading=false;
|
private bool rowRestartLoading = false;
|
||||||
|
private VideoTaskDto reStartTask ;
|
||||||
|
|
||||||
|
TextValue[] SelectDataSource = Enum.GetValues(typeof(RedisChannelEnum))
|
||||||
|
.Cast<RedisChannelEnum>()
|
||||||
|
.Select(s => new TextValue(s.ToString(), (int)s))
|
||||||
|
.ToArray();
|
||||||
|
int selectEnum = 1;
|
||||||
|
int selectDefaultValue =1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 点击重试
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
async void ReStartClick(VideoTaskDto query)
|
||||||
|
{
|
||||||
|
selectDefaultValue =
|
||||||
|
(await RedisExpand.Redis.HMGetAsync<int>(RedisExpandKey.Task(query.Id), "LastEnum")).FirstOrDefault();
|
||||||
|
selectEnum = selectDefaultValue;
|
||||||
|
reStartTask = query;
|
||||||
|
modalShow = true;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重试
|
/// 重试
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query"></param>
|
/// <param name="query"></param>
|
||||||
async void ReStart(VideoTaskDto query)
|
async void ReStart()
|
||||||
{
|
{
|
||||||
var lastEnum = (await RedisExpand.Redis.HMGetAsync<RedisChannelEnum>(RedisExpandKey.Task(query.Id), "LastEnum")).FirstOrDefault() ;
|
await RedisExpand.SetTaskErrorMessage(reStartTask.Id, null);
|
||||||
await RedisExpand.SetTaskErrorMessage(query.Id, null);
|
RedisExpand.InsertChannel((RedisChannelEnum)selectEnum, reStartTask.Id);
|
||||||
RedisExpand.InsertChannel(lastEnum, query.Id);
|
modalShow = false;
|
||||||
}
|
}
|
||||||
private QueryModel<VideoTaskDto> lastQuery = null;
|
private QueryModel<VideoTaskDto> lastQuery = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -51,7 +74,7 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
async void ShowErrorTask(MouseEventArgs e)
|
async void ShowErrorTask(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
_dataSource = await taskDB.AsQueryable()
|
_dataSource = await taskDB.AsQueryable()
|
||||||
.Where(s=>s.ErrorMessage != null &&s.ErrorMessage!=string.Empty)
|
.Where(s => s.ErrorMessage != null && s.ErrorMessage != string.Empty)
|
||||||
.Select<VideoTaskDto>()
|
.Select<VideoTaskDto>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
_total = _dataSource.Count();
|
_total = _dataSource.Count();
|
||||||
|
|
@ -66,7 +89,7 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
/// <param name="changed"></param>
|
/// <param name="changed"></param>
|
||||||
async void OnChange(QueryModel<VideoTaskDto> query)
|
async void OnChange(QueryModel<VideoTaskDto> query)
|
||||||
{
|
{
|
||||||
lastQuery= query;
|
lastQuery = query;
|
||||||
tableLoading = true;
|
tableLoading = true;
|
||||||
List<IConditionalModel> where = default!;
|
List<IConditionalModel> where = default!;
|
||||||
if (query.FilterModel != null && ((query.FilterModel?.Count() ?? 0) > 0))
|
if (query.FilterModel != null && ((query.FilterModel?.Count() ?? 0) > 0))
|
||||||
|
|
@ -76,13 +99,14 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
_dataSource = await taskDB.AsQueryable()
|
_dataSource = await taskDB.AsQueryable()
|
||||||
.Where(where)
|
.Where(where)
|
||||||
.Select<VideoTaskDto>()
|
.Select<VideoTaskDto>()
|
||||||
|
.OrderByDescending(s => s.Id)
|
||||||
.ToPageListAsync(query.PageIndex - 1, query.PageSize, _total);
|
.ToPageListAsync(query.PageIndex - 1, query.PageSize, _total);
|
||||||
|
|
||||||
tableLoading = false;
|
tableLoading = false;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
}
|
}
|
||||||
public void RowRestart(RowData<VideoTaskDto> rowData)
|
public void RowRestart(RowData<VideoTaskDto> rowData)
|
||||||
{
|
{
|
||||||
rowRestartLoading = true;
|
rowRestartLoading = true;
|
||||||
var item = rowData.Data;
|
var item = rowData.Data;
|
||||||
|
|
@ -101,7 +125,7 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private string RowST(RowData<VideoTaskDto> rowData, RedisChannelEnum e)
|
private string RowST(RowData<VideoTaskDto> rowData, RedisChannelEnum e)
|
||||||
{
|
{
|
||||||
var dic = rowData.Data.StartTimeDic;
|
var dic = rowData.Data.StartTimeDic;
|
||||||
if (dic is null || !dic.ContainsKey(e))
|
if (dic is null || !dic.ContainsKey(e))
|
||||||
|
|
@ -113,20 +137,20 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
var dic = rowData.Data.StartTimeDic;
|
var dic = rowData.Data.StartTimeDic;
|
||||||
if (dic is null)
|
if (dic is null)
|
||||||
return "wait";
|
return "wait";
|
||||||
if(!string.IsNullOrEmpty(rowData.Data.ErrorMessage))
|
if (!string.IsNullOrEmpty(rowData.Data.ErrorMessage))
|
||||||
return "error";
|
return "error";
|
||||||
if(dic.ContainsKey(RedisChannelEnum.EndTask))
|
if (dic.ContainsKey(RedisChannelEnum.EndTask))
|
||||||
return "finish";
|
return "finish";
|
||||||
return "wait";
|
return "wait";
|
||||||
}
|
}
|
||||||
private int RowSTIndex(RowData<VideoTaskDto> rowData)
|
private int RowSTIndex(RowData<VideoTaskDto> rowData)
|
||||||
{
|
{
|
||||||
var dic = rowData.Data.StartTimeDic;
|
var dic = rowData.Data.StartTimeDic;
|
||||||
if (dic is null )
|
if (dic is null)
|
||||||
return 0;
|
return 0;
|
||||||
return (int)dic.LastOrDefault().Key;
|
return (int)dic.LastOrDefault().Key;
|
||||||
}
|
}
|
||||||
private void OnExpand(RowData<VideoTaskDto> rowData)
|
private void OnExpand(RowData<VideoTaskDto> rowData)
|
||||||
{
|
{
|
||||||
RowRestart(rowData);
|
RowRestart(rowData);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,8 @@ namespace Learn.VideoAnalysis.Controllers.Dto
|
||||||
}
|
}
|
||||||
public TextValue(string t,object v)
|
public TextValue(string t,object v)
|
||||||
{
|
{
|
||||||
|
Text = t;
|
||||||
|
Value = v;
|
||||||
}
|
}
|
||||||
public TextValue()
|
public TextValue()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue