139 lines
4.5 KiB
C#
139 lines
4.5 KiB
C#
using SqlSugar;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Net;
|
|
using System.Text.Json;
|
|
using VideoAnalysisCore.AICore.ChatGPT.Dto;
|
|
using VideoAnalysisCore.AICore.SherpaOnnx;
|
|
using VideoAnalysisCore.AICore.Whisper;
|
|
using VideoAnalysisCore.Enum;
|
|
using Whisper.net;
|
|
|
|
namespace VideoAnalysisCore.Model
|
|
{
|
|
/// <summary>
|
|
/// 视频任务模型
|
|
/// </summary>
|
|
[SugarTable("videotask")]
|
|
public class VideoTask
|
|
{
|
|
/// <summary>
|
|
/// 任务id
|
|
/// <para>视频音频文件地址都使用taskID能获取</para>
|
|
/// </summary>
|
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
|
public long Id { get; set; }
|
|
/// <summary>
|
|
/// 媒体路径
|
|
/// </summary>
|
|
public string MediaUrl { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// 下载后本地媒体目录
|
|
/// </summary>
|
|
public string LocalMediaPath { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// 上一次执行的枚举
|
|
/// </summary>
|
|
public RedisChannelEnum LastEnum { get; set; }
|
|
/// <summary>
|
|
/// ApiKey
|
|
/// </summary>
|
|
public string ApiToken { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// 请求来自哪个ip地址
|
|
/// </summary>
|
|
public string ComeFrom { get; set; } = string.Empty;
|
|
/// <summary>
|
|
/// 自定义值 任务完成后附带通知
|
|
/// </summary>
|
|
[SugarColumn(Length = 500)]
|
|
public string Tag { get; set; }
|
|
/// <summary>
|
|
///回调Api地址
|
|
/// </summary>
|
|
[SugarColumn(Length = 500)]
|
|
public string CallBackUrl { get; set; }
|
|
/// <summary>
|
|
/// 字幕缓存
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "Captions", ColumnDataType = "longtext", IsNullable = true)]
|
|
public string _Captions { get; set; } = "[]";
|
|
/// <summary>
|
|
/// 字幕缓存
|
|
/// </summary>
|
|
[SugarColumn(IsIgnore = true)]
|
|
public SenseVoiceRes[]? Captions
|
|
{
|
|
get=> JsonSerializer.Deserialize<SenseVoiceRes[]>(_Captions ?? "[]");
|
|
set => _Captions = JsonSerializer.Serialize(value);
|
|
}
|
|
/// <summary>
|
|
/// 说话人日志解析缓存
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "Speaker", ColumnDataType = "longtext", IsNullable = true)]
|
|
public string _Speaker { get; set; } = "[]";
|
|
/// <summary>
|
|
/// 说话人日志解析缓存
|
|
/// </summary>
|
|
[SugarColumn(IsIgnore = true)]
|
|
public OfflineSpeakerRes[]? Speaker
|
|
{
|
|
get => JsonSerializer.Deserialize<OfflineSpeakerRes[]>(_Speaker ?? "[]");
|
|
set => _Speaker = JsonSerializer.Serialize(value);
|
|
}
|
|
/// <summary>
|
|
/// Chat模型分析缓存
|
|
/// </summary>
|
|
[SugarColumn(ColumnName = "ChatAnalysis", ColumnDataType = "longtext", IsNullable = true)]
|
|
public string _ChatAnalysis { get; set; } = "{}";
|
|
/// <summary>
|
|
/// Chat模型分析缓存
|
|
/// </summary>
|
|
[SugarColumn(IsIgnore = true)]
|
|
public CallGPTRes? ChatAnalysis
|
|
{
|
|
get => JsonSerializer.Deserialize<CallGPTRes>(_ChatAnalysis ?? "{}");
|
|
set => _ChatAnalysis = JsonSerializer.Serialize(value);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 消耗token
|
|
/// </summary>
|
|
public int TotalTokens { get; set; }
|
|
/// <summary>
|
|
/// 错误信息
|
|
/// </summary>
|
|
[SugarColumn(ColumnDataType = "text", IsNullable = true)]
|
|
public string? ErrorMessage { get; set; }
|
|
/// <summary>
|
|
/// 创建时间
|
|
/// </summary>
|
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
|
/// <summary>
|
|
/// 开始时间轴
|
|
/// </summary>
|
|
[SugarColumn(ColumnDataType = "varchar", Length = 255)]
|
|
public string StartTime { get; set; } ="{}";
|
|
/// <summary>
|
|
/// 开始时间轴
|
|
/// <para>逻辑字段</para>
|
|
/// </summary>
|
|
[SugarColumn(IsIgnore = true)]
|
|
public Dictionary<RedisChannelEnum, DateTime> StartTimeDic
|
|
{
|
|
get
|
|
{
|
|
return JsonSerializer.Deserialize<Dictionary<RedisChannelEnum, DateTime>>(StartTime??"{}")
|
|
??new Dictionary<RedisChannelEnum, DateTime>();
|
|
}
|
|
set
|
|
{
|
|
StartTime = JsonSerializer.Serialize(value);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|