优化 AI模型使用的方法

This commit is contained in:
小肥羊 2026-02-12 17:28:39 +08:00
parent 0de07e733a
commit 2acc0d4239
4 changed files with 10 additions and 7 deletions

View File

@ -52,7 +52,7 @@
"ChatGpt": { "ChatGpt": {
//"Host": "https://api.g4f.icu/", //"Host": "https://api.g4f.icu/",
"Host": "https://api.oaibest.com/", "Host": "https://api.oaibest.com/",
"ApiKey": "sk-D15tBln31N7dI9Fi7lds7OySFv5tOEK7DMNsG5rY2E6DCr4s", "ApiKey": "sk-uuCt3AZHawc9B543Yq5bxluO8aW35ArCY5fFnkh2LaJpFYA7",
"Path": "v1/chat/completions" "Path": "v1/chat/completions"
}, },
"DeepSeek": { "DeepSeek": {

View File

@ -14,9 +14,10 @@ namespace VideoAnalysisCore.AICore.GPT
public const string Deepseek_Reasoner = "deepseek-reasoner"; public const string Deepseek_Reasoner = "deepseek-reasoner";
public const string Deepseek_Chat = "deepseek-chat"; public const string Deepseek_Chat = "deepseek-chat";
//渠道限制没有并发
public const string Gemini_3_Chat_thinking = "gemini-3-pro-preview-thinking"; //public const string Gemini_3_Chat_thinking = "gemini-3-pro-preview-thinking";
public const string Gemini_3_Chat = "gemini-3-pro-preview"; public const string Gemini_3_Chat = "gemini-3-pro-preview";
public const string Gemini_3_Chat_flash = "gemini-3-flash-preview";
} }

View File

@ -189,8 +189,7 @@ namespace VideoAnalysisCore.AICore.GPT
$"字幕列表 {rCaptionArr}。" + $"字幕列表 {rCaptionArr}。" +
$"输出格式 json字符串 对象格式{fileNameResFormat}"; $"输出格式 json字符串 对象格式{fileNameResFormat}";
var task = taskInfo.Id.ToString(); var task = taskInfo.Id.ToString();
var fileNameInfoRes = await geminiClient.ChatAsync<FileNameInfo> var fileNameInfoRes = await geminiClient.ChatAsync<FileNameInfo>(task, fileNamePostMessages, "授课章节");
(task, fileNamePostMessages, "授课章节");
taskInfo.Sections = fileNameInfoRes.; taskInfo.Sections = fileNameInfoRes.;
await videoTaskDB.AsUpdateable() await videoTaskDB.AsUpdateable()
.SetColumns(it => it.Sections == fileNameInfoRes.) .SetColumns(it => it.Sections == fileNameInfoRes.)
@ -426,7 +425,7 @@ namespace VideoAnalysisCore.AICore.GPT
"""; """;
await redisManager.AddTaskLog(taskInfo.Id, $"开始分析视频内容 {tryCount}"); await redisManager.AddTaskLog(taskInfo.Id, $"开始分析视频内容 {tryCount}");
var res = await geminiClient.ChatAsync<List<VideoKnowRes>>(taskInfo.Id.ToString(), postMessages, "分析字幕", ChatGPTType.Gemini_3_Chat_thinking); var res = await geminiClient.ChatAsync<List<VideoKnowRes>>(taskInfo.Id.ToString(), postMessages, "分析字幕", ChatGPTType.Gemini_3_Chat);
return res; return res;
} }
catch (Exception ex) catch (Exception ex)
@ -569,6 +568,8 @@ namespace VideoAnalysisCore.AICore.GPT
/// <returns></returns> /// <returns></returns>
private async Task<SenseVoiceRes[]> AnalysisVideoQuestions(VideoTask taskInfo, List<KnowledgeInfo> knowledgeInfos) private async Task<SenseVoiceRes[]> AnalysisVideoQuestions(VideoTask taskInfo, List<KnowledgeInfo> knowledgeInfos)
{ {
await redisManager.AddTaskLog(taskInfo.Id, $"==>提取试题功能已禁用");
return null;
await redisManager.AddTaskLog(taskInfo.Id, $"==>{taskInfo.Id} 提取试题"); await redisManager.AddTaskLog(taskInfo.Id, $"==>{taskInfo.Id} 提取试题");
if (taskInfo is null || string.IsNullOrEmpty(taskInfo.PPTKeyFrame)) if (taskInfo is null || string.IsNullOrEmpty(taskInfo.PPTKeyFrame))
return null; return null;
@ -700,6 +701,7 @@ namespace VideoAnalysisCore.AICore.GPT
/// <returns></returns> /// <returns></returns>
public async Task<TaskRes> GetKnow(string task) public async Task<TaskRes> GetKnow(string task)
{ {
var taskId = long.Parse(task); var taskId = long.Parse(task);
var taskInfo = await videoTaskDB.AsQueryable() var taskInfo = await videoTaskDB.AsQueryable()
.Where(s => s.Id == taskId) .Where(s => s.Id == taskId)

View File

@ -46,7 +46,7 @@ namespace VideoAnalysisCore.AICore.GPT.Gemini
Message[] messageArr = [ Message[] messageArr = [
new Message(postMessages,"user"), new Message(postMessages,"user"),
]; ];
model = model ?? ChatGPTType.Gemini_3_Chat; model = model ?? ChatGPTType.Gemini_3_Chat_flash;
messageArr = messageArr.Where(s => s != null).ToArray(); messageArr = messageArr.Where(s => s != null).ToArray();
var chatReq = new ChatRequest var chatReq = new ChatRequest
{ {