优化 ai分析试题提示词

优化 视频预览ui
This commit is contained in:
小肥羊 2025-06-05 18:19:26 +08:00
parent 02518a1c4f
commit d433d84d46
7 changed files with 121 additions and 44 deletions

View File

@ -11,19 +11,24 @@
@for (int i = 0; i < videoKnows.Length; i++)
{
var item = videoKnows[i];
<div class="knowDiv" onclick="spClick(@i,this)">
<div class="knowDiv">
<div class="knowTtile">
<div class="knowTtileTheme">@getF(item) @item.Theme</div>
<span class="kSpan">#@item.KnowPointId @item.KnowPoint</span>
<div style="cursor: pointer" onclick="spClick(@i,this)">
<div class="knowTtileTheme">@getF(item) @item.Theme</div>
<span class="kSpan">#@item.KnowPointId @item.KnowPoint</span>
</div>
<div>概览: @item.Content</div>
<br />
@foreach (var q in item.QuestionArr)
{
<h3>问题: </h3>
<div class="knowQuestion">@q.Question</div>
<img style="text-align:center" src="@q.ImageUrl" width="320" height="180" />
<br />
<div class="knowQuestion" onclick="spClickTime(@q.StartTime)">
<h3>问题: <span class="kSpan">@q.StartTime 秒</span></h3>
<div class="kSpan">@q.TopicStem</div>
<div >@q.Question</div>
<img style="text-align:center" src="@q.ImageUrl" width="320" height="180" />
</div>
<br />
}
<br />
@ -112,6 +117,9 @@
function spClick(i, button) {
videoPlayer.currentTime = displayButton[i].startTime;
}
function spClickTime(startTime) {
videoPlayer.currentTime = startTime;
}
function gd(btn) {
let e = btn.parentElement.parentElement
if (e.style.right == "0px") {

View File

@ -11,20 +11,24 @@
float: left;
overflow-x: hidden;
}
.kSpan {
color: rgba(120, 120, 120,0.66);
font-size: 0.8rem;
width: 330px;
}
.textEllipsis {
white-space: nowrap; /* 禁止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 显示省略号 */
}
video {
width: 94%;
height: 85%;
}
.gudingBtn {
width: 32px;
height: 32px;
@ -32,6 +36,7 @@ video {
line-height: 27px;
text-align: center;
}
.subtitles {
position: absolute;
bottom: 200px;
@ -41,9 +46,11 @@ video {
background-color: rgba(0, 0, 0, 0.7);
font-size: 18px;
}
#segmentsContainer:is(:hover) {
right: 0px!important;
right: 0px !important;
}
#segmentsContainer {
transition: right 0.7s;
z-index: 999;
@ -62,7 +69,7 @@ video {
padding: 10px;
align-content: flex-start;
justify-content: flex-start;
align-items: flex-end
align-items: center;
}
.kBtn {
@ -75,8 +82,9 @@ video {
background-color: rgb(240, 249, 235);
border: 1px solid rgb(179, 225, 157);
}
.knowTtileTheme {
font-size: 1.3rem;
font-size: 1.3rem;
cursor: pointer;
color: rgb(103, 194, 58);
}
@ -85,20 +93,26 @@ video {
background-color: rgb(248, 230, 191) !important;
border: 1px solid rgb(206, 187, 81);
}
.knowDiv {
cursor: pointer;
}
.knowQuestion {
cursor: pointer;
border: 2px solid #ff000059;
border-radius: 10px;
background-color: #cddc393d;
}
.knowDiv:hover .knowTtile {
width: 340px;
display:block;
background-color: rgb(240, 249, 235);
border: 1px solid rgb(179, 225, 157);
}
.knowDiv:hover .knowTtile {
width: 340px;
display: block;
background-color: rgb(240, 249, 235);
border: 1px solid rgb(179, 225, 157);
}
.knowTtile {
position: absolute;
text-align: left;
display: none;
}
}

View File

@ -15,6 +15,8 @@ using Microsoft.AspNetCore.Mvc.Formatters;
using System.Security.Cryptography;
using System.Diagnostics;
using VideoAnalysisCore.AICore.FFMPGE;
using System.Text.Encodings.Web;
using System.Text.Unicode;
@ -39,7 +41,11 @@ namespace Learn.VideoAnalysis
loggingBuilder.SetMinimumLevel(LogLevel.Warning); // 设置最小日志级别为 Warning
});
builder.Services.AddControllers();
builder.Services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create(UnicodeRanges.All);
});
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>

View File

@ -410,36 +410,46 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
Console.WriteLine(DateTime.Now + $"=>{taskInfo.Id} 提取{knowInfoArr.First().StartTime}秒试题的试题内容");
Console.WriteLine( sRes.Result.res.value);
var knowArr=JsonSerializer.Serialize(knowInfoArr.Select(s => new { s.KnowPointId, s.KnowPoint }));
var resFormat = """[{"TopicStem":string(试题题干),"Question:string()","KnowPointId":(string)知识点ID}]""";
var resFormat = """[{"Type":string(试题类型),"TopicStem":string(试题题干),"QuestionArr":[{"Question":string(子问题),"KnowPointId":(string)知识点ID}]}]""";
var postMessages =
$"我将提供一段内容是md格式的试题内容字符串。" +
$"请提取出其中的试题内容以及每个试题的问题。并且为每个试题关联上在我限定范围内的知识点(多个则用逗号分割)。" +
$"请提取出其中的试题内容试,题干以及每个试题的问题。并且为每个试题关联上在我限定范围内的知识点(多个则用逗号分割)。" +
$"知识点格式(json格式)范围[{knowArr}]。" +
$"排除不是试题内容的文字,优化公式排版并且去除题号。" +
$"如果存在多道题(或者小问),则需要拆分成为多个试题对象!" +
$"排除不是试题内容的文字,优化公式排版并且去除题号,但不要修改latex数学公式。" +
$"如果存在多道题,则需要拆分成为多个试题对象!" +
$"试题的类型约束在 填空题/判断题/选择题/解答题 范围内。" +
$"请检查我提供的字符串内容,如不包含问题试题则返回`[]`" +
$"输出内容只返回json格式为({resFormat})" +
$"以下是试题内容" +
$"`{sRes.Result.res.value}`";
var resData = await ChatAsync<VideoQuestionOSSDto[]>(taskInfo.Id.ToString(), postMessages, "提取试题", "deepseek-chat");
foreach (var q in resData)
{
q.Id = YitIdHelper.NextId();
q.FilePath = filePath;
q.VideoTaskId = taskInfo.Id;
q.StageId = knowInfoArr.First().StageId;
foreach (var kid in q.KnowPointId.Split(","))
var TopicId = YitIdHelper.NextId();
foreach (var qt in q.QuestionArr)
{
insertQuestionKonw.Add(new VideoQuestionKonw()
var vq = q.Adapt<VideoQuestionOSSDto>();
vq.Id = YitIdHelper.NextId();
vq.StartTime = item;
vq.FilePath = filePath;
vq.VideoTaskId = taskInfo.Id;
vq.StageId = knowInfoArr.First().StageId;
vq.Question = qt.Question;
vq.TopicId = TopicId;
insertData.Add(vq);
foreach (var kid in qt.KnowPointId.Split(","))
{
KnowPoint = knowInfoArr.First(s => s.KnowPointId == kid).KnowPoint,
KnowPointId= kid,
StageId =q.StageId,
VideoTaskId = q.VideoTaskId,
VideoQuestionId = q.Id,
});
insertQuestionKonw.Add(new VideoQuestionKonw()
{
KnowPoint = knowInfoArr.First(s => s.KnowPointId == kid).KnowPoint,
KnowPointId = kid,
StageId = q.StageId,
VideoTaskId = q.VideoTaskId,
VideoQuestionId = q.Id,
});
}
}
}
insertData.AddRange(resData);
break;
}
catch (Exception ex)
@ -448,13 +458,6 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
}
}
}
//分组共同题干试题ID
foreach (var item in insertData.GroupBy(x => x.TopicStem))
{
var keyId=YitIdHelper.NextId();
foreach (var s in item)
s.TopicId = keyId;
}
//上传oss 并更新imageUrl
ossClient.AddVideoQuestionUrl(insertData);

View File

@ -15,6 +15,7 @@ using VideoAnalysisCore.Model;
using Microsoft.AspNetCore.Http;
using VideoAnalysisCore.Model.Dto;
using VideoAnalysisCore.Controllers.Dto;
using VideoAnalysisCore.Common.Expand;
namespace VideoAnalysisCore.Controllers
{
@ -44,6 +45,29 @@ namespace VideoAnalysisCore.Controllers
throw new Exception("未能获取到客户端ip地址");
}
#if DEBUG
/// <summary>
/// ³õʼ»¯Ö÷¿â±í
/// </summary>
/// <param name="url">ÎļþÁ÷</param>
/// <returns></returns>
[HttpGet(Name = "InitDbTable")]
public IActionResult InitDbTable()
{
var b = AppCommon.Config.DB.UpdateTable;
AppCommon.Config.DB.UpdateTable= true;
SqlSugarExpand.InitDbTable();
AppCommon.Config.DB.UpdateTable = b;
return Ok();
}
#endif
/// <summary>
/// 语音识别
/// </summary>

View File

@ -1,4 +1,5 @@
using System;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -6,9 +7,26 @@ using System.Threading.Tasks;
namespace VideoAnalysisCore.Model.Dto
{
public class AIQuestionDto
{
/// <summary>
/// 问题
/// </summary>
public string Question { get; set; }
/// <summary>
/// 知识点id
/// </summary>
public string KnowPointId { get; set; }
}
public class VideoQuestionOSSDto: VideoQuestion
{
/// <summary>
/// 问题
/// </summary>
public AIQuestionDto[]? QuestionArr { get; set; }
public string FilePath { get; set; }
public string Type { get; set; }
public string KnowPointId { get; set; }
}
public class VideoQuestionShowDto : VideoQuestion

View File

@ -52,5 +52,9 @@ namespace VideoAnalysisCore.Model
/// 问题(设问)
/// </summary>
public string? Question { get; set; }
/// <summary>
/// 试题开始时间
/// </summary>
public int StartTime { get; set; }
}
}