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