using VideoAnalysisCore.Common; using System.Net.Http.Headers; using System.Text; using Microsoft.Extensions.Logging; using Newtonsoft.Json.Linq; using System.Net.Http; using Newtonsoft.Json; using System.Net.Http.Json; using System.Net; using VideoAnalysisCore.AICore.GPT.DeepSeek; using VideoAnalysisCore.AICore.GPT; using System.Text.Json; namespace VideoAnalysisCore.AICore.GPT.ChatGPT { /// /// 接入oaibest /// public class BestAIClient : GPTClient { public override GptConfig Config { get; set; } = AppCommon.Config.ChatGpt.ChatGpt; private readonly IHttpClientFactory _httpClientFactory; private readonly RedisManager redisManager; public BestAIClient(IHttpClientFactory httpClientFactory, RedisManager redisManager) : base(httpClientFactory, redisManager) { _httpClientFactory = httpClientFactory; this.redisManager = redisManager; } /// /// 请求AI /// /// 返回JSON类型 /// 任务id /// 提示词 /// 任务类型 /// GPT版本 /// 最大token 不设置默认最大值 16000/8000 /// /// public async Task ChatAsync(string task, string postMessages, string title, string model = null, int max_tokens = 8000) { 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, title = title, max_tokens =8000, stream = true, temperature = 0.2f, messages = messageArr }; chatReq.modalities = null; chatReq.max_tokens = null; chatReq.top_p = null; return await base.ChatAsync(chatReq); } } }