Compare commits

..

No commits in common. "13080a8f63eeb8439a0e7f9a12274345713d2c17" and "8c4ecac24975f50e8eba3320489d84025699fb35" have entirely different histories.

7 changed files with 30 additions and 82 deletions

View File

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

View File

@ -22,11 +22,6 @@
"Token": "" "Token": ""
} }
}, },
"SimpLetex": {
"Host": "https://server.simpletex.cn/api/",
"AppSecret": "05ZbPfCFZgTmfd4uIqHHc9pHgYR2V8bk",
"AppId": "GH2OXwuxSZEH5W28H61bdSzD"
},
"Redis": { "Redis": {
"ConnectionString": "127.0.0.1:6379,password=Woshiren123,defaultDatabase=10" "ConnectionString": "127.0.0.1:6379,password=Woshiren123,defaultDatabase=10"
}, },
@ -65,14 +60,6 @@
"AccessKeySecret": "vRKgmbp1LB05LaGOjh3ZrZxbHSLYLF", "AccessKeySecret": "vRKgmbp1LB05LaGOjh3ZrZxbHSLYLF",
"EndPoint": "vod.cn-shanghai.aliyuncs.com" // "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": [ "OtherDBArr": [
{ {
"ConfigId": 1001, //ResourceBank "ConfigId": 1001, //ResourceBank

View File

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

View File

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

View File

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

View File

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

View File

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