parent
c06878db59
commit
0229ae490b
|
|
@ -1,6 +1,7 @@
|
||||||
using AntDesign.Extensions.Localization;
|
using AntDesign.Extensions.Localization;
|
||||||
using AntDesign.ProLayout;
|
using AntDesign.ProLayout;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.Identity.Client.Extensions.Msal;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
|
|
||||||
|
|
@ -9,7 +10,9 @@ namespace VideoAnalysisRazor.Layouts
|
||||||
public partial class BasicLayout : LayoutComponentBase, IDisposable
|
public partial class BasicLayout : LayoutComponentBase, IDisposable
|
||||||
{
|
{
|
||||||
private MenuDataItem[] _menuData;
|
private MenuDataItem[] _menuData;
|
||||||
|
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
||||||
|
|
||||||
|
[Inject] IHttpContextAccessor HttpContextAccessor { get; set; } = default!;
|
||||||
[Inject] private ReuseTabsService TabService { get; set; }
|
[Inject] private ReuseTabsService TabService { get; set; }
|
||||||
|
|
||||||
bool collapsed;
|
bool collapsed;
|
||||||
|
|
@ -17,8 +20,14 @@ namespace VideoAnalysisRazor.Layouts
|
||||||
{
|
{
|
||||||
collapsed = !collapsed;
|
collapsed = !collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
if (!CheckLogin())
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo("/Login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
_menuData = [
|
_menuData = [
|
||||||
new MenuDataItem
|
new MenuDataItem
|
||||||
{
|
{
|
||||||
|
|
@ -37,6 +46,10 @@ namespace VideoAnalysisRazor.Layouts
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CheckLogin()
|
||||||
|
{
|
||||||
|
return HttpContextAccessor.HttpContext?.Session.GetInt32("Login") == 1;
|
||||||
|
}
|
||||||
void Reload()
|
void Reload()
|
||||||
{
|
{
|
||||||
TabService.ReloadPage();
|
TabService.ReloadPage();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using AntDesign.TableModels;
|
using AntDesign.TableModels;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
@ -7,6 +8,7 @@ using VideoAnalysisCore.Model;
|
||||||
|
|
||||||
namespace Learn.VideoAnalysis.Components.Pages
|
namespace Learn.VideoAnalysis.Components.Pages
|
||||||
{
|
{
|
||||||
|
[Authorize]
|
||||||
public partial class EvaluationProject : ComponentBase
|
public partial class EvaluationProject : ComponentBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
@page "/Login"
|
||||||
|
@using AntDesign
|
||||||
|
@using AntDesign.TableModels
|
||||||
|
@using System.ComponentModel.DataAnnotations
|
||||||
|
@using SqlSugar
|
||||||
|
@using VideoAnalysisCore.Model
|
||||||
|
@using VideoAnalysisCore.Model.Dto
|
||||||
|
|
||||||
|
|
||||||
|
<div style="width:100%;height:100%">
|
||||||
|
<!-- 背景颜色 -->
|
||||||
|
<div class="color"></div>
|
||||||
|
<div class="color"></div>
|
||||||
|
<div class="color"></div>
|
||||||
|
<div class="box">
|
||||||
|
<!-- 背景圆 -->
|
||||||
|
<div class="circle" style="--x:0"></div>
|
||||||
|
<div class="circle" style="--x:1"></div>
|
||||||
|
<div class="circle" style="--x:2"></div>
|
||||||
|
<div class="circle" style="--x:3"></div>
|
||||||
|
<div class="circle" style="--x:4"></div>
|
||||||
|
<!-- 登录框 -->
|
||||||
|
<div class="container">
|
||||||
|
<div class="form">
|
||||||
|
<h2>登录</h2>
|
||||||
|
<form>
|
||||||
|
<div class="inputBox">
|
||||||
|
<input type="text" placeholder="账号" @bind="InputAccount">
|
||||||
|
</div>
|
||||||
|
<div class="inputBox">
|
||||||
|
<input type="password" placeholder="密码" @bind="InputPassword">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="inputBox">
|
||||||
|
<input value="登录" @onclick="() => LoginFunAsync()">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@* <p class="forget">
|
||||||
|
忘记密码?<a href="#">
|
||||||
|
点击这里
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p class="forget">
|
||||||
|
没有账户?<a href="#">
|
||||||
|
注册
|
||||||
|
</a>
|
||||||
|
</p> *@
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
using AntDesign;
|
||||||
|
using AntDesign.TableModels;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.DataProtection.KeyManagement;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using VideoAnalysisCore.Common;
|
||||||
|
using VideoAnalysisCore.Enum;
|
||||||
|
using VideoAnalysisCore.Model;
|
||||||
|
using VideoAnalysisCore.Model.Dto;
|
||||||
|
|
||||||
|
namespace Learn.VideoAnalysis.Components.Pages
|
||||||
|
{
|
||||||
|
public partial class Login : ComponentBase
|
||||||
|
{
|
||||||
|
[Inject] IHttpContextAccessor HttpContextAccessor { get; set; } = default!;
|
||||||
|
[Inject] private Repository<VideoTask> taskDB { get; set; } = default!;
|
||||||
|
[Inject] private NavigationManager NavigationManager { get; set; } = default!;
|
||||||
|
[Inject] private INotificationService _notice { get; set; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 输入的账号
|
||||||
|
/// </summary>
|
||||||
|
public string InputAccount = string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 输入的密码
|
||||||
|
/// </summary>
|
||||||
|
public string InputPassword= string.Empty;
|
||||||
|
/// <summary>
|
||||||
|
/// 初始化
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnInitialized()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 登录函数
|
||||||
|
/// </summary>
|
||||||
|
public async Task LoginFunAsync()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(InputAccount) || string.IsNullOrEmpty(InputPassword))
|
||||||
|
{
|
||||||
|
await _notice.Open(new NotificationConfig()
|
||||||
|
{
|
||||||
|
Message = "提示",
|
||||||
|
Description = "账号/密码必填",
|
||||||
|
NotificationType = NotificationType.Warning
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (InputAccount == "admin" && InputPassword == "q1w2e3!@#")
|
||||||
|
{
|
||||||
|
HttpContextAccessor.HttpContext?.Session
|
||||||
|
.SetInt32("Login", 1);
|
||||||
|
NavigationManager.NavigateTo("/");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _notice.Open(new NotificationConfig()
|
||||||
|
{
|
||||||
|
Message = "提示",
|
||||||
|
Description = "账号/密码输入错误",
|
||||||
|
NotificationType = NotificationType.Warning
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,240 @@
|
||||||
|
input[aria-hidden="true"] {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
/* 清除浏览器默认边距,
|
||||||
|
使边框和内边距的值包含在元素的width和height内 */
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 使用flex布局,让内容垂直和水平居中 */
|
||||||
|
|
||||||
|
section {
|
||||||
|
/* 相对定位 */
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 100vh;
|
||||||
|
/* linear-gradient() 函数用于创建一个表示两种或多种颜色线性渐变的图片 */
|
||||||
|
background: linear-gradient(to bottom, #f1f4f9, #dff1ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 背景颜色 */
|
||||||
|
|
||||||
|
section .color {
|
||||||
|
/* 绝对定位 */
|
||||||
|
position: absolute;
|
||||||
|
/* 使用filter(滤镜) 属性,给图像设置高斯模糊*/
|
||||||
|
filter: blur(200px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* :nth-child(n) 选择器匹配父元素中的第 n 个子元素 */
|
||||||
|
|
||||||
|
section .color:nth-child(1) {
|
||||||
|
top: -350px;
|
||||||
|
width: 600px;
|
||||||
|
height: 600px;
|
||||||
|
background: #ff359b;
|
||||||
|
}
|
||||||
|
|
||||||
|
section .color:nth-child(2) {
|
||||||
|
bottom: -150px;
|
||||||
|
left: 100px;
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
|
background: #fffd87;
|
||||||
|
}
|
||||||
|
|
||||||
|
section .color:nth-child(3) {
|
||||||
|
bottom: 50px;
|
||||||
|
right: 100px;
|
||||||
|
width: 500px;
|
||||||
|
height: 500px;
|
||||||
|
background: #00d2ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 背景圆样式 */
|
||||||
|
|
||||||
|
.box .circle {
|
||||||
|
position: absolute;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
/* backdrop-filter属性为一个元素后面区域添加模糊效果 */
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||||
|
border-right: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
border-radius: 50%;
|
||||||
|
/* 使用filter(滤镜) 属性,改变颜色。
|
||||||
|
hue-rotate(deg) 给图像应用色相旋转
|
||||||
|
calc() 函数用于动态计算长度值
|
||||||
|
var() 函数调用自定义的CSS属性值x*/
|
||||||
|
filter: hue-rotate(calc(var(--x) * 70deg));
|
||||||
|
/* 调用动画animate,需要10s完成动画,
|
||||||
|
linear表示动画从头到尾的速度是相同的,
|
||||||
|
infinite指定动画应该循环播放无限次*/
|
||||||
|
animation: animate 10s linear infinite;
|
||||||
|
/* 动态计算动画延迟几秒播放 */
|
||||||
|
animation-delay: calc(var(--x) * -1s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 背景圆动画 */
|
||||||
|
|
||||||
|
@keyframes animate {
|
||||||
|
0%, 100%, {
|
||||||
|
transform: translateY(-50px);
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: translateY(50px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.box .circle:nth-child(1) {
|
||||||
|
top: -50px;
|
||||||
|
right: -60px;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box .circle:nth-child(2) {
|
||||||
|
top: 150px;
|
||||||
|
left: -100px;
|
||||||
|
width: 120px;
|
||||||
|
height: 120px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box .circle:nth-child(3) {
|
||||||
|
bottom: 50px;
|
||||||
|
right: -60px;
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box .circle:nth-child(4) {
|
||||||
|
bottom: -80px;
|
||||||
|
left: 100px;
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box .circle:nth-child(5) {
|
||||||
|
top: -80px;
|
||||||
|
left: 140px;
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 登录框样式 */
|
||||||
|
|
||||||
|
.container {
|
||||||
|
position: relative;
|
||||||
|
width: 400px;
|
||||||
|
min-height: 400px;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
backdrop-filter: blur(5px);
|
||||||
|
box-shadow: 0 25px 45px rgba(0, 0, 0, 0.1);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||||
|
border-right: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 登录标题样式 */
|
||||||
|
|
||||||
|
.form h2 {
|
||||||
|
position: relative;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 5px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 登录标题的下划线样式 */
|
||||||
|
|
||||||
|
.form h2::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: -10px;
|
||||||
|
width: 0px;
|
||||||
|
height: 3px;
|
||||||
|
background: #fff;
|
||||||
|
transition: 0.5s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form h2:hover:before {
|
||||||
|
width: 53px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form .inputBox {
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框样式 */
|
||||||
|
|
||||||
|
.form .inputBox input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 20px;
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
border-radius: 30px;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||||
|
border-right: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
|
font-size: 16px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form .inputBox input::placeholder {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 登录按钮样式 */
|
||||||
|
|
||||||
|
.form .inputBox input[type="submit"] {
|
||||||
|
background: #fff;
|
||||||
|
color: #666;
|
||||||
|
max-width: 100px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.forget {
|
||||||
|
margin-top: 6px;
|
||||||
|
color: #fff;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.forget a {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
@ -34,6 +34,8 @@ namespace Learn.VideoAnalysis.Components.Pages
|
||||||
async void ReStart(VideoTaskDto query)
|
async void ReStart(VideoTaskDto query)
|
||||||
{
|
{
|
||||||
var lastEnum = (await RedisExpand.Redis.HMGetAsync<RedisChannelEnum>(RedisExpandKey.Task(query.Id), "LastEnum")).FirstOrDefault() ;
|
var lastEnum = (await RedisExpand.Redis.HMGetAsync<RedisChannelEnum>(RedisExpandKey.Task(query.Id), "LastEnum")).FirstOrDefault() ;
|
||||||
|
await taskDB.UpdateAsync(s => new VideoTask()
|
||||||
|
{ ErrorMessage = string.Empty },s => s.Id == query.Id);
|
||||||
RedisExpand.InsertChannel(lastEnum, query.Id);
|
RedisExpand.InsertChannel(lastEnum, query.Id);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -35,15 +35,18 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ²åÈë¶ÓÁÐ
|
/// 获取视频信息<para>taskId/tagId二选一</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="taskId"></param>
|
/// <param name="taskId"></param>
|
||||||
/// <param name="msg"></param>
|
/// <param name="tagId">自定义id</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet(Name = "TaskInfo")]
|
[HttpGet(Name = "TaskInfo")]
|
||||||
public async Task<IActionResult> TaskInfo(long taskId)
|
public async Task<IActionResult> TaskInfo(long taskId,string tagId)
|
||||||
{
|
{
|
||||||
var task = await videoTaskDB.GetFirstAsync(s => s.Id == taskId);
|
var task = await videoTaskDB.AsQueryable()
|
||||||
|
.WhereIF(taskId!=0, s => s.Id == taskId)
|
||||||
|
.WhereIF(string.IsNullOrEmpty(tagId), s => s.TagId == tagId)
|
||||||
|
.FirstAsync();
|
||||||
if (task.LastEnum != RedisChannelEnum.EndTask)
|
if (task.LastEnum != RedisChannelEnum.EndTask)
|
||||||
return BadRequest(new { Enum = task.LastEnum ,Task = task.ChatAnalysis});
|
return BadRequest(new { Enum = task.LastEnum ,Task = task.ChatAnalysis});
|
||||||
return Ok(new { Enum = task.LastEnum, Task = task.ChatAnalysis });
|
return Ok(new { Enum = task.LastEnum, Task = task.ChatAnalysis });
|
||||||
|
|
@ -79,7 +82,7 @@ namespace Learn.VideoAnalysis.Controllers
|
||||||
MediaUrl = req.MediaUrl,
|
MediaUrl = req.MediaUrl,
|
||||||
ApiToken = req.ApiToken,
|
ApiToken = req.ApiToken,
|
||||||
Tag = req.Tag,
|
Tag = req.Tag,
|
||||||
CallBackUrl = req.CallBackUrl,
|
TagId = req.TagId,
|
||||||
};
|
};
|
||||||
//Èë¿â
|
//Èë¿â
|
||||||
task.Id = await videoTaskDB.InsertReturnBigIdentityAsync(task);
|
task.Id = await videoTaskDB.InsertReturnBigIdentityAsync(task);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,10 @@ namespace Learn.VideoAnalysis.Controllers.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Tag { get; set; } = string.Empty;
|
public string Tag { get; set; } = string.Empty;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 自定义Id可用于任务完成之后的查询
|
||||||
|
/// </summary>
|
||||||
|
public string? TagId { get; set; }
|
||||||
|
/// <summary>
|
||||||
///回调Api地址
|
///回调Api地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//[Required(ErrorMessage = "回调Api地址是必填项")]
|
//[Required(ErrorMessage = "回调Api地址是必填项")]
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,10 @@
|
||||||
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Update="Components\Pages\Login.razor">
|
||||||
|
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,12 @@ namespace Learn.VideoAnalysis
|
||||||
builder.Services.AddHttpClient();
|
builder.Services.AddHttpClient();
|
||||||
builder.Services.AddSingleton<MoonshotClient>();
|
builder.Services.AddSingleton<MoonshotClient>();
|
||||||
builder.Services.AddSingleton<IBserGPT, KIMI_GPT>();
|
builder.Services.AddSingleton<IBserGPT, KIMI_GPT>();
|
||||||
|
builder.Services.AddSession(options =>
|
||||||
|
{
|
||||||
|
options.IdleTimeout = TimeSpan.FromMinutes(30);
|
||||||
|
options.Cookie.HttpOnly = true;
|
||||||
|
options.Cookie.IsEssential = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 教师提问类型
|
/// 教师提问类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public KeyValue<int>[]? QuestionType { get; set; }
|
public Dictionary<TeacherAnswerTypeEnum, int>? QuestionType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 时间段概览
|
/// 时间段概览
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,10 @@ namespace VideoAnalysisCore.AICore.ChatGPT.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// AI评估得分
|
||||||
|
/// </summary>
|
||||||
|
public int Score { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 提词
|
/// 提词
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Prompt { get; set; } = string.Empty;
|
public string Prompt { get; set; } = string.Empty;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
criteriaBuilder.Append(item.Id);
|
criteriaBuilder.Append(item.Id);
|
||||||
criteriaBuilder.Append(":");
|
criteriaBuilder.Append(":");
|
||||||
criteriaBuilder.Append(item.NamePrompt);
|
criteriaBuilder.Append(item.NamePrompt);
|
||||||
criteriaBuilder.Append("结果类型 int (1-10分 5分不合格 10分满分)|");
|
criteriaBuilder.Append("请基于解释打分(0-10分 6分为及格线) 结果类型 int |");
|
||||||
}
|
}
|
||||||
//拼接枚举提问
|
//拼接枚举提问
|
||||||
foreach (var value in System.Enum.GetValues(typeof(QuestionTypeEnum)))
|
foreach (var value in System.Enum.GetValues(typeof(QuestionTypeEnum)))
|
||||||
|
|
@ -99,6 +99,8 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
throw new Exception($"KIMI模型返回异常 Chat 请求参数: {System.Text.Json.JsonSerializer.Serialize(chatRep)} " +
|
throw new Exception($"KIMI模型返回异常 Chat 请求参数: {System.Text.Json.JsonSerializer.Serialize(chatRep)} " +
|
||||||
$" chatResp {System.Text.Json.JsonSerializer.Serialize(chatResp)}");
|
$" chatResp {System.Text.Json.JsonSerializer.Serialize(chatResp)}");
|
||||||
var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content;
|
var chatResContent = chatResp?.choices.FirstOrDefault()?.message.content;
|
||||||
|
|
||||||
|
|
||||||
if (chatResContent is null)
|
if (chatResContent is null)
|
||||||
throw new Exception("KIMIGPT返回message无效结果");
|
throw new Exception("KIMIGPT返回message无效结果");
|
||||||
|
|
||||||
|
|
@ -114,18 +116,20 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
var criteriaDic = criteriaArr.ToDictionary(s => s.Id);
|
var criteriaDic = criteriaArr.ToDictionary(s => s.Id);
|
||||||
gptRes.Assessment = new AssessmentDto()
|
gptRes.Assessment = new AssessmentDto()
|
||||||
{
|
{
|
||||||
Bad = arr1.Where(s => !s.结果.ToObject<bool>())
|
Bad = arr1.Where(s => s.结果.ToObject<int>() < 6)
|
||||||
.Select(s => new CourseCriteria()
|
.Select(s => new CourseCriteria()
|
||||||
{
|
{
|
||||||
Id = criteriaDic[s.问题编号].Id,
|
Id = criteriaDic[s.问题编号].Id,
|
||||||
ImprovedMethods = criteriaDic[s.问题编号].ImprovedMethods,
|
ImprovedMethods = criteriaDic[s.问题编号].ImprovedMethods,
|
||||||
Analyze = s.问题解释??string.Empty,
|
Analyze = s.问题解释??string.Empty,
|
||||||
|
Score = s.结果.ToObject<int>(),
|
||||||
Prompt = criteriaDic[s.问题编号].Flaw,
|
Prompt = criteriaDic[s.问题编号].Flaw,
|
||||||
}).ToArray(),
|
}).ToArray(),
|
||||||
Merit = arr1.Where(s => s.结果.ToObject<bool>())
|
Merit = arr1.Where(s => s.结果.ToObject<int>() >= 6)
|
||||||
.Select(s => new CourseCriteria()
|
.Select(s => new CourseCriteria()
|
||||||
{
|
{
|
||||||
Id = criteriaDic[s.问题编号].Id,
|
Id = criteriaDic[s.问题编号].Id,
|
||||||
|
Score = s.结果.ToObject<int>(),
|
||||||
//ImprovedMethods = criteriaDic[s.问题编号].ImprovedMethods,
|
//ImprovedMethods = criteriaDic[s.问题编号].ImprovedMethods,
|
||||||
Analyze = s.问题解释 ?? string.Empty,
|
Analyze = s.问题解释 ?? string.Empty,
|
||||||
Prompt = criteriaDic[s.问题编号].Advantage,
|
Prompt = criteriaDic[s.问题编号].Advantage,
|
||||||
|
|
@ -134,35 +138,37 @@ namespace VideoAnalysisCore.AICore.ChatGPT.KIMI
|
||||||
|
|
||||||
//高频词汇
|
//高频词汇
|
||||||
gptRes.Hotwords = arr2[(int)QuestionTypeEnum.高频词].结果.ToObject<string[]>()??["暂无数据"];
|
gptRes.Hotwords = arr2[(int)QuestionTypeEnum.高频词].结果.ToObject<string[]>()??["暂无数据"];
|
||||||
//提问类型
|
|
||||||
gptRes.QuestionType = arr2[(int)QuestionTypeEnum.提问类型].结果.ToObject<KeyValue<int>[]>();
|
|
||||||
//时间段概览
|
//时间段概览
|
||||||
gptRes.TimeOverview = arr2[(int)QuestionTypeEnum.时间段概览]
|
gptRes.TimeOverview = arr2[(int)QuestionTypeEnum.时间段概览]
|
||||||
.结果.ToObject<KeyValue<string>[]>()?.Select(s =>
|
.结果.ToObject<TimeBase[]>();
|
||||||
new TimeBase
|
//提问类型
|
||||||
{
|
gptRes.QuestionType = arr2[(int)QuestionTypeEnum.提问类型]
|
||||||
Start = double.Parse(s.key.Split(":")[1]??0.ToString()),
|
.结果.ToObject<Dictionary<TeacherAnswerTypeEnum, int>>();
|
||||||
End = double.Parse(s.key.Split(":")[2]??0.ToString()),
|
|
||||||
Content = s.value,
|
|
||||||
});
|
|
||||||
//分析上课时间段情况 分析 独立学习 小组合作 随堂练习等情况
|
//分析上课时间段情况 分析 独立学习 小组合作 随堂练习等情况
|
||||||
var extraTimeBase = arr2[(int)QuestionTypeEnum.额外课堂情况]
|
var extraTimeBase = arr2[(int)QuestionTypeEnum.额外课堂情况]
|
||||||
.结果.ToObject<KeyValue<string>[]>()?.Select(s =>
|
.结果.ToObject<Dictionary<TimeBaseTypeEnum,string?>>()?.Select(s =>
|
||||||
new TimeBase
|
new TimeBase(s.Value,s.Key.ToString()));
|
||||||
{
|
|
||||||
Start = double.Parse(s.key.Split(":")[1] ?? 0.ToString()),
|
|
||||||
End = double.Parse(s.key.Split(":")[2] ?? 0.ToString()),
|
|
||||||
Content = s.value,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var tId = long.Parse(task);
|
var tId = long.Parse(task);
|
||||||
var taskData = await videoTaskDB.GetFirstAsync(s => s.Id == tId);
|
var taskData = await videoTaskDB.GetFirstAsync(s => s.Id == tId);
|
||||||
taskData.ChatAnalysis = gptRes;
|
taskData.ChatAnalysis = gptRes;
|
||||||
|
taskData.ChatAnalysisScore = gptRes.Assessment.Merit?.Sum(s=>s.Score)??0;
|
||||||
|
taskData.ErrorMessage = string.Empty;
|
||||||
|
taskData.TotalTokens = chatResp.usage.total_tokens;
|
||||||
taskData.LastEnum = RedisChannelEnum.EndTask;
|
taskData.LastEnum = RedisChannelEnum.EndTask;
|
||||||
await videoTaskDB.AsUpdateable(taskData)
|
await videoTaskDB.AsUpdateable(taskData)
|
||||||
.UpdateColumns(it => new { it.ChatAnalysis }).ExecuteCommandAsync();
|
.UpdateColumns(it => new
|
||||||
|
{
|
||||||
|
it.ChatAnalysis,
|
||||||
|
it.ChatAnalysisScore,
|
||||||
|
it.ErrorMessage,
|
||||||
|
it.TotalTokens,
|
||||||
|
it.LastEnum,
|
||||||
|
}).ExecuteCommandAsync();
|
||||||
return gptRes;
|
return gptRes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,12 @@ namespace VideoAnalysisCore.Common
|
||||||
//执行任务时出现异常
|
//执行任务时出现异常
|
||||||
var error = ex.Message + ex.StackTrace;
|
var error = ex.Message + ex.StackTrace;
|
||||||
await SetTaskErrorMessage(long.Parse(taskId), error);
|
await SetTaskErrorMessage(long.Parse(taskId), error);
|
||||||
|
|
||||||
|
Console.WriteLine("====================[出现异常]====================");
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
Console.WriteLine(ex.StackTrace);
|
||||||
|
Console.WriteLine("==============================================");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -10,14 +10,17 @@ namespace VideoAnalysisCore.Enum
|
||||||
enum QuestionTypeEnum
|
enum QuestionTypeEnum
|
||||||
{
|
{
|
||||||
|
|
||||||
[Display(Prompt = "分析授课中使用的高频词10个频率从高到低 结果类型[]")]
|
[Display(Prompt = "分析授课中使用的高频词" +
|
||||||
|
"10个频率从高到低 结果类型[]")]
|
||||||
高频词 = 100,
|
高频词 = 100,
|
||||||
[Display(Prompt = "分析字幕中每5分钟的一个概览 结果类型[{key:时间段,value:概览}]")]
|
[Display(Prompt = "总结字幕内容划分成10个时间段" +
|
||||||
|
"并且提取它们的内容概览 结果类型[{Start:开始时间,End:结束时间,Content:概览}]")]
|
||||||
时间段概览 = 101,
|
时间段概览 = 101,
|
||||||
[Display(Prompt = "统计授课中教师提问类型的次数 类型[重复回答,老师追问,简单性表演,老师补充答案,表扬并补充答案] 结果类型[{key:类型,value:次数}]")]
|
[Display(Prompt = "统计授课中教师提问类型的次数 提问类型" +
|
||||||
|
"[重复回答,老师追问,简单性表扬,老师补充答案,表扬并补充答案] 结果类型{提问类型:次数}")]
|
||||||
提问类型 = 102,
|
提问类型 = 102,
|
||||||
|
[Display(Prompt = " 分析授课中教师提到 类型" +
|
||||||
[Display(Prompt = " 分析授课中教师提到 类型[独立学习,小组合作,随堂练习]的时间段 结果类型[{key:类型,value:时间段/null}] ")]
|
"[独立学习,小组合作,随堂练习]的时间段 结果类型[{Start:开始时间/null,End:结束时间/null,Content:类型}]")]
|
||||||
额外课堂情况 = 103,
|
额外课堂情况 = 103,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,30 +8,30 @@
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下载文件
|
/// 下载文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
DownloadFile = 1,
|
DownloadFile,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 分离音频
|
/// 分离音频
|
||||||
/// </summary>
|
/// </summary>
|
||||||
SeparateAudio = 2,
|
SeparateAudio,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解析字幕
|
/// 解析字幕
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParsingCaptions = 3,
|
ParsingCaptions,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解析说话人
|
/// 解析说话人
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ParsingSpeaker = 4,
|
ParsingSpeaker,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Chat模型分析
|
/// Chat模型分析
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ChatModelAnalysis = 5,
|
ChatModelAnalysis,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 回调三方系统
|
/// 回调三方系统
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CallBackSystem = 6,
|
CallBackSystem,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 结束任务
|
/// 结束任务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
EndTask = 6,
|
EndTask,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace VideoAnalysisCore.Enum
|
||||||
|
{
|
||||||
|
public enum TeacherAnswerTypeEnum
|
||||||
|
{
|
||||||
|
重复回答,
|
||||||
|
老师追问,
|
||||||
|
简单性表扬,
|
||||||
|
老师补充答案,
|
||||||
|
表扬并补充答案
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using VideoAnalysisCore.Enum;
|
using AntDesign;
|
||||||
|
using VideoAnalysisCore.Enum;
|
||||||
|
|
||||||
namespace VideoAnalysisCore.Model.Dto
|
namespace VideoAnalysisCore.Model.Dto
|
||||||
{
|
{
|
||||||
|
|
@ -7,6 +8,23 @@ namespace VideoAnalysisCore.Model.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class TimeBase
|
public class TimeBase
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str">时间端字符串</param>
|
||||||
|
/// <param name="content">内容</param>
|
||||||
|
public TimeBase(string str, string content)
|
||||||
|
{
|
||||||
|
Content = content;
|
||||||
|
if (string.IsNullOrEmpty(str))
|
||||||
|
return;
|
||||||
|
var arr = str.Split(":");
|
||||||
|
if (arr !=null && arr.Length >= 3)
|
||||||
|
{
|
||||||
|
Start = double.Parse(arr[1]);
|
||||||
|
End = double.Parse(arr[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
public TimeBase()
|
public TimeBase()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@ namespace VideoAnalysisCore.Model
|
||||||
[SugarColumn(Length = 500)]
|
[SugarColumn(Length = 500)]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///回调Api地址
|
/// 自定义值Id 任务完成后的凭证
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(Length = 500)]
|
[SugarColumn(Length = 500,IsNullable =true)]
|
||||||
public string CallBackUrl { get; set; }
|
public string? TagId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字幕缓存
|
/// 字幕缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -94,9 +94,10 @@ namespace VideoAnalysisCore.Model
|
||||||
get => JsonSerializer.Deserialize<CallGPTRes>(_ChatAnalysis ?? "{}");
|
get => JsonSerializer.Deserialize<CallGPTRes>(_ChatAnalysis ?? "{}");
|
||||||
set => _ChatAnalysis = JsonSerializer.Serialize(value);
|
set => _ChatAnalysis = JsonSerializer.Serialize(value);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// AI模型评分
|
||||||
|
/// </summary>
|
||||||
|
public decimal? ChatAnalysisScore { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 消耗token
|
/// 消耗token
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue