diff --git a/VideoAnalysis/Components/Layouts/BasicLayout.razor b/VideoAnalysis/Components/Layouts/BasicLayout.razor
index 6480dbf..19d247a 100644
--- a/VideoAnalysis/Components/Layouts/BasicLayout.razor
+++ b/VideoAnalysis/Components/Layouts/BasicLayout.razor
@@ -25,7 +25,7 @@
-
+
diff --git a/VideoAnalysis/Components/Pages/EvaluationProject.razor b/VideoAnalysis/Components/Pages/EvaluationProject.razor
index 136336f..7dc918c 100644
--- a/VideoAnalysis/Components/Pages/EvaluationProject.razor
+++ b/VideoAnalysis/Components/Pages/EvaluationProject.razor
@@ -4,74 +4,85 @@
@using System.ComponentModel.DataAnnotations
@using SqlSugar
@using VideoAnalysisCore.Model
+@using UserCenter.Model.Enum
-
+
-
- @* *@
+
-
- StartEdit(row)">修改
-
-
-
+
+
+
+
-@inject ModalService ModalService
+@{
+ RenderFragment modelfooter = @
+
+
+ ;
+}
+
+
+
+
@code
{
- ///
- /// 新增或者修改
- ///
- ///
- void StartEdit(CourseGradingCriteria row)
- {
- var data = row == null ? new() : row;
- IForm? form = default;
- ModalRef modalRef = default;
- modalRef = ModalService.CreateModal(new()
- {
- Title = data.Id > 0 ? "修改" : "新增",
- Content =
- @
- ,
- OkText = "确定",
- CancelText = "取消",
- OnOk = async (e) =>
- {
- if (!form.Validate())
- return;
- // save db and refresh
- modalRef.SetConfirmLoading(true);
-
- if (data.Id > 0)
- await criteria.UpdateAsync(data);
- else
- data.Id = await criteria.InsertReturnBigIdentityAsync(data);
- //弹窗按钮 show
- modalRef.SetConfirmLoading(false);
-
- await modalRef.CloseAsync();
- _table.ReloadData();
- StateHasChanged();
- },
- OnCancel = async (e) =>
- {
- if (form.IsModified && (!await Comfirm("表格已经更新,您确定要退出吗?")))
- return;
- await modalRef.CloseAsync();
- }
- });
- }
+
}
\ No newline at end of file
diff --git a/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs b/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs
index bde5e2f..5fb6818 100644
--- a/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs
+++ b/VideoAnalysis/Components/Pages/EvaluationProject.razor.cs
@@ -1,27 +1,111 @@
-using AntDesign.TableModels;
+using AntDesign;
+using AntDesign.TableModels;
+using FreeRedis;
+using Learn.VideoAnalysis.Controllers.Dto;
using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Components.Web;
using SqlSugar;
+using System.Drawing;
using System.Linq.Expressions;
+using System.Reflection;
+using UserCenter.Model;
+using UserCenter.Model.Enum;
using VideoAnalysisCore.Common;
+using VideoAnalysisCore.Enum;
using VideoAnalysisCore.Model;
+
namespace Learn.VideoAnalysis.Components.Pages
{
public partial class EvaluationProject : ComponentBase
{
[Inject] private ConfirmService ComfirmService { get; set; } = default!;
+ [Inject] private ModalService ModalService { get; set; } = default!;
[Inject] private Repository criteria { get; set; } = default!;
+ [Inject] private INotificationService _notice { get; set; } = default!;
IEnumerable _selectedRows = [];
ITable _table;
+ IForm? form;
List _dataSource = null;
RefAsync _total = 0;
bool tableLoading = false;
+ Table tableRef;
+ List _editSource = null;
+
+ bool modalShow =false;
+ bool modalBtnLoading = false;
+ CourseGradingCriteria rowData;
+ SubjectEnum editSubject;
+
+ async void SubjectEnumSelect()
+ {
+ _editSource = await criteria.GetListAsync(x => x.Subject.Value == editSubject);
+ await this.InvokeAsync(StateHasChanged);
+ }
+ void EditAddRow()
+ {
+ if (form is not null && form.Validate())
+ {
+ var data = rowData;
+ data.Subject = editSubject;
+ if (_editSource is null)
+ _editSource = new() { data };
+ else
+ _editSource.Add(data);
+ rowData = new();
+ StateHasChanged();
+ }
+ }
+ ///
+ /// 新增或者修改
+ ///
+ void StartEdit()
+ {
+ rowData = new();
+ modalShow = true;
+ }
+
+ async Task EditOnOkAsync()
+ {
+ var data = rowData;
+ modalBtnLoading = true;
+ if (_editSource is null || _editSource.Count == 0)
+ {
+ await _notice.Open(new NotificationConfig()
+ {
+ Message = "提示",
+ Description = "无效的学科课堂指标数据",
+ NotificationType = NotificationType.Warning
+ });
+ modalBtnLoading = false;
+ return;
+ }
+ if (_editSource.Sum(x => x.TotalScore) != 100)
+ {
+ await _notice.Open(new NotificationConfig()
+ {
+ Message = "提示",
+ Description = "课堂指标 总分不满100!请完善",
+ NotificationType = NotificationType.Warning
+ });
+ modalBtnLoading = false;
+ return;
+ }
+ await criteria.DeleteAsync(s => s.Subject == editSubject);
+ await criteria.InsertRangeAsync(_editSource);
+
+ _table.ReloadData();
+ modalShow = false;
+ modalBtnLoading = false;
+ StateHasChanged();
+
+ }
///
/// 分页 查询 筛选 时
///
@@ -37,8 +121,8 @@ namespace Learn.VideoAnalysis.Components.Pages
_dataSource = await criteria.AsQueryable()
.Where(where)
.ToPageListAsync(query.PageIndex, query.PageSize, _total);
- tableLoading = false;
- StateHasChanged();
+ tableLoading = false;
+ StateHasChanged();
}
///
diff --git a/VideoAnalysis/Components/Pages/EvaluationProject.razor.css b/VideoAnalysis/Components/Pages/EvaluationProject.razor.css
index aca1ed1..a36c3a8 100644
--- a/VideoAnalysis/Components/Pages/EvaluationProject.razor.css
+++ b/VideoAnalysis/Components/Pages/EvaluationProject.razor.css
@@ -1,3 +1,9 @@
input[aria-hidden="true"] {
display: none !important;
}
+.displayNone {
+ display:none !important;
+}
+.ant-table-pagination {
+ display:none !important;
+}
diff --git a/VideoAnalysis/Components/Pages/VideoTaskPage.razor b/VideoAnalysis/Components/Pages/VideoTaskPage.razor
index c1c7380..0376d28 100644
--- a/VideoAnalysis/Components/Pages/VideoTaskPage.razor
+++ b/VideoAnalysis/Components/Pages/VideoTaskPage.razor
@@ -22,6 +22,7 @@
+
diff --git a/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs b/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs
index 67daad1..1b0f224 100644
--- a/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs
+++ b/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs
@@ -87,7 +87,6 @@ namespace Learn.VideoAnalysis.Components.Pages
/// 分页 查询 筛选 时
///
///
- ///
async void OnChange(QueryModel query)
{
lastQuery = query;
diff --git a/VideoAnalysis/Components/_Imports.razor b/VideoAnalysis/Components/_Imports.razor
index 83cab43..9c8c407 100644
--- a/VideoAnalysis/Components/_Imports.razor
+++ b/VideoAnalysis/Components/_Imports.razor
@@ -7,7 +7,6 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using AntDesign
-@using AntDesign.Charts
@using AntDesign.ProLayout
@using AntDesign.Extensions.Localization
diff --git a/VideoAnalysis/Controllers/ApiController.cs b/VideoAnalysis/Controllers/ApiController.cs
index 10c246e..cd6682e 100644
--- a/VideoAnalysis/Controllers/ApiController.cs
+++ b/VideoAnalysis/Controllers/ApiController.cs
@@ -108,6 +108,26 @@ namespace Learn.VideoAnalysis.Controllers
return mergedList;
}
+ ///
+ /// ¿ʼִGPTtaskId/tagIdѡһ
+ ///
+ ///
+ /// Զid
+ ///
+ [HttpGet(Name = "ReStart")]
+ public async Task ReStart(long taskId, string? tagId)
+ {
+ var task = await videoTaskDB.AsQueryable()
+ .WhereIF(taskId != 0, s => s.Id == taskId)
+ .WhereIF(!string.IsNullOrEmpty(tagId), s => s.TagId == tagId)
+ .FirstAsync();
+ if (task is null)
+ return BadRequest("δҵӦ");
+ //¿ʼִGPT
+ RedisExpand.InsertChannel(RedisChannelEnum.ChatModelAnalysis
+ , task.Id);
+ return Ok();
+ }
///
/// ȡƵϢtaskId/tagIdѡһ
///
@@ -165,6 +185,8 @@ namespace Learn.VideoAnalysis.Controllers
ComeFrom = GetClientIpAddress(),
MediaUrl = req.MediaUrl,
ApiToken = req.ApiToken,
+ Type = req.Type,
+ Subject = req.Subject,
Tag = req.Tag,
TagId = req.TagId,
};
diff --git a/VideoAnalysis/Controllers/Dto/ApiDto.cs b/VideoAnalysis/Controllers/Dto/ApiDto.cs
index cd40a88..9b892ec 100644
--- a/VideoAnalysis/Controllers/Dto/ApiDto.cs
+++ b/VideoAnalysis/Controllers/Dto/ApiDto.cs
@@ -1,5 +1,6 @@
using AntDesign;
using System.ComponentModel.DataAnnotations;
+using UserCenter.Model.Enum;
using VideoAnalysisCore.AICore.ChatGPT.Dto;
using VideoAnalysisCore.Enum;
@@ -22,6 +23,14 @@ namespace Learn.VideoAnalysis.Controllers.Dto
[Required(ErrorMessage = "接口Token是必填项")]
public string ApiToken { get; set; } = string.Empty;
///
+ /// 内容所属学科
+ ///
+ public SubjectEnum? Subject { get; set; }
+ ///
+ /// 任务类型
+ ///
+ public TaskTypeEnum? Type { get; set; }
+ ///
/// 自定义值 任务完成后附带通知
///
public string Tag { get; set; } = string.Empty;
@@ -36,7 +45,6 @@ namespace Learn.VideoAnalysis.Controllers.Dto
//[Url(ErrorMessage = "请输入有效的 URL")]
//public string CallBackUrl { get; set; } = string.Empty;
-
}
public class TextValue
{
diff --git a/VideoAnalysis/GlobalUsings.cs b/VideoAnalysis/GlobalUsings.cs
index a967599..a84ae82 100644
--- a/VideoAnalysis/GlobalUsings.cs
+++ b/VideoAnalysis/GlobalUsings.cs
@@ -1,2 +1,7 @@
global using VideoAnalysisRazor.Resources;
-global using AntDesign;
\ No newline at end of file
+global using AntDesign;
+
+global using VideoAnalysisCore.Model;
+global using VideoAnalysisCore.Model.Dto;
+global using VideoAnalysisCore.Enum;
+global using Learn.VideoAnalysis.Controllers.Dto;
\ No newline at end of file
diff --git a/VideoAnalysis/Learn.VideoAnalysis.csproj b/VideoAnalysis/Learn.VideoAnalysis.csproj
index 0de88a6..4355645 100644
--- a/VideoAnalysis/Learn.VideoAnalysis.csproj
+++ b/VideoAnalysis/Learn.VideoAnalysis.csproj
@@ -30,10 +30,6 @@
-
-
-
-
diff --git a/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs b/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs
index daf953d..a079e1d 100644
--- a/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs
+++ b/VideoAnalysisCore/AICore/ChatGPT/Dto/QuestionRes.cs
@@ -69,7 +69,15 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto
///
/// AI评估得分
///
- public int Score { get; set; }
+ public decimal Score { get; set; }
+ ///
+ /// 总分
+ ///
+ public decimal TotalScore { get; set; }
+ ///
+ /// 及格分数
+ ///
+ public decimal PassScore { get; set; }
///
/// 提词
///
diff --git a/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs b/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs
index fb609be..0ad2985 100644
--- a/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs
+++ b/VideoAnalysisCore/AICore/ChatGPT/KIMI/KIMI_GPT.cs
@@ -48,15 +48,25 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
///
public async Task CallGPT(string task)
{
+ var taskId = long.Parse(task);
+ var taskInfo = await videoTaskDB.AsQueryable()
+ .Where(s=>s.Id == taskId)
+ .FirstAsync();
var captions = ExpandFunction.GetSpeakerCaptions(task);
- var criteriaArr = await criteriaDB.GetListAsync();
+ var criteriaArr = await criteriaDB.GetListAsync(s=>s.Subject == taskInfo.Subject);
var criteriaBuilder = new StringBuilder();
foreach (var item in criteriaArr)
{
criteriaBuilder.Append(item.Id);
criteriaBuilder.Append(":");
criteriaBuilder.Append(item.NamePrompt);
- criteriaBuilder.Append("? 请基于解释打分(0-10分 6分为及格) 结果类型 array=[得分,简明的提问的回答,对于问题的详细改进意见,详细的列举出主要扣分原因] |");
+ criteriaBuilder.Append("? 请基于解释精确打分");
+ criteriaBuilder.Append("0-");
+ criteriaBuilder.Append((int)(item.TotalScore * 10));
+ criteriaBuilder.Append("分");
+ criteriaBuilder.Append((int)(item.PassScore * 10));
+ criteriaBuilder.Append("分为及格.");
+ criteriaBuilder.Append("结果类型 array=[得分,问题详细回答,详细的改进意见,详细的扣分原因] |");
}
//拼接枚举提问
@@ -106,16 +116,17 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
throw new Exception($"KIMI模型返回异常 Chat 返回参数: " +
$" {JsonSerializer.Serialize(chatResp)}");
var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content;
- chatResContent = chatResContent?.Replace("字幕内容", "课堂");
+ chatResContent = chatResContent?.Replace("字幕内容", "课堂情况");
if (chatResContent is null)
throw new Exception("KIMIGPT返回message无效结果");
var questionRes = JsonSerializer.Deserialize(chatResContent);
var gptRes = new TaskRes(captions);
if (questionRes is null)
throw new Exception("KIMIGPT返回无效结果");
+ var qEnum = (int)QuestionTypeEnum.高频词;
//处理 ai问答提问
- var arr1 = questionRes.Where(s => s.问题编号 < 100);
- var arr2 = questionRes.Where(s => s.问题编号 >= 100)
+ var arr1 = questionRes.Where(s => s.问题编号 < qEnum);
+ var arr2 = questionRes.Where(s => s.问题编号 >= qEnum)
.ToDictionary(s => s.问题编号);
//AI综合评估
var criteriaDic = criteriaArr.ToDictionary(s => s.Id);
@@ -123,16 +134,17 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
var ccArr = arr1.Select(s => new CourseCriteria()
{
Id = criteriaDic[s.问题编号].Id,
- Score = int.Parse(s.ToObject