新增 设备id字段
This commit is contained in:
parent
407e93c208
commit
43599fea1d
|
|
@ -29,10 +29,10 @@ namespace Learn.VideoAnalysis.Expand
|
|||
provider.ApplicationServices.UseScheduler(scheduler =>
|
||||
{
|
||||
//任务缓存清理
|
||||
// scheduler.Schedule<TaskFileClearJob>().HourlyAt(10);
|
||||
scheduler.Schedule<ClearAllCacheJob>().HourlyAt(10);
|
||||
//强制清理所有缓存内容
|
||||
//scheduler.Schedule<ClearAllCacheJob>().Hourly();
|
||||
scheduler.Schedule<ClearAllCacheJob>().EverySeconds(40);
|
||||
//scheduler.Schedule<ClearAllCacheJob>().EverySeconds(40);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ namespace VideoAnalysisCore.AICore.GPT
|
|||
}
|
||||
goto PostJsonStream;
|
||||
}
|
||||
using var stream = chatResp.Content.ReadAsStream();
|
||||
using var stream = await chatResp.Content.ReadAsStreamAsync();
|
||||
using var reader = new StreamReader(stream, Encoding.UTF8);
|
||||
string line;
|
||||
string? line;
|
||||
var messageBuilder = new StringBuilder();
|
||||
var messageBuilder1 = new StringBuilder();
|
||||
var lastChat = new ChatResSSE();
|
||||
|
|
@ -94,13 +94,23 @@ namespace VideoAnalysisCore.AICore.GPT
|
|||
//最长分析分析时间1.5小时 或者重试读取 1w次
|
||||
while (maxLoop > 0 && DateTime.Now < endTime)
|
||||
{
|
||||
line = reader.ReadLine();
|
||||
if (line is null || string.IsNullOrEmpty(line) || line.StartsWith(": keep-alive"))
|
||||
try
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
using var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
|
||||
line = await reader.ReadLineAsync(cts.Token);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
await redisManager.AddTaskLog(chatReq.taskId, "==>流式响应超时(3分钟),尝试重新读取...");
|
||||
maxLoop--;
|
||||
continue;
|
||||
}
|
||||
if (line is null || string.IsNullOrWhiteSpace(line) || line.StartsWith(": keep-alive"))
|
||||
{
|
||||
await Task.Delay(50);
|
||||
maxLoop--;
|
||||
continue;
|
||||
}
|
||||
else if (line.EndsWith("[DONE]"))
|
||||
{
|
||||
// 表示一条消息结束
|
||||
|
|
|
|||
|
|
@ -236,7 +236,8 @@ namespace VideoAnalysisCore.Common
|
|||
{
|
||||
VideoTaskId = long.Parse(taskId.ToString()),
|
||||
CreateTime = DateTime.Now,
|
||||
Message = msg
|
||||
Message = msg,
|
||||
DeviceId = AppCommon.Config.ID
|
||||
});
|
||||
var count = 50;
|
||||
lock (RedisExpandKey.TaskLog)
|
||||
|
|
|
|||
|
|
@ -35,5 +35,10 @@ namespace VideoAnalysisCore.Model
|
|||
/// </summary>
|
||||
[SugarColumn(ColumnDataType ="text",IsNullable = true)]
|
||||
public string? Message { get; set; }
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int? DeviceId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue