优化 重新开始任务 允许修改学科
This commit is contained in:
parent
559c7fba21
commit
4d146d718b
|
|
@ -17,6 +17,7 @@ using VideoAnalysisCore.AICore.SherpaOnnx;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Security.Policy;
|
using System.Security.Policy;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using UserCenter.Model.Enum;
|
||||||
|
|
||||||
namespace Learn.VideoAnalysis.Controllers
|
namespace Learn.VideoAnalysis.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -113,9 +114,10 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="taskId"></param>
|
/// <param name="taskId"></param>
|
||||||
/// <param name="tagId">自定义id</param>
|
/// <param name="tagId">自定义id</param>
|
||||||
|
/// <param name="subject">切换任务所属学科 null忽略</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet(Name = "ReStart")]
|
[HttpGet(Name = "ReStart")]
|
||||||
public async Task<IActionResult> ReStart(long taskId, string? tagId)
|
public async Task<IActionResult> ReStart(long taskId, string? tagId, SubjectEnum? subject)
|
||||||
{
|
{
|
||||||
var task = await videoTaskDB.AsQueryable()
|
var task = await videoTaskDB.AsQueryable()
|
||||||
.WhereIF(taskId != 0, s => s.Id == taskId)
|
.WhereIF(taskId != 0, s => s.Id == taskId)
|
||||||
|
|
@ -123,6 +125,11 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
if (task is null)
|
if (task is null)
|
||||||
return BadRequest("未能找到对应任务");
|
return BadRequest("未能找到对应任务");
|
||||||
|
if (subject is not null)
|
||||||
|
{
|
||||||
|
task.Subject = subject;
|
||||||
|
await videoTaskDB.UpdateAsync(task);
|
||||||
|
}
|
||||||
//重新开始执行GPT分析
|
//重新开始执行GPT分析
|
||||||
RedisExpand.InsertChannel(RedisChannelEnum.ChatModelAnalysis
|
RedisExpand.InsertChannel(RedisChannelEnum.ChatModelAnalysis
|
||||||
, task.Id);
|
, task.Id);
|
||||||
|
|
@ -137,6 +144,8 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
[HttpGet(Name = "TaskInfo")]
|
[HttpGet(Name = "TaskInfo")]
|
||||||
public async Task<IActionResult> TaskInfo(long taskId,string? tagId)
|
public async Task<IActionResult> TaskInfo(long taskId,string? tagId)
|
||||||
{
|
{
|
||||||
|
if(taskId == 0 && string.IsNullOrEmpty(tagId))
|
||||||
|
return BadRequest();
|
||||||
var task = await videoTaskDB.AsQueryable()
|
var task = await videoTaskDB.AsQueryable()
|
||||||
.WhereIF(taskId!=0, s => s.Id == taskId)
|
.WhereIF(taskId!=0, s => s.Id == taskId)
|
||||||
.WhereIF(!string.IsNullOrEmpty(tagId), s => s.TagId == tagId)
|
.WhereIF(!string.IsNullOrEmpty(tagId), s => s.TagId == tagId)
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,10 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto
|
||||||
/// <para>满分100</para>
|
/// <para>满分100</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float AssessmentScore =>
|
public float AssessmentScore =>
|
||||||
(float)Math.Round((Assessment?.Bad?.Select(x => x.Score)
|
(float)(Assessment?.Bad?.Sum(x => x.Score)??0 +
|
||||||
.Concat(Assessment?.Merit?.Select(s => s.Score) ?? [])
|
Assessment?.Merit?.Sum(x => x.Score) ?? 0);
|
||||||
.Average() ?? 0) * 10,2);
|
//(float)Math.Round((Assessment?.Bad?.Select(x => x.Score)
|
||||||
|
//.Concat(Assessment?.Merit?.Select(s => s.Score) ?? [])
|
||||||
|
//.Average() ?? 0) * 10,2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue