From 42becf154a1a645d57d4d223297a96ea95f59866 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com>
Date: Fri, 7 Nov 2025 15:39:54 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20AI=E5=88=86=E6=9E=90?=
=?UTF-8?q?=E8=B6=85=E6=97=B6=E6=83=85=E5=86=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
VideoAnalysisCore/AICore/GPT/BserGPT.cs | 3 ++-
VideoAnalysisCore/AICore/GPT/ChatGPT/ChatGPTClient.cs | 3 ++-
VideoAnalysisCore/AICore/GPT/GPTClient.cs | 9 ++++++---
VideoAnalysisCore/Model/Enum/AttachmentsInfoType.cs | 4 +++-
4 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/VideoAnalysisCore/AICore/GPT/BserGPT.cs b/VideoAnalysisCore/AICore/GPT/BserGPT.cs
index 97957fa..48db489 100644
--- a/VideoAnalysisCore/AICore/GPT/BserGPT.cs
+++ b/VideoAnalysisCore/AICore/GPT/BserGPT.cs
@@ -10,6 +10,7 @@ using Whisper.net;
using Microsoft.Extensions.DependencyInjection;
using VideoAnalysisCore.AICore.GPT.ChatGPT;
using VideoAnalysisCore.AICore.GPT.DeepSeek;
+using System.Text.Json.Serialization;
namespace VideoAnalysisCore.AICore.GPT
{
@@ -51,7 +52,7 @@ namespace VideoAnalysisCore.AICore.GPT
/// 此功能处于 Beta 阶段。 如果指定,我们的系统将尽最大努力确定性地采样,这样具有相同 and 参数的重复请求应该返回相同的结果。 无法保证确定性,您应该参考 response 参数来监控后端的变化
///
public int? seed { get; set; } = null;
- [json]
+ [JsonIgnore]
public string? title { get; set; } = null;
///
/// 推理模型 (deepseek-reasoner)
diff --git a/VideoAnalysisCore/AICore/GPT/ChatGPT/ChatGPTClient.cs b/VideoAnalysisCore/AICore/GPT/ChatGPT/ChatGPTClient.cs
index 4f82c08..261eacc 100644
--- a/VideoAnalysisCore/AICore/GPT/ChatGPT/ChatGPTClient.cs
+++ b/VideoAnalysisCore/AICore/GPT/ChatGPT/ChatGPTClient.cs
@@ -46,12 +46,13 @@ namespace VideoAnalysisCore.AICore.GPT.ChatGPT
Message[] messageArr = [
new Message(postMessages,"user"),
];
+ model = model ?? ChatGPTType.GPT5_mini;
messageArr = messageArr.Where(s => s != null).ToArray();
var chatReq = new ChatRequest
{
taskId = task,
model = model,
- max_tokens = model == "deepseek-reasoner" ? 16000 : 8000,
+ max_tokens =8000,
stream = true,
temperature = 0.2f,
messages = messageArr
diff --git a/VideoAnalysisCore/AICore/GPT/GPTClient.cs b/VideoAnalysisCore/AICore/GPT/GPTClient.cs
index d35326a..36a8da0 100644
--- a/VideoAnalysisCore/AICore/GPT/GPTClient.cs
+++ b/VideoAnalysisCore/AICore/GPT/GPTClient.cs
@@ -86,14 +86,17 @@ namespace VideoAnalysisCore.AICore.GPT
var messageBuilder1 = new StringBuilder();
var lastChat = new ChatResSSE();
var splitCount = "data:".Length;
- var maxLoop = 60 * 100000;
+ var maxLoop = 50 * 200;
int threshold = 0;
- while (maxLoop > 0)
+ var startTime= DateTime.Now;
+ var endTime = startTime.AddHours(1.5);
+ //最长分析分析时间1.5小时 或者重试读取 1w次
+ while (maxLoop > 0 && DateTime.Now < endTime)
{
line = reader.ReadLine();
if (line is null || string.IsNullOrEmpty(line) || line.StartsWith(": keep-alive"))
{
- Thread.Sleep(10);
+ Thread.Sleep(50);
maxLoop--;
continue;
}
diff --git a/VideoAnalysisCore/Model/Enum/AttachmentsInfoType.cs b/VideoAnalysisCore/Model/Enum/AttachmentsInfoType.cs
index 1893914..939687b 100644
--- a/VideoAnalysisCore/Model/Enum/AttachmentsInfoType.cs
+++ b/VideoAnalysisCore/Model/Enum/AttachmentsInfoType.cs
@@ -26,7 +26,9 @@ namespace VideoAnalysisCore.Model.Enum
[Description("班会")]
班会 = 5,
[Description("其他资料")]
- 其他资料 = 7
+ 其他资料 = 7,
+ [Description("教研")]
+ 教研 = 8
}
}