优化 课堂指标

This commit is contained in:
小肥羊 2024-12-04 09:57:14 +08:00
parent 01af735d62
commit 3b12e463fd
21 changed files with 313 additions and 111 deletions

View File

@ -25,7 +25,7 @@
<RightContentRender> <RightContentRender>
</RightContentRender> </RightContentRender>
<ChildContent> <ChildContent>
<ReuseTabs></ReuseTabs> <ReuseTabs ></ReuseTabs>
</ChildContent> </ChildContent>
<FooterRender> <FooterRender>
<FooterView Copyright="2024 重庆远轩教育科技有限公司" Links="new LinkItem[0]"></FooterView> <FooterView Copyright="2024 重庆远轩教育科技有限公司" Links="new LinkItem[0]"></FooterView>

View File

@ -4,74 +4,85 @@
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@using SqlSugar @using SqlSugar
@using VideoAnalysisCore.Model @using VideoAnalysisCore.Model
@using UserCenter.Model.Enum
<Table @ref="_table" Loading="tableLoading" TItem="CourseGradingCriteria" ScrollY="600px" PageSize="15" Total="_total" DataSource="_dataSource" @bind-SelectedRows="_selectedRows" OnChange="OnChange"> <Table @ref="_table" Loading="tableLoading" TItem="CourseGradingCriteria" ScrollY="600px"
PageSize="20" Total="_total" DataSource="_dataSource" @bind-SelectedRows="_selectedRows" OnChange="OnChange">
<TitleTemplate> <TitleTemplate>
<Flex Justify="end" Gap="10"> <Flex Justify="end" Gap="10">
<Button Type="primary" @onclick="()=> StartEdit(default)">新增</Button> <Button Type="primary" @onclick="()=> StartEdit()">编辑</Button>
@* <Button Disabled="!_selectedRows.Any()" Danger @onclick="DeleteAll">Delete</Button> *@
</Flex> </Flex>
</TitleTemplate> </TitleTemplate>
<ColumnDefinitions Context="row"> <ColumnDefinitions Context="row">
<ActionColumn Title="操作列" Width ="230px">
<a @onclick="() => StartEdit(row)">修改</a>
<Button Type="@ButtonType.Link" Danger @onclick="() => Delete(row)">
删除</Button>
</ActionColumn>
<PropertyColumn Property="c=>c.Id" Width="130px" Filterable="true" Sortable="true" /> <PropertyColumn Property="c=>c.Id" Width="130px" Filterable="true" Sortable="true" />
<PropertyColumn Property="c=>c.Subject" Filterable="true" Width="130px" />
<PropertyColumn Property="c=>c.TotalScore" Width="130px" />
<PropertyColumn Property="c=>c.PassScore" Width="130px" />
<PropertyColumn Property="c=>c.NamePrompt" /> <PropertyColumn Property="c=>c.NamePrompt" />
</ColumnDefinitions> </ColumnDefinitions>
</Table> </Table>
@inject ModalService ModalService @{
RenderFragment modelfooter = @<Template>
<Button OnClick="@EditOnOkAsync" @key="@( "submit" )"
Type="primary"
Loading="@modalBtnLoading">
提交
</Button>
<Button OnClick="()=>modalShow = false" @key="@( "back" )">取消</Button>
</Template>;
}
<Modal Title="@("编辑学科课堂指标")" Visible="modalShow" Width="650"
Footer="@modelfooter">
<Form @ref="form" Model="rowData" LabelAlign="AntLabelAlignType.Left">
<GridRow>
<GridCol Span="24">
<FormItem Label="学科指标">
<div style="display:flex;">
<EnumSelect TEnum="SubjectEnum" @bind-Value="editSubject" AllowClear />
<Button OnClick="SubjectEnumSelect" Type="primary" Icon="@IconType.Outline.Search">
查询
</Button>
</div>
</FormItem>
</GridCol>
<GridCol Span="12">
<FormItem Label="满分分值">
<AntDesign.InputNumber Precision="1" @bind-Value="context.TotalScore" Min="1" Max="100" DefaultValue="10" PlaceHolder="满分分值" />
</FormItem>
</GridCol>
<GridCol Span="12">
<FormItem Label="及格分值">
<AntDesign.InputNumber Precision="1" @bind-Value="context.PassScore" Min="1" Max="@context.TotalScore"
DefaultValue="6" PlaceHolder="及格分值" />
</FormItem>
</GridCol>
<GridCol Span="24">
<FormItem Label="标准提问词">
<TextArea Rows="2" @bind-Value="@context.NamePrompt" />
</FormItem>
</GridCol>
<GridCol Span="24">
<FormItem Label="学科提示词" Rules="[new(){ Min=1 }]">
<Button OnClick="EditAddRow" Type="primary" Style="margin-bottom:16px" Size="small">
添加
</Button>
<Table PaginationPosition="none" @ref="tableRef" ScrollY="350px" PageSize="20"DataSource="_editSource" TItem="CourseGradingCriteria" Context="row" Size="TableSize.Small">
<ActionColumn Width="80px">
<Button Type="@ButtonType.Text" Danger @onclick="() => _editSource.Remove(row)">删除</Button>
</ActionColumn>
<PropertyColumn Width="50px" Property="c=>c.TotalScore" />
<PropertyColumn Width="50px" Property="c=>c.PassScore" />
<PropertyColumn Property="c=>c.NamePrompt" />
</Table>
</FormItem>
</GridCol>
</GridRow>
</Form>
</Modal>
@code @code
{ {
/// <summary>
/// 新增或者修改
/// </summary>
/// <param name="row"></param>
void StartEdit(CourseGradingCriteria row)
{
var data = row == null ? new() : row;
IForm? form = default;
ModalRef<bool> modalRef = default;
modalRef = ModalService.CreateModal<bool>(new()
{
Title = data.Id > 0 ? "修改" : "新增",
Content =
@<Form @ref="form" Model="data" OnFinish="()=> modalRef.OkAsync(true)"
LabelColSpan="6" WrapperColSpan="18">
<FormItem Label="标准提问词" >
<TextArea Rows="4" @bind-Value="@context.NamePrompt" />
</FormItem>
</Form>
,
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();
}
});
}
} }

View File

@ -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;
using Microsoft.AspNetCore.Components.Web;
using SqlSugar; using SqlSugar;
using System.Drawing;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection;
using UserCenter.Model;
using UserCenter.Model.Enum;
using VideoAnalysisCore.Common; using VideoAnalysisCore.Common;
using VideoAnalysisCore.Enum;
using VideoAnalysisCore.Model; using VideoAnalysisCore.Model;
namespace Learn.VideoAnalysis.Components.Pages namespace Learn.VideoAnalysis.Components.Pages
{ {
public partial class EvaluationProject : ComponentBase public partial class EvaluationProject : ComponentBase
{ {
[Inject] private ConfirmService ComfirmService { get; set; } = default!; [Inject] private ConfirmService ComfirmService { get; set; } = default!;
[Inject] private ModalService ModalService { get; set; } = default!;
[Inject] private Repository<CourseGradingCriteria> criteria { get; set; } = default!; [Inject] private Repository<CourseGradingCriteria> criteria { get; set; } = default!;
[Inject] private INotificationService _notice { get; set; } = default!;
IEnumerable<CourseGradingCriteria> _selectedRows = []; IEnumerable<CourseGradingCriteria> _selectedRows = [];
ITable _table; ITable _table;
IForm? form;
List<CourseGradingCriteria> _dataSource = null; List<CourseGradingCriteria> _dataSource = null;
RefAsync<int> _total = 0; RefAsync<int> _total = 0;
bool tableLoading = false; bool tableLoading = false;
Table<CourseGradingCriteria> tableRef;
List<CourseGradingCriteria> _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();
}
}
/// <summary>
/// 新增或者修改
/// </summary>
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();
}
/// <summary> /// <summary>
/// 分页 查询 筛选 时 /// 分页 查询 筛选 时
/// </summary> /// </summary>

View File

@ -1,3 +1,9 @@
input[aria-hidden="true"] { input[aria-hidden="true"] {
display: none !important; display: none !important;
} }
.displayNone {
display:none !important;
}
.ant-table-pagination {
display:none !important;
}

View File

@ -22,6 +22,7 @@
<PropertyColumn Property="c=>c.Id" Width="130px" Filterable="true" Sortable="true" /> <PropertyColumn Property="c=>c.Id" Width="130px" Filterable="true" Sortable="true" />
<PropertyColumn Property="c=>c.TagId" Width="160px" /> <PropertyColumn Property="c=>c.TagId" Width="160px" />
<PropertyColumn Property="c=>c.LastEnum" Width="150px" /> <PropertyColumn Property="c=>c.LastEnum" Width="150px" />
<PropertyColumn Property="c=>c.Subject" Width="100px" />
<PropertyColumn Property="c=>c.ApiToken" Width="150px" /> <PropertyColumn Property="c=>c.ApiToken" Width="150px" />
<PropertyColumn Property="c=>c.ComeFrom" Width="100px" /> <PropertyColumn Property="c=>c.ComeFrom" Width="100px" />
<PropertyColumn Property="c=>c.MediaUrl" Width="320px" /> <PropertyColumn Property="c=>c.MediaUrl" Width="320px" />

View File

@ -87,7 +87,6 @@ namespace Learn.VideoAnalysis.Components.Pages
/// 分页 查询 筛选 时 /// 分页 查询 筛选 时
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="changed"></param>
async void OnChange(QueryModel<VideoTaskDto> query) async void OnChange(QueryModel<VideoTaskDto> query)
{ {
lastQuery = query; lastQuery = query;

View File

@ -7,7 +7,6 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using AntDesign @using AntDesign
@using AntDesign.Charts
@using AntDesign.ProLayout @using AntDesign.ProLayout
@using AntDesign.Extensions.Localization @using AntDesign.Extensions.Localization

View File

@ -108,6 +108,26 @@ namespace Learn.VideoAnalysis.Controllers
return mergedList; return mergedList;
} }
/// <summary>
/// 重新开始执行GPT分析<para>taskId/tagId二选一</para>
/// </summary>
/// <param name="taskId"></param>
/// <param name="tagId">自定义id</param>
/// <returns></returns>
[HttpGet(Name = "ReStart")]
public async Task<IActionResult> 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();
}
/// <summary> /// <summary>
/// 获取视频信息<para>taskId/tagId二选一</para> /// 获取视频信息<para>taskId/tagId二选一</para>
/// </summary> /// </summary>
@ -165,6 +185,8 @@ namespace Learn.VideoAnalysis.Controllers
ComeFrom = GetClientIpAddress(), ComeFrom = GetClientIpAddress(),
MediaUrl = req.MediaUrl, MediaUrl = req.MediaUrl,
ApiToken = req.ApiToken, ApiToken = req.ApiToken,
Type = req.Type,
Subject = req.Subject,
Tag = req.Tag, Tag = req.Tag,
TagId = req.TagId, TagId = req.TagId,
}; };

View File

@ -1,5 +1,6 @@
using AntDesign; using AntDesign;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using UserCenter.Model.Enum;
using VideoAnalysisCore.AICore.ChatGPT.Dto; using VideoAnalysisCore.AICore.ChatGPT.Dto;
using VideoAnalysisCore.Enum; using VideoAnalysisCore.Enum;
@ -22,6 +23,14 @@ namespace Learn.VideoAnalysis.Controllers.Dto
[Required(ErrorMessage = "接口Token是必填项")] [Required(ErrorMessage = "接口Token是必填项")]
public string ApiToken { get; set; } = string.Empty; public string ApiToken { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 内容所属学科
/// </summary>
public SubjectEnum? Subject { get; set; }
/// <summary>
/// 任务类型
/// </summary>
public TaskTypeEnum? Type { get; set; }
/// <summary>
/// 自定义值 任务完成后附带通知 /// 自定义值 任务完成后附带通知
/// </summary> /// </summary>
public string Tag { get; set; } = string.Empty; public string Tag { get; set; } = string.Empty;
@ -36,7 +45,6 @@ namespace Learn.VideoAnalysis.Controllers.Dto
//[Url(ErrorMessage = "请输入有效的 URL")] //[Url(ErrorMessage = "请输入有效的 URL")]
//public string CallBackUrl { get; set; } = string.Empty; //public string CallBackUrl { get; set; } = string.Empty;
} }
public class TextValue public class TextValue
{ {

View File

@ -1,2 +1,7 @@
global using VideoAnalysisRazor.Resources; global using VideoAnalysisRazor.Resources;
global using AntDesign; global using AntDesign;
global using VideoAnalysisCore.Model;
global using VideoAnalysisCore.Model.Dto;
global using VideoAnalysisCore.Enum;
global using Learn.VideoAnalysis.Controllers.Dto;

View File

@ -30,10 +30,6 @@
<PackageReference Include="Mapster.DependencyInjection" Version="1.0.2-pre01" /> <PackageReference Include="Mapster.DependencyInjection" Version="1.0.2-pre01" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.5" />
<PackageReference Include="AntDesign.Charts" Version="0.4.0" />
<PackageReference Include="AntDesign.Extensions.Localization" Version="0.20.2.1" /> <PackageReference Include="AntDesign.Extensions.Localization" Version="0.20.2.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />

View File

@ -69,7 +69,15 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto
/// <summary> /// <summary>
/// AI评估得分 /// AI评估得分
/// </summary> /// </summary>
public int Score { get; set; } public decimal Score { get; set; }
/// <summary>
/// 总分
/// </summary>
public decimal TotalScore { get; set; }
/// <summary>
/// 及格分数
/// </summary>
public decimal PassScore { get; set; }
/// <summary> /// <summary>
/// 提词 /// 提词
/// </summary> /// </summary>

View File

@ -48,15 +48,25 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
/// <returns></returns> /// <returns></returns>
public async Task<TaskRes> CallGPT(string task) public async Task<TaskRes> 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 captions = ExpandFunction.GetSpeakerCaptions(task);
var criteriaArr = await criteriaDB.GetListAsync(); var criteriaArr = await criteriaDB.GetListAsync(s=>s.Subject == taskInfo.Subject);
var criteriaBuilder = new StringBuilder(); var criteriaBuilder = new StringBuilder();
foreach (var item in criteriaArr) foreach (var item in criteriaArr)
{ {
criteriaBuilder.Append(item.Id); criteriaBuilder.Append(item.Id);
criteriaBuilder.Append(":"); criteriaBuilder.Append(":");
criteriaBuilder.Append(item.NamePrompt); 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 返回参数: " + throw new Exception($"KIMI模型返回异常 Chat 返回参数: " +
$" {JsonSerializer.Serialize(chatResp)}"); $" {JsonSerializer.Serialize(chatResp)}");
var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content; var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content;
chatResContent = chatResContent?.Replace("字幕内容", "课堂"); chatResContent = chatResContent?.Replace("字幕内容", "课堂情况");
if (chatResContent is null) if (chatResContent is null)
throw new Exception("KIMIGPT返回message无效结果"); throw new Exception("KIMIGPT返回message无效结果");
var questionRes = JsonSerializer.Deserialize<QuestionRes[]>(chatResContent); var questionRes = JsonSerializer.Deserialize<QuestionRes[]>(chatResContent);
var gptRes = new TaskRes(captions); var gptRes = new TaskRes(captions);
if (questionRes is null) if (questionRes is null)
throw new Exception("KIMIGPT返回无效结果"); throw new Exception("KIMIGPT返回无效结果");
var qEnum = (int)QuestionTypeEnum.;
//处理 ai问答提问 //处理 ai问答提问
var arr1 = questionRes.Where(s => s. < 100); var arr1 = questionRes.Where(s => s. < qEnum);
var arr2 = questionRes.Where(s => s. >= 100) var arr2 = questionRes.Where(s => s. >= qEnum)
.ToDictionary(s => s.); .ToDictionary(s => s.);
//AI综合评估 //AI综合评估
var criteriaDic = criteriaArr.ToDictionary(s => s.Id); var criteriaDic = criteriaArr.ToDictionary(s => s.Id);
@ -123,16 +134,17 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
var ccArr = arr1.Select(s => new CourseCriteria() var ccArr = arr1.Select(s => new CourseCriteria()
{ {
Id = criteriaDic[s.].Id, Id = criteriaDic[s.].Id,
Score = int.Parse(s.ToObject<object[]>()?[0].ToString() ?? string.Empty), PassScore = criteriaDic[s.].PassScore,
TotalScore = criteriaDic[s.].TotalScore,
Score = decimal.Parse(s.ToObject<object[]>()?[0].ToString() ?? string.Empty) / 10,
Prompt = s.ToObject<object[]>()?[1].ToString() ?? string.Empty, Prompt = s.ToObject<object[]>()?[1].ToString() ?? string.Empty,
ImprovedMethods = s.ToObject<object[]>()?[2].ToString() ?? string.Empty, ImprovedMethods = s.ToObject<object[]>()?[2].ToString() ?? string.Empty,
Analyze = s. + s.ToObject<object[]>()?[3].ToString() ?? string.Empty, Analyze = s. + s.ToObject<object[]>()?[3].ToString() ?? string.Empty,
//Analyze = s.问题解释 ?? string.Empty,
}).ToArray(); }).ToArray();
gptRes.Assessment = new AssessmentDto() gptRes.Assessment = new AssessmentDto()
{ {
Bad = ccArr.Where(s => s.Score< 6 ).ToArray(), Bad = ccArr.Where(s => s.Score< s.PassScore ).ToArray(),
Merit = ccArr.Where(s => s.Score>= 6).ToArray(), Merit = ccArr.Where(s => s.Score>= s.PassScore).ToArray(),
}; };
//高频词汇 //高频词汇
gptRes.Hotwords = arr2[(int)QuestionTypeEnum.].ToObject<string[]>() ?? ["暂无数据"]; gptRes.Hotwords = arr2[(int)QuestionTypeEnum.].ToObject<string[]>() ?? ["暂无数据"];

View File

@ -8,6 +8,7 @@ using Newtonsoft.Json;
using System.Net.Http.Json; using System.Net.Http.Json;
using AntDesign; using AntDesign;
using OneOf.Types; using OneOf.Types;
using System.Net;
/// <summary> /// <summary>
/// https://platform.moonshot.cn/docs/api-reference /// https://platform.moonshot.cn/docs/api-reference
@ -192,9 +193,19 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
var client = _httpClientFactory.CreateClient(); var client = _httpClientFactory.CreateClient();
client.Timeout = TimeSpan.FromSeconds(60 * 20);//超时时间20分钟 client.Timeout = TimeSpan.FromSeconds(60 * 20);//超时时间20分钟
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ApiKey); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ApiKey);
var request = ToHttpRequest(path); client.DefaultRequestVersion = HttpVersion.Version20;
request.Content = new StringContent(json, Encoding.UTF8, "application/json"); client.DefaultVersionPolicy = HttpVersionPolicy.RequestVersionOrLower;
return await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); client.DefaultRequestHeaders.ConnectionClose = true;
//var request = ToHttpRequest(path);
//request.Version = HttpVersion.Version20;
//request.VersionPolicy = HttpVersionPolicy.RequestVersionOrLower;
//request.Content = new StringContent(json, Encoding.UTF8, "application/json");
//return await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
var uriBuilder = new UriBuilder(Host + path);
var content = new StringContent(json, Encoding.UTF8, "application/json");
return await client.PostAsync(uriBuilder.Uri, content);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -108,7 +108,7 @@ namespace VideoAnalysisCore.Common
{ {
FieldName = s.FieldName, FieldName = s.FieldName,
ConditionalType = ConvertToConditionalType( x.FilterCompareOperator), ConditionalType = ConvertToConditionalType( x.FilterCompareOperator),
FieldValue = x.Value.ToString(), FieldValue = x.Value.GetType().IsEnum?((int)x.Value).ToString() : x.Value.ToString(),
} as IConditionalModel)).ToList(); } as IConditionalModel)).ToList();
} }
/// <summary> /// <summary>

View File

@ -12,15 +12,15 @@ namespace VideoAnalysisCore.Enum
[Display(Prompt = "分析授课中使用的高频词" + [Display(Prompt = "分析授课中使用的高频词" +
"10个频率从高到低 结果类型[]")] "10个频率从高到低 结果类型[]")]
= 100, = 5001,
[Display(Prompt = "基于字幕描述内容精准的划分成时间片段" + [Display(Prompt = "基于字幕描述内容精准的划分成时间片段" +
",提取片段的内容概览,字幕开始秒,结束秒.作为返回结果.每个个片段不低于120秒 结果类型[{Start:开始秒,End:结束秒,Content:概览}]")] ",提取片段的内容概览,字幕开始秒,结束秒.作为返回结果.每个个片段不低于120秒 结果类型[{Start:开始秒,End:结束秒,Content:概览}]")]
= 101, = 5001,
[Display(Prompt = "统计授课中教师回答类型的次数 回答类型" + [Display(Prompt = "统计授课中教师回答类型的次数 回答类型" +
"[重复回答,老师追问,简单性表扬,老师补充答案,表扬并补充答案] 结果类型{回答类型:次数}")] "[重复回答,老师追问,简单性表扬,老师补充答案,表扬并补充答案] 结果类型{回答类型:次数}")]
= 102, = 5002,
[Display(Prompt = " 分析授课中教师提到 以下类型" + [Display(Prompt = " 分析授课中教师提到 以下类型" +
"[独立学习,小组合作,随堂练习]的时间段,提取出其中字幕开始秒,结束秒 结果类型[{Start:开始秒,End:结束秒,Content:类型}/null]")] "[独立学习,小组合作,随堂练习]的时间段,提取出其中字幕开始秒,结束秒 结果类型[{Start:开始秒,End:结束秒,Content:类型}/null]")]
= 103, = 5003,
} }
} }

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VideoAnalysisCore.Enum
{
public enum TaskTypeEnum
{
/// <summary>
/// 蓝鲸智库视频分析
/// </summary>
_视频分析,
/// <summary>
/// 教研会议_视频分析
/// </summary>
_视频分析
}
}

View File

@ -3,6 +3,7 @@ using System.ComponentModel;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Net; using System.Net;
using UserCenter.Model.Enum;
using VideoAnalysisCore.AICore.SherpaOnnx; using VideoAnalysisCore.AICore.SherpaOnnx;
using VideoAnalysisCore.Enum; using VideoAnalysisCore.Enum;
using Whisper.net; using Whisper.net;
@ -19,35 +20,34 @@ namespace VideoAnalysisCore.Model
/// Id /// Id
/// </summary> /// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)] [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
[DisplayName( "编号"), Required] [DisplayName("编号"), Required]
public long Id { get; set; } public long Id { get; set; }
/// <summary> /// <summary>
/// 标准提问词 /// 标准提问词
/// </summary> /// </summary>
[SugarColumn(Length = 100)] [SugarColumn(Length = 100)]
[DisplayName( "标准提问词"), Required] [DisplayName("标准提问词"), Required]
public string NamePrompt { get; set; }=string.Empty; public string NamePrompt { get; set; } = string.Empty;
/// <summary>
/// 优点展示词
/// </summary>
[SugarColumn(Length = 100)]
[DisplayName( "优点展示词"), Required]
public string Advantage { get; set; } = string.Empty;
/// <summary> /// <summary>
/// 缺点展示词 /// 总分值
/// </summary> /// </summary>
[SugarColumn(Length = 100)] [SugarColumn( DefaultValue = "10", Length = 8, DecimalDigits = 1)]
[DisplayName( "缺点展示词"), Required] [DisplayName("总分值"), Required]
public string Flaw { get; set; } = string.Empty; public decimal TotalScore { get; set; } = 10;
/// <summary>
/// 绑定学科
/// </summary>
[SugarColumn( IsNullable = true)]
[DisplayName("绑定学科")]
public SubjectEnum? Subject { get; set; }
/// <summary> /// <summary>
/// 改进意见 /// 合格分值
/// </summary> /// </summary>
[DisplayName( "改进意见")] [SugarColumn(DefaultValue = "6", Length = 8, DecimalDigits = 1)]
[SugarColumn(Length = 100), Required] [DisplayName("合格分值"), Required]
public string ImprovedMethods { get; set; } = string.Empty; public decimal PassScore { get; set; } = 6;
} }
} }

View File

@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using VideoAnalysisCore.Enum; using VideoAnalysisCore.Enum;
using System.Text.Json; using System.Text.Json;
using UserCenter.Model.Enum;
namespace VideoAnalysisCore.Model.Dto namespace VideoAnalysisCore.Model.Dto
{ {
@ -35,6 +36,11 @@ namespace VideoAnalysisCore.Model.Dto
[DisplayName("最后执行")] [DisplayName("最后执行")]
public RedisChannelEnum LastEnum { get; set; } public RedisChannelEnum LastEnum { get; set; }
/// <summary> /// <summary>
/// 学科
/// </summary>
[DisplayName("学科")]
public SubjectEnum? Subject { get; set; }
/// <summary>
/// 执行进度 /// 执行进度
/// </summary> /// </summary>
[DisplayName("进度")] [DisplayName("进度")]

View File

@ -2,6 +2,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Net; using System.Net;
using System.Text.Json; using System.Text.Json;
using UserCenter.Model.Enum;
using VideoAnalysisCore.AICore.ChatGPT.Dto; using VideoAnalysisCore.AICore.ChatGPT.Dto;
using VideoAnalysisCore.AICore.SherpaOnnx; using VideoAnalysisCore.AICore.SherpaOnnx;
using VideoAnalysisCore.AICore.Whisper; using VideoAnalysisCore.AICore.Whisper;
@ -42,6 +43,17 @@ namespace VideoAnalysisCore.Model
/// 请求来自哪个ip地址 /// 请求来自哪个ip地址
/// </summary> /// </summary>
public string ComeFrom { get; set; } = string.Empty; public string ComeFrom { get; set; } = string.Empty;
/// <summary>
/// 视频学科, null视为无学科
/// </summary>
[SugarColumn( IsNullable = true)]
public SubjectEnum? Subject { get; set; }
/// <summary>
/// 任务类型
/// </summary>
[SugarColumn(IsNullable = true)]
public TaskTypeEnum? Type { get; set; }
/// <summary> /// <summary>
/// 自定义值 任务完成后附带通知 /// 自定义值 任务完成后附带通知
/// </summary> /// </summary>

View File

@ -39,9 +39,10 @@
<PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.30" /> <PackageReference Include="org.k2fsa.sherpa.onnx" Version="1.10.30" />
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" /> <PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" /> <PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
<PackageReference Include="UserCenter.Model" Version="1.3.4" />
<PackageReference Include="Whisper.net" Version="1.5.0" /> <PackageReference Include="Whisper.net" Version="1.5.0" />
<PackageReference Include="Whisper.net.Runtime" Version="1.5.0" /> <PackageReference Include="Whisper.net.Runtime" Version="1.5.0" />
<PackageReference Include="xFFmpeg.NET" Version="6.0.0" /> <PackageReference Include="xFFmpeg.NET" Version="6.0.0" />
<PackageReference Include="AntDesign.ProLayout" Version="0.20.2.1" /> <PackageReference Include="AntDesign.ProLayout" Version="1.0.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>