Compare commits

...

5 Commits

7 changed files with 82 additions and 30 deletions

View File

@ -48,12 +48,11 @@ namespace Learn.VideoAnalysis.API
var app = builder.Build();
AppCommon.Services = app.Services;
app.UseMiddleware<BasicAuthMiddleware>("Swagger");
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();

View File

@ -22,6 +22,11 @@
"Token": ""
}
},
"SimpLetex": {
"Host": "https://server.simpletex.cn/api/",
"AppSecret": "05ZbPfCFZgTmfd4uIqHHc9pHgYR2V8bk",
"AppId": "GH2OXwuxSZEH5W28H61bdSzD"
},
"Redis": {
"ConnectionString": "127.0.0.1:6379,password=Woshiren123,defaultDatabase=10"
},
@ -60,6 +65,14 @@
"AccessKeySecret": "vRKgmbp1LB05LaGOjh3ZrZxbHSLYLF",
"EndPoint": "vod.cn-shanghai.aliyuncs.com" //
},
"AliyunOSS": {
"AccessKeyId": "LTAI5tDC6p9h747B7FHbgwkH",
"AccessKeySecret": "vRKgmbp1LB05LaGOjh3ZrZxbHSLYLF",
"BucketDomain": "https://learn-videoanalysis.oss-cn-chengdu.aliyuncs.com",
"Region": "cn-chengdu",
"BucketName": "learn-videoanalysis",
"EndPoint": "oss-cn-chengdu.aliyuncs.com" //
},
"OtherDBArr": [
{
"ConfigId": 1001, //ResourceBank

View File

@ -118,12 +118,11 @@ namespace Learn.VideoAnalysis
app.UseMiddleware<BasicAuthMiddleware>("Swagger");
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
app.UseExceptionHandler("/Error");
}
//Ìí¼Ówwwroot ¾²Ì¬Ä¿Â¼
app.UseStaticFiles();
//Ìí¼Ó ×Ô¶¨Òå ¾²Ì¬Ä¿Â¼

View File

@ -197,7 +197,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
var totalCount = captionsArr.Length / spanCount + 1;
await Parallel.ForAsync(0, totalCount,
new ParallelOptions() { MaxDegreeOfParallelism = 10 },
new ParallelOptions() { MaxDegreeOfParallelism = 20 },
async (s, c) =>
{
while (true)
@ -285,6 +285,9 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
$"字幕列表 {captions.Captions} 字幕结束!";
break;
case AttachmentsInfoType.:
postMessages =
$"请通过视频字幕内容分析出视频中课堂的授课阶段。" +
$"课堂内容与{taskInfo.Subject}学科下的{sections}章节相关。" +
@ -319,7 +322,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
}
/// <summary>
///
/// 请求AI
/// </summary>
/// <typeparam name="T">返回JSON类型</typeparam>
/// <param name="task">任务id</param>

View File

@ -184,7 +184,7 @@ namespace VideoAnalysisCore.Common
}
catch (Exception ex)
{
await SetTaskErrorMessage((long)taskId, ex);
await SetTaskErrorMessage(long.Parse(tId), ex);
}
}

View File

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations;
using UserCenter.Model.Enum;
using VideoAnalysisCore.AICore.GPT.Dto;
using VideoAnalysisCore.Model.Dto;
using VideoAnalysisCore.Model.Enum;
namespace VideoAnalysisCore.Controllers.Dto
@ -228,6 +229,10 @@ namespace VideoAnalysisCore.Controllers.Dto
public class TaskKnowBlock
{
public long Id { get; set; }
/// <summary>
/// 阶段id
/// </summary>
public long StageId { get; set; }
/// <summary>
/// 开始时间
@ -254,6 +259,11 @@ namespace VideoAnalysisCore.Controllers.Dto
/// 知识点列表
/// </summary>
public TaskKnowInfo[] Know { get; set; }
/// <summary>
/// 片段内的试题
/// </summary>
public virtual VideoQuestionShowDto[]? QuestionArr { get; set; }
}
/// <summary>
/// 视频片段知识点结果
@ -274,7 +284,7 @@ namespace VideoAnalysisCore.Controllers.Dto
/// </summary>
public long VideoTaskId { get; set; }
/// <summary>
/// 视频知识快
/// 视频片段
/// </summary>
public TaskKnowBlock[] KnowBlockArr { get; set; }

View File

@ -18,6 +18,7 @@ using Yitter.IdGenerator;
using VideoAnalysisCore.AICore.GPT.Dto;
using VideoAnalysisCore.Model;
using VideoAnalysisCore.Controllers.Dto;
using VideoAnalysisCore.Model.Dto;
namespace VideoAnalysisCore.Controllers
{
@ -33,15 +34,20 @@ namespace VideoAnalysisCore.Controllers
private readonly Repository<VideoTask> videoTaskDB;
private readonly Repository<VideoKonwPoint> videoKonwPointDB;
private readonly Repository<NodePackageInfo> nodePackageInfoDB;
public LJZK_Controller( IMapper mp, Repository<NodeSubscription> nodesubscriptionDB,
private readonly Repository<VideoQuestion> videoQuestionDB;
private readonly Repository<VideoQuestionKonw> videoQuestionKonwDB;
public LJZK_Controller(IMapper mp, Repository<NodeSubscription> nodesubscriptionDB,
Repository<VideoTask> videoTaskDB = null, Repository<VideoKonwPoint> videoKonwPointDB = null
, Repository<NodePackageInfo> nodePackageInfoDB = null)
, Repository<NodePackageInfo> nodePackageInfoDB = null, Repository<VideoQuestion> videoQuestionDB = null, Repository<VideoQuestionKonw> videoQuestionKonwDB = null)
{
this.mp = mp;
this.nodesubscriptionDB = nodesubscriptionDB;
this.videoTaskDB = videoTaskDB;
this.videoKonwPointDB = videoKonwPointDB;
this.nodePackageInfoDB = nodePackageInfoDB;
this.videoQuestionDB = videoQuestionDB;
this.videoQuestionKonwDB = videoQuestionKonwDB;
}
@ -60,10 +66,12 @@ namespace VideoAnalysisCore.Controllers
var videos = new List<VideoTask>(reqArr.Count());
var nodePackages = new List<NodePackageInfo>(reqArr.Count());
var videoIdArr = videoTaskDB.AsQueryable().Select(v => v.TagId).Distinct().ToArray();
foreach (var sGroup in reqArr.GroupBy(s=>s.ContentId))
foreach (var sGroup in reqArr.GroupBy(s => s.ContentId))
{
var s= sGroup.First(s=>s.VideoType==VideoType.ÉãÏñÍ·);
var sPPT= sGroup.FirstOrDefault(s=>s.VideoType==VideoType.PPT¿Î¼þ);
var s = sGroup.FirstOrDefault(s => s.VideoType == VideoType.);
if (s is null)
return BadRequest("无有效的老师授课视频");
var sPPT = sGroup.FirstOrDefault(s => s.VideoType == VideoType.PPT课件);
var np = new NodePackageInfo()
{
VideoCode = s.VideoCode,
@ -72,16 +80,16 @@ namespace VideoAnalysisCore.Controllers
Stage = s.StageId,
CourseId = s.CourseId,
SubjectType = s.SubjectId,
VideoUrl =s.VideoUrl,
VideoUrl = s.VideoUrl,
CourseType = s.CourseType,
CallBackUrl=s.CallBackUrl,
CallBackUrl = s.CallBackUrl,
Area = s.Area,
HostIP = s.HostIP,
};
nodePackages.Add(np);
if (videoIdArr.Contains(s.VideoCode))
continue;
var pptCode = sPPT!=null ? sPPT.VideoCode : string.Empty;
var pptCode = sPPT != null ? sPPT.VideoCode : string.Empty;
videos.Add(new VideoTask()
{
Id = YitIdHelper.NextId(),
@ -91,9 +99,9 @@ namespace VideoAnalysisCore.Controllers
CourseId = s.CourseId,
Subject = s.SubjectId,
TagId = s.VideoCode,
MediaUrl =s.VideoUrl,
MediaUrl = s.VideoUrl,
PPTVideoCode = pptCode,
VideoType =s.CourseType
VideoType = s.CourseType
});
}
await nodePackageInfoDB.InsertRangeAsync(nodePackages);
@ -126,6 +134,7 @@ namespace VideoAnalysisCore.Controllers
return Ok(Enum.GetValues(type).Cast<object>()
.Select(s => new { Text = s.ToString(), Value = (int)s }));
}
/// <summary>
/// 获取学科类型
/// </summary>
@ -146,12 +155,12 @@ namespace VideoAnalysisCore.Controllers
[HttpGet(Name = "TaskKnowInfo")]
public async Task<IActionResult> TaskKnowInfo(string? tagId)
{
if ( string.IsNullOrEmpty(tagId))
if (string.IsNullOrEmpty(tagId))
return BadRequest();
long taskId = 0;
var taskIdOK = long.TryParse(tagId,out taskId);
var taskIdOK = long.TryParse(tagId, out taskId);
var task = await videoTaskDB.AsQueryable()
.Where(s=> s.TagId == tagId || s.PPTVideoCode== tagId || (taskIdOK&& s.Id == taskId))
.Where(s => s.TagId == tagId || s.PPTVideoCode == tagId || (taskIdOK && s.Id == taskId))
.FirstAsync();
if (task is null)
return BadRequest("无效任务");
@ -161,7 +170,7 @@ namespace VideoAnalysisCore.Controllers
.ToArrayAsync();
if (konwArr is null || konwArr.Length == 0)
return BadRequest("无效任务");
return Ok(new TaskKnowRes()
var res = new TaskKnowRes()
{
TagId = task.TagId,
Status = task.LastEnum,
@ -173,6 +182,7 @@ namespace VideoAnalysisCore.Controllers
Id = s.First().Id,
Content = s.First().Content,
StartTime = s.First().StartTime,
StageId = s.First().StageId,
EndTime = s.First().EndTime,
Theme = s.First().Theme,
Know = s.Select(x => new TaskKnowInfo()
@ -182,7 +192,25 @@ namespace VideoAnalysisCore.Controllers
KnowPointId = x.KnowPointId
}).ToArray()
}).ToArray()
});
};
if (task.VideoType == AttachmentsInfoType.)
{
var questionArr = await videoQuestionDB
.AsQueryable().Where(s => s.VideoTaskId == task.Id)
.Select<VideoQuestionShowDto>()
.ToArrayAsync();
var konwDic = (await videoQuestionKonwDB
.AsQueryable().Where(s => s.VideoTaskId == task.Id)
.ToArrayAsync()).GroupBy(s => s.VideoQuestionId)
.ToDictionary(s => s.Key);
foreach (var item in questionArr.Where(s => konwDic.ContainsKey(s.Id)))
item.KonwArr = konwDic[item.Id].ToArray();
foreach (var item in res.KnowBlockArr)
item.QuestionArr = questionArr
.Where(s => s.StageId == item.StageId).ToArray();
}
return Ok(res);
}