Compare commits
3 Commits
de3bd90822
...
04881ef3b8
| Author | SHA1 | Date |
|---|---|---|
|
|
04881ef3b8 | |
|
|
36f719370b | |
|
|
63041cd019 |
|
|
@ -51,24 +51,27 @@ namespace Learn.VideoAnalysis.Expand
|
||||||
},
|
},
|
||||||
OnAuthenticationFailed = context =>
|
OnAuthenticationFailed = context =>
|
||||||
{
|
{
|
||||||
context.Response.StatusCode = 403;
|
// 可选:标记一下是否过期
|
||||||
|
if (context.Exception!=null)
|
||||||
|
context.Response.Headers["Token-Expired"] = context.Exception.Message;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
},
|
},
|
||||||
OnChallenge = context =>
|
OnChallenge = context =>
|
||||||
{
|
{
|
||||||
context.HandleResponse();
|
if (context.Response.Headers.ContainsKey("Token-Expired"))
|
||||||
if (context.Response.StatusCode == 403)
|
|
||||||
{
|
{
|
||||||
var data1 = new { Code = 403, Message = context.Error + context.AuthenticateFailure?.Message };
|
|
||||||
context.Response.WriteAsync(data1.ToJson());
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
context.Response.Clear();
|
context.HandleResponse();
|
||||||
context.Response.ContentType = "application/json";
|
|
||||||
context.Response.StatusCode = 401;
|
context.Response.StatusCode = 401;
|
||||||
var data = new { Code = 401, Message = context.Error + context.AuthenticateFailure?.Message };
|
context.Response.ContentType = "application/json";
|
||||||
context.Response.WriteAsync(data.ToJson());
|
context.Response.Headers["Access-Control-Allow-Origin"] = "*"; // ✅ 补这个
|
||||||
return Task.CompletedTask;
|
var data = new
|
||||||
|
{
|
||||||
|
Code = 401,
|
||||||
|
Message = context.Error + context.AuthenticateFailure?.Message
|
||||||
|
};
|
||||||
|
return context.Response.WriteAsync(data.ToJson());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,13 @@ namespace Learn.VideoAnalysis
|
||||||
builder.AddAppConfig(args);
|
builder.AddAppConfig(args);
|
||||||
//初始化 插件
|
//初始化 插件
|
||||||
builder.Services.AddEndpointsApiExplorer();
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
//swagger
|
||||||
builder.Services.AddSwaggerExpand("AI视频分析");
|
builder.Services.AddSwaggerExpand("AI视频分析");
|
||||||
|
//鉴权
|
||||||
builder.Services.AddPermissionAuthentication();
|
builder.Services.AddPermissionAuthentication();
|
||||||
|
//数据库
|
||||||
builder.Services.AddSqlSugarExpand();
|
builder.Services.AddSqlSugarExpand();
|
||||||
|
//reids
|
||||||
builder.Services.AddRedisExpand();
|
builder.Services.AddRedisExpand();
|
||||||
//工作流
|
//工作流
|
||||||
builder.Services.AddSimpleTexOcrClient();
|
builder.Services.AddSimpleTexOcrClient();
|
||||||
|
|
@ -109,6 +113,8 @@ namespace Learn.VideoAnalysis
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
AppCommon.Services = app.Services;
|
AppCommon.Services = app.Services;
|
||||||
|
//允许跨域
|
||||||
|
app.UseCorsExpand();
|
||||||
app.UseMiddleware<BasicAuthMiddleware>("Swagger");
|
app.UseMiddleware<BasicAuthMiddleware>("Swagger");
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
|
|
@ -133,7 +139,6 @@ namespace Learn.VideoAnalysis
|
||||||
app.MapControllers();
|
app.MapControllers();
|
||||||
|
|
||||||
//自定义 应用
|
//自定义 应用
|
||||||
app.UseCorsExpand();
|
|
||||||
app.UseSqlSugarExpand();
|
app.UseSqlSugarExpand();
|
||||||
app.UseCoravelExpand();
|
app.UseCoravelExpand();
|
||||||
app.UseServiceSystem(() =>
|
app.UseServiceSystem(() =>
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import { useUserStoreHook } from "@/store/modules/user";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import { message } from "../message";
|
import { message } from "../message";
|
||||||
|
import { useNav } from "@/layout/hooks/useNav";
|
||||||
|
|
||||||
/**请求后端的地址 未配置则访问BaseURL */
|
/**请求后端的地址 未配置则访问BaseURL */
|
||||||
const apiServiceConfig = {
|
const apiServiceConfig = {
|
||||||
|
|
@ -203,11 +204,15 @@ class PureHttp {
|
||||||
$error.isCancelRequest = Axios.isCancel($error);
|
$error.isCancelRequest = Axios.isCancel($error);
|
||||||
// 关闭进度条动画
|
// 关闭进度条动画
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
|
debugger
|
||||||
if (error.response?.status === 403) {
|
if (error.response?.status === 403) {
|
||||||
// 跳转到403页面
|
// 跳转到403页面
|
||||||
router.push({
|
router.push({
|
||||||
path: "/error/403"
|
path: "/error/403"
|
||||||
});
|
});
|
||||||
|
}else if (error.response?.status === 401) {
|
||||||
|
// 跳转到403页面
|
||||||
|
useUserStoreHook().logOut();
|
||||||
}else if (error.response?.status !== 200) {
|
}else if (error.response?.status !== 200) {
|
||||||
ElMessage.warning("请求失败" + $error.message + " ");
|
ElMessage.warning("请求失败" + $error.message + " ");
|
||||||
console.log("请求失败" ,$error);
|
console.log("请求失败" ,$error);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://*:7532"
|
//"Url": "http://*:7532"
|
||||||
|
"Url": "http://*:5238"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ using static System.Net.Mime.MediaTypeNames;
|
||||||
using VideoAnalysisCore.AICore.GPT.DeepSeek;
|
using VideoAnalysisCore.AICore.GPT.DeepSeek;
|
||||||
using VideoAnalysisCore.AICore.GPT.Gemini;
|
using VideoAnalysisCore.AICore.GPT.Gemini;
|
||||||
using static System.Collections.Specialized.BitVector32;
|
using static System.Collections.Specialized.BitVector32;
|
||||||
|
using UserCenter.Model;
|
||||||
|
|
||||||
namespace VideoAnalysisCore.AICore.GPT
|
namespace VideoAnalysisCore.AICore.GPT
|
||||||
{
|
{
|
||||||
|
|
@ -520,6 +521,7 @@ namespace VideoAnalysisCore.AICore.GPT
|
||||||
""";
|
""";
|
||||||
|
|
||||||
var res = await bset_deepSeekClient.ChatAsync<VideoKnowRes>(taskInfo.Id.ToString(), message, "作业布置识别", ChatGPTType.Deepseek_Chat, 8000);
|
var res = await bset_deepSeekClient.ChatAsync<VideoKnowRes>(taskInfo.Id.ToString(), message, "作业布置识别", ChatGPTType.Deepseek_Chat, 8000);
|
||||||
|
//部分参数 没补全
|
||||||
if (res is null)
|
if (res is null)
|
||||||
return null;
|
return null;
|
||||||
if (!string.Equals(res.Stage, "作业布置", StringComparison.OrdinalIgnoreCase))
|
if (!string.Equals(res.Stage, "作业布置", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|
@ -846,7 +848,14 @@ namespace VideoAnalysisCore.AICore.GPT
|
||||||
}).ToList();
|
}).ToList();
|
||||||
//尝试追加 作业布置分段
|
//尝试追加 作业布置分段
|
||||||
if (homework != null && !questionRes.Any(s => s.Stage == StageEnum.作业布置.ToString()))
|
if (homework != null && !questionRes.Any(s => s.Stage == StageEnum.作业布置.ToString()))
|
||||||
tStage.Add(homework.Adapt<VideoTaskStage>());
|
{
|
||||||
|
var stag = homework.Adapt<VideoTaskStage>();
|
||||||
|
stag.VideoTaskId = taskId;
|
||||||
|
stag.TagId = taskInfo.TagId;
|
||||||
|
stag.Stage = StageEnum.课程总结;
|
||||||
|
stag.CloudSchoolId = taskInfo.CloudSchoolId;
|
||||||
|
tStage.Add(stag);
|
||||||
|
}
|
||||||
await videoTaskStageDB.InsertRangeAsync(tStage);
|
await videoTaskStageDB.InsertRangeAsync(tStage);
|
||||||
await videoKonwPointDB.InsertRangeAsync(insertData);
|
await videoKonwPointDB.InsertRangeAsync(insertData);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,9 @@ namespace VideoAnalysisCore.Common.Expand
|
||||||
// 获取配置文件中的允许跨域的地址
|
// 获取配置文件中的允许跨域的地址
|
||||||
app.UseCors(options =>
|
app.UseCors(options =>
|
||||||
{
|
{
|
||||||
options.WithOrigins("*") // 允许跨域请求的地址
|
options
|
||||||
|
.WithOrigins("*") // 允许跨域请求的地址
|
||||||
|
.AllowAnyOrigin()
|
||||||
.AllowAnyHeader() // 允许的请求标头
|
.AllowAnyHeader() // 允许的请求标头
|
||||||
.AllowAnyMethod(); // 允许跨域请求的类型 (GET,POST等)
|
.AllowAnyMethod(); // 允许跨域请求的类型 (GET,POST等)
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -401,14 +401,14 @@ namespace VideoAnalysisCore.Controllers.Dto
|
||||||
public class VideoTaskStageRes
|
public class VideoTaskStageRes
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 视频封面地址
|
///// 视频封面地址
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public string PreviewUrl { get; set; }
|
//public string PreviewUrl { get; set; }
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 视频地址
|
///// 视频地址
|
||||||
/// </summary>
|
///// </summary>
|
||||||
public string PlayUrl { get; set; }
|
//public string PlayUrl { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// id
|
/// id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -419,10 +419,13 @@ namespace VideoAnalysisCore.Controllers.Dto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long VideoTaskId { get; set; }
|
public long VideoTaskId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义Id [任务视频自定义id]
|
/// 年份
|
||||||
/// <see cref="VideoTask.TagId"/>
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? TagId { get; set; }
|
public string? GradeYear { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 年份
|
||||||
|
/// </summary>
|
||||||
|
public string? GradeId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开始时间
|
/// 开始时间
|
||||||
|
|
@ -443,7 +446,7 @@ namespace VideoAnalysisCore.Controllers.Dto
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 课程阶段
|
/// 课程阶段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual StageEnum? Stage { get; set; }
|
public virtual string? Stage { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 视频所属云校ID
|
/// 视频所属云校ID
|
||||||
/// <para><see cref="UserCenter.Model.CloudSchool"/> 用户中心的云校id</para>
|
/// <para><see cref="UserCenter.Model.CloudSchool"/> 用户中心的云校id</para>
|
||||||
|
|
|
||||||
|
|
@ -353,12 +353,13 @@ namespace VideoAnalysisCore.Controllers
|
||||||
{
|
{
|
||||||
Id = s.Id,
|
Id = s.Id,
|
||||||
VideoTaskId = s.VideoTaskId,
|
VideoTaskId = s.VideoTaskId,
|
||||||
TagId = s.TagId,
|
|
||||||
StartTime = s.StartTime,
|
StartTime = s.StartTime,
|
||||||
EndTime = s.EndTime,
|
EndTime = s.EndTime,
|
||||||
Theme = s.Theme,
|
Theme = s.Theme,
|
||||||
CloudSchoolId = s.CloudSchoolId,
|
CloudSchoolId = s.CloudSchoolId,
|
||||||
Stage=s.Stage,
|
Stage = s.Stage.ToString(),
|
||||||
|
GradeId = s.GradeId.ToString(),
|
||||||
|
GradeYear = s.GradeYear?.ToString(),
|
||||||
//PreviewUrl= videoInfoRes.ContainsKey(s.VideoTaskId.ToString())? videoInfoRes[] :
|
//PreviewUrl= videoInfoRes.ContainsKey(s.VideoTaskId.ToString())? videoInfoRes[] :
|
||||||
KnowPoints = kpDic.ContainsKey(s.Id) ? kpDic[s.Id] : []
|
KnowPoints = kpDic.ContainsKey(s.Id) ? kpDic[s.Id] : []
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
|
|
@ -386,7 +387,8 @@ namespace VideoAnalysisCore.Controllers
|
||||||
var task = await videoTaskDB.GetByIdAsync(videoTaskId);
|
var task = await videoTaskDB.GetByIdAsync(videoTaskId);
|
||||||
if (task is null)
|
if (task is null)
|
||||||
return BadRequest("参数无效");
|
return BadRequest("参数无效");
|
||||||
|
try
|
||||||
|
{
|
||||||
var videoInfo = await vodClient.GetPlayInfoAsync(new GetPlayInfoRequest()
|
var videoInfo = await vodClient.GetPlayInfoAsync(new GetPlayInfoRequest()
|
||||||
{
|
{
|
||||||
VideoId = task.TagId,
|
VideoId = task.TagId,
|
||||||
|
|
@ -396,8 +398,15 @@ namespace VideoAnalysisCore.Controllers
|
||||||
});
|
});
|
||||||
if (videoInfo is null || videoInfo.StatusCode != 200 && !videoInfo.Body.PlayInfoList.PlayInfo.Any())
|
if (videoInfo is null || videoInfo.StatusCode != 200 && !videoInfo.Body.PlayInfoList.PlayInfo.Any())
|
||||||
return BadRequest("获取存储的视频信息失败!");
|
return BadRequest("获取存储的视频信息失败!");
|
||||||
|
|
||||||
return Ok(videoInfo.Body.PlayInfoList.PlayInfo.First().PlayURL);
|
return Ok(videoInfo.Body.PlayInfoList.PlayInfo.First().PlayURL);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
return BadRequest("获取存储的视频信息失败!" + ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue