Compare commits
No commits in common. "5a6dc4961508c5cdfc844d62b3ed73b1fba94a22" and "1cb53fe405cda895b3eedb801e8d32ed1c5e25aa" have entirely different histories.
5a6dc49615
...
1cb53fe405
|
|
@ -69,11 +69,11 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
/// 重试
|
/// 重试
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query"></param>
|
/// <param name="query"></param>
|
||||||
async Task ReStart()
|
async void ReStart()
|
||||||
{
|
{
|
||||||
await redisManager.ClearTaskError(reStartTask.Id);
|
await redisManager.ClearTaskError(reStartTask.Id);
|
||||||
await Task.Run(async () =>
|
_=Task.Run(() =>
|
||||||
await redisManager.InsertChannel((RedisChannelEnum)selectEnum, reStartTask.Id)
|
redisManager.InsertChannel((RedisChannelEnum)selectEnum, reStartTask.Id)
|
||||||
);
|
);
|
||||||
modalShow = false;
|
modalShow = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -554,6 +554,12 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|
||||||
await videoKonwPointDB.InsertRangeAsync(insertData);
|
await videoKonwPointDB.InsertRangeAsync(insertData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine(DateTime.Now + $"=>{task} 得分过低/分段长度不匹配 得分{checkRes?.Score} ");
|
||||||
|
Console.WriteLine(checkRes.Evaluation);
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
if (questionRes.Any(s => s.KeepTime < 30))
|
if (questionRes.Any(s => s.KeepTime < 30))
|
||||||
{
|
{
|
||||||
Console.WriteLine(DateTime.Now + "=>视频分段过短!! 重新进行AI分析");
|
Console.WriteLine(DateTime.Now + "=>视频分段过短!! 重新进行AI分析");
|
||||||
|
|
@ -612,7 +618,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|
||||||
{
|
{
|
||||||
|
|
||||||
var taskId = long.Parse(task);
|
var taskId = long.Parse(task);
|
||||||
var taskInfo = await videoTaskDB.CopyNew().AsQueryable()
|
var taskInfo = await videoTaskDB.AsQueryable()
|
||||||
.Where(s => s.Id == taskId)
|
.Where(s => s.Id == taskId)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
if (taskInfo.VideoType != null&& taskInfo.VideoType!=AttachmentsInfoType.无)
|
if (taskInfo.VideoType != null&& taskInfo.VideoType!=AttachmentsInfoType.无)
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,7 @@ namespace VideoAnalysisCore.Common.Expand
|
||||||
if (ex.Parametres == null) return;
|
if (ex.Parametres == null) return;
|
||||||
//var originColor = Console.ForegroundColor;
|
//var originColor = Console.ForegroundColor;
|
||||||
//Console.ForegroundColor = ConsoleColor.DarkRed;
|
//Console.ForegroundColor = ConsoleColor.DarkRed;
|
||||||
Console.WriteLine($"【{DateTime.Now}——错误SQL - [{config.ConfigId}]】\r\n"+ ex.Message + "\r\n"
|
Console.WriteLine($"【{DateTime.Now}——错误SQL - [{config.ConfigId}]】\r\n"+ ex.Message + "\r\n" + UtilMethods.GetSqlString(config.DbType, ex.Sql, (SugarParameter[])ex.Parametres) + "\r\n");
|
||||||
+ UtilMethods.GetSqlString(config.DbType, ex.Sql, (SugarParameter[])ex.Parametres) + "\r\n");
|
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
//Console.ForegroundColor = originColor;
|
//Console.ForegroundColor = originColor;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -113,40 +113,41 @@ namespace VideoAnalysisCore.Common
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
var SubscribeList = RedisManager.SubscribeList;
|
var SubscribeList = RedisManager.SubscribeList;
|
||||||
SubscribeList.Add(RedisChannelEnum.下载文件, async (task) =>
|
SubscribeList.Add(RedisChannelEnum.下载文件, (task) =>
|
||||||
{
|
{
|
||||||
using var scope = AppCommon.Services?.CreateScope();
|
using var scope = AppCommon.Services?.CreateScope();
|
||||||
if (scope is null || scope.ServiceProvider.GetService<DownloadFile>() is null)
|
if (scope is null || scope.ServiceProvider.GetService<DownloadFile>() is null)
|
||||||
throw new Exception("DownloadFile 未注入");
|
throw new Exception("DownloadFile 未注入");
|
||||||
else
|
else
|
||||||
await scope.ServiceProvider.GetService<DownloadFile>()?.RunTask(task) ;
|
return scope.ServiceProvider.GetService<DownloadFile>()?.RunTask(task) ?? Task.CompletedTask;
|
||||||
});
|
});
|
||||||
SubscribeList.Add(RedisChannelEnum.分离音频, FFMPGE.RunAsync);
|
SubscribeList.Add(RedisChannelEnum.分离音频, FFMPGE.RunAsync);
|
||||||
SubscribeList.Add(RedisChannelEnum.解析字幕, senseVoice.RunTask);
|
SubscribeList.Add(RedisChannelEnum.解析字幕, senseVoice.RunTask);
|
||||||
//SubscribeList.Add(RedisChannelEnum.解析说话人,Speaker.Run);
|
//SubscribeList.Add(RedisChannelEnum.解析说话人,Speaker.Run);
|
||||||
SubscribeList.Add(RedisChannelEnum.AI课程类型, async (task) =>
|
SubscribeList.Add(RedisChannelEnum.AI课程类型,
|
||||||
|
(task) =>
|
||||||
{
|
{
|
||||||
using var scope = AppCommon.Services?.CreateScope();
|
using var scope = AppCommon.Services?.CreateScope();
|
||||||
if (scope is null || scope.ServiceProvider.GetService<IBserGPT>() is null)
|
if (scope is null || scope.ServiceProvider.GetService<IBserGPT>() is null)
|
||||||
throw new Exception("IBserGPT 未注入");
|
throw new Exception("IBserGPT 未注入");
|
||||||
else
|
else
|
||||||
await scope.ServiceProvider.GetService<IBserGPT>()?.GetVideoType(task);
|
return scope.ServiceProvider.GetService<IBserGPT>()?.GetVideoType(task) ?? Task.CompletedTask;
|
||||||
});
|
});
|
||||||
SubscribeList.Add(RedisChannelEnum.AI模型分析, async (task) =>
|
SubscribeList.Add(RedisChannelEnum.AI模型分析, (task) =>
|
||||||
{
|
{
|
||||||
using var scope = AppCommon.Services?.CreateScope();
|
using var scope = AppCommon.Services?.CreateScope();
|
||||||
if (scope is null || scope.ServiceProvider.GetService<IBserGPT>() is null)
|
if (scope is null || scope.ServiceProvider.GetService<IBserGPT>() is null)
|
||||||
throw new Exception("IBserGPT 未注入");
|
throw new Exception("IBserGPT 未注入");
|
||||||
else
|
else
|
||||||
await scope.ServiceProvider?.GetService<IBserGPT>()?.GetKnow(task);
|
return scope.ServiceProvider.GetService<IBserGPT>()?.GetKnow(task) ?? Task.CompletedTask;
|
||||||
});
|
});
|
||||||
SubscribeList.Add(RedisChannelEnum.AI分析试题, async (task) =>
|
SubscribeList.Add(RedisChannelEnum.AI分析试题, (task) =>
|
||||||
{
|
{
|
||||||
using var scope = AppCommon.Services?.CreateScope();
|
using var scope = AppCommon.Services?.CreateScope();
|
||||||
if (scope is null || scope.ServiceProvider.GetService<IBserGPT>() is null)
|
if (scope is null || scope.ServiceProvider.GetService<IBserGPT>() is null)
|
||||||
throw new Exception("IBserGPT 未注入");
|
throw new Exception("IBserGPT 未注入");
|
||||||
else
|
else
|
||||||
await scope.ServiceProvider?.GetService<IBserGPT>()?.GetVideoQuestion(task);
|
return scope.ServiceProvider.GetService<IBserGPT>()?.GetVideoQuestion(task) ?? Task.CompletedTask;
|
||||||
});
|
});
|
||||||
SubscribeList.Add(RedisChannelEnum.结束任务, redisManager.TaskEnd);
|
SubscribeList.Add(RedisChannelEnum.结束任务, redisManager.TaskEnd);
|
||||||
|
|
||||||
|
|
@ -290,15 +291,7 @@ namespace VideoAnalysisCore.Common
|
||||||
it.LastEnum,
|
it.LastEnum,
|
||||||
it.EndTime
|
it.EndTime
|
||||||
}).ExecuteCommandAsync();
|
}).ExecuteCommandAsync();
|
||||||
try
|
|
||||||
{
|
|
||||||
ExpandFunction.DeleteTaskFile(tId);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
//NewTask();
|
//NewTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,13 +301,14 @@ namespace VideoAnalysisCore.Common
|
||||||
public async void InitChannel()
|
public async void InitChannel()
|
||||||
{
|
{
|
||||||
if (Redis is null) throw new Exception("redis未初始化");
|
if (Redis is null) throw new Exception("redis未初始化");
|
||||||
|
|
||||||
|
|
||||||
//处理之前程序结束前未能执行完的情况
|
//处理之前程序结束前未能执行完的情况
|
||||||
var oldTaskCount = Redis.LLen(RedisExpandKey.IDTask);
|
var oldTaskCount = Redis.LLen(RedisExpandKey.IDTask);
|
||||||
if (oldTaskCount > 0)
|
if (oldTaskCount > 0)
|
||||||
{
|
{
|
||||||
var oldTaskArr = Redis.LRange(RedisExpandKey.IDTask, 0, oldTaskCount);
|
var oldTaskArr = Redis.LRange(RedisExpandKey.IDTask, 0, oldTaskCount);
|
||||||
//不自动清理未完成任务 等待执行完毕/失败后自动清理
|
Redis.LTrim(RedisExpandKey.IDTask, 1, 0);//删除 redis 列表
|
||||||
//Redis.LTrim(RedisExpandKey.IDTask, 1, 0);//删除 redis 列表
|
|
||||||
foreach (var oldTask in oldTaskArr)
|
foreach (var oldTask in oldTaskArr)
|
||||||
{
|
{
|
||||||
_ = Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
|
|
@ -384,7 +378,7 @@ namespace VideoAnalysisCore.Common
|
||||||
Console.WriteLine($"{DateTime.Now} =>服务端不接收任务");
|
Console.WriteLine($"{DateTime.Now} =>服务端不接收任务");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Task.Run(() =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
lock (Redis)
|
lock (Redis)
|
||||||
{
|
{
|
||||||
|
|
@ -402,6 +396,7 @@ namespace VideoAnalysisCore.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -442,9 +437,8 @@ namespace VideoAnalysisCore.Common
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> SetTaskError(long taskID, string? error)
|
public async Task<bool> SetTaskError(long taskID, string? error)
|
||||||
{
|
{
|
||||||
var vDB = AppCommon.Services.GetService<Repository<VideoTask>>();
|
|
||||||
Redis.HMSet(RedisExpandKey.Task(taskID), "ErrorMessage", error);
|
Redis.HMSet(RedisExpandKey.Task(taskID), "ErrorMessage", error);
|
||||||
return await vDB.CopyNew().AsUpdateable()
|
return await videoTaskDB.AsUpdateable()
|
||||||
.SetColumns(it => it.ErrorMessage == error)//SetColumns是可以叠加的 写2个就2个字段赋值
|
.SetColumns(it => it.ErrorMessage == error)//SetColumns是可以叠加的 写2个就2个字段赋值
|
||||||
.Where(it => it.Id == taskID)
|
.Where(it => it.Id == taskID)
|
||||||
.ExecuteCommandAsync() == 1;
|
.ExecuteCommandAsync() == 1;
|
||||||
|
|
@ -470,11 +464,14 @@ namespace VideoAnalysisCore.Common
|
||||||
{
|
{
|
||||||
Redis.HMSet(RedisExpandKey.Task(taskId), "LastEnum", key);
|
Redis.HMSet(RedisExpandKey.Task(taskId), "LastEnum", key);
|
||||||
Redis.HMSet(RedisExpandKey.Task(taskId), "Progress", 0);
|
Redis.HMSet(RedisExpandKey.Task(taskId), "Progress", 0);
|
||||||
var vDB = AppCommon.Services.GetService<Repository<VideoTask>>();
|
lock (Redis)
|
||||||
await vDB.CopyNew().AsUpdateable()
|
{
|
||||||
|
videoTaskDB.AsUpdateable()
|
||||||
.SetColumns(it => it.LastEnum == key)
|
.SetColumns(it => it.LastEnum == key)
|
||||||
.Where(it => it.Id == tID)
|
.Where(it => it.Id == tID)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommand();
|
||||||
|
|
||||||
|
}
|
||||||
await action(taskId);
|
await action(taskId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,8 @@ namespace VideoAnalysisCore.Common
|
||||||
base.Context = CID[t]!=null
|
base.Context = CID[t]!=null
|
||||||
? DbScoped.Sugar.GetConnectionScope(CID[t])
|
? DbScoped.Sugar.GetConnectionScope(CID[t])
|
||||||
: DbScoped.Sugar;
|
: DbScoped.Sugar;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
var c = t.GetCustomAttribute<TenantAttribute>();
|
var c = t.GetCustomAttribute<TenantAttribute>();
|
||||||
if (!CID.ContainsKey(t))
|
if (!CID.ContainsKey(t))
|
||||||
CID.Add(t, c?.configId);
|
CID.Add(t, c?.configId);
|
||||||
|
|
@ -36,8 +35,5 @@ namespace VideoAnalysisCore.Common
|
||||||
? DbScoped.Sugar.GetConnectionScope(c.configId)
|
? DbScoped.Sugar.GetConnectionScope(c.configId)
|
||||||
: DbScoped.Sugar;
|
: DbScoped.Sugar;
|
||||||
}
|
}
|
||||||
//这个变量也要保证是线程安全的,尽量CopyNew在方法中使用
|
|
||||||
base.Context = base.Context.CopyNew();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.32" />
|
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.32" />
|
||||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
|
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
|
||||||
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
|
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
|
||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.205" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
|
||||||
<PackageReference Include="UserCenter.Model" Version="1.3.5" />
|
<PackageReference Include="UserCenter.Model" Version="1.3.5" />
|
||||||
<PackageReference Include="Whisper.net" Version="1.5.0" />
|
<PackageReference Include="Whisper.net" Version="1.5.0" />
|
||||||
<PackageReference Include="Whisper.net.Runtime" Version="1.5.0" />
|
<PackageReference Include="Whisper.net.Runtime" Version="1.5.0" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue