parent
a2c9831a0a
commit
d3cf043e09
|
|
@ -8,7 +8,9 @@
|
|||
@using VideoAnalysisCore.Model.Dto
|
||||
@using VideoAnalysisCore.Enum
|
||||
|
||||
<Table @ref="_table" Loading="tableLoading" TItem="VideoTaskDto" ScrollY="600px" PageSize="10" Total="_total" DataSource="_dataSource" @bind-SelectedRows="_selectedRows" OnChange="OnChange"
|
||||
<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">
|
||||
|
|
@ -36,7 +38,7 @@
|
|||
<DescriptionsItem Title="操作" Span="2">
|
||||
<Button Type="@ButtonType.Primary"
|
||||
Loading="rowRestartLoading"
|
||||
OnClick="()=>RowRestart(rowData)">
|
||||
OnClick="()=>RowRload(rowData)">
|
||||
刷新数据
|
||||
</Button>
|
||||
<Button Type="@ButtonType.Primary" Danger @onclick="() => ReStartClick(rowData.Data)">
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ namespace Learn.VideoAnalysis.Components.Pages
|
|||
private bool rowRestartLoading = false;
|
||||
private VideoTaskDto reStartTask ;
|
||||
|
||||
TextValue[] SelectDataSource = Enum.GetValues(typeof(RedisChannelEnum))
|
||||
static TextValue[] SelectDataSource =
|
||||
Enum.GetValues(typeof(RedisChannelEnum))
|
||||
.Cast<RedisChannelEnum>()
|
||||
.Select(s => new TextValue(s.ToString(), (int)s))
|
||||
.ToArray();
|
||||
|
|
@ -106,7 +107,11 @@ namespace Learn.VideoAnalysis.Components.Pages
|
|||
StateHasChanged();
|
||||
|
||||
}
|
||||
public void RowRestart(RowData<VideoTaskDto> rowData)
|
||||
/// <summary>
|
||||
/// 刷新数据
|
||||
/// </summary>
|
||||
/// <param name="rowData"></param>
|
||||
public void RowRload(RowData<VideoTaskDto> rowData)
|
||||
{
|
||||
rowRestartLoading = true;
|
||||
var item = rowData.Data;
|
||||
|
|
@ -145,14 +150,11 @@ namespace Learn.VideoAnalysis.Components.Pages
|
|||
}
|
||||
private int RowSTIndex(RowData<VideoTaskDto> rowData)
|
||||
{
|
||||
var dic = rowData.Data.StartTimeDic;
|
||||
if (dic is null)
|
||||
return 0;
|
||||
return (int)dic.LastOrDefault().Key;
|
||||
return (int)rowData.Data.LastEnum;
|
||||
}
|
||||
private void OnExpand(RowData<VideoTaskDto> rowData)
|
||||
{
|
||||
RowRestart(rowData);
|
||||
RowRload(rowData);
|
||||
}
|
||||
/// <summary>
|
||||
/// 在渲染页面之后
|
||||
|
|
|
|||
|
|
@ -157,12 +157,15 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
|||
{
|
||||
if (item is null)
|
||||
continue;
|
||||
var r = item.Content.ToEnum<TimeBaseTypeEnum>();
|
||||
if (r is null)
|
||||
continue;
|
||||
var arr = gptRes.TimeBase?
|
||||
.Where(s => s.Start >= item.Start && s.End <= item.End);
|
||||
if (arr is null)
|
||||
continue;
|
||||
foreach (var s in arr)
|
||||
s.TimeBaseType = item.Content.ToEnum<TimeBaseTypeEnum>();
|
||||
s.TimeBaseType = r;
|
||||
}
|
||||
var totalTokens = chatResp?.usage.total_tokens ?? 0;
|
||||
if (totalTokens > 1)
|
||||
|
|
|
|||
|
|
@ -190,6 +190,7 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
|||
try
|
||||
{
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
client.Timeout = TimeSpan.FromSeconds(60 * 20);//超时时间20分钟
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ApiKey);
|
||||
var request = ToHttpRequest(path);
|
||||
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace VideoAnalysisCore.AICore.SherpaOnnx
|
|||
public class SenseVoice
|
||||
{
|
||||
static OfflineRecognizer OR =default!;
|
||||
static VoiceActivityDetector VAD = default!;
|
||||
//static VoiceActivityDetector VAD = default!;
|
||||
static VadModelConfig VADModelConfig = default!;
|
||||
/// <summary>
|
||||
/// 初始化 SenseVoice
|
||||
|
|
@ -71,8 +71,6 @@ namespace VideoAnalysisCore.AICore.SherpaOnnx
|
|||
VADModelConfig = new VadModelConfig();
|
||||
VADModelConfig.SileroVad.Model = Path.Combine(AppCommon.AIModelFile, "sherpa-onnx-sense-voice-24-07-17", "silero_vad.onnx");
|
||||
VADModelConfig.Debug = 0;
|
||||
//缓冲区大小
|
||||
VAD = new VoiceActivityDetector(VADModelConfig, 60);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -94,6 +92,9 @@ namespace VideoAnalysisCore.AICore.SherpaOnnx
|
|||
int numIter = numSamples / windowSize;
|
||||
var totalSecond = numSamples / (float)sampleRate;
|
||||
var res = new List<SenseVoiceRes>(500);
|
||||
|
||||
//缓冲区大小
|
||||
var VAD = new VoiceActivityDetector(VADModelConfig, 60);
|
||||
//var VAD = new VoiceActivityDetector(VADModelConfig, 60);
|
||||
for (int i = 0; i != numIter; ++i)
|
||||
{
|
||||
|
|
@ -173,7 +174,7 @@ namespace VideoAnalysisCore.AICore.SherpaOnnx
|
|||
int numIter = numSamples / windowSize;
|
||||
var totalSecond = numSamples / (float)sampleRate;
|
||||
var res = new List<SenseVoiceRes>(500);
|
||||
//var VAD = new VoiceActivityDetector(VADModelConfig, 60);
|
||||
var VAD = new VoiceActivityDetector(VADModelConfig, 60);
|
||||
for (int i = 0; i != numIter; ++i)
|
||||
{
|
||||
int start = i * windowSize;
|
||||
|
|
|
|||
|
|
@ -206,11 +206,18 @@ namespace VideoAnalysisCore.Common
|
|||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static T? ToEnum<T>(this object data) where T : struct, System.Enum
|
||||
{
|
||||
try
|
||||
{
|
||||
if (data is null || string.IsNullOrEmpty(data?.ToString()))
|
||||
return null;
|
||||
return System.Enum.Parse<T>(data.ToString());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 转化本地缓存目录
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace VideoAnalysisCore.Common
|
|||
Redis.Deserialize = (json, type) => System.Text.Json.JsonSerializer.Deserialize(json, type);
|
||||
Task.Run(() =>
|
||||
{
|
||||
Task.Delay(1000 * 5);
|
||||
Task.Delay(1000 * 10);
|
||||
InitChannel();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue