Bläddra i källkod

Merge pull request #6457 from ACTOR-ALCHEMIST/main

Support OpenAI o3 and o4-mini
RiverRay 7 månader sedan
förälder
incheckning
3809375694
2 ändrade filer med 7 tillägg och 2 borttagningar
  1. 3 2
      app/client/platforms/openai.ts
  2. 4 0
      app/constant.ts

+ 3 - 2
app/client/platforms/openai.ts

@@ -198,7 +198,8 @@ export class ChatGPTApi implements LLMApi {
     const isDalle3 = _isDalle3(options.config.model);
     const isO1OrO3 =
       options.config.model.startsWith("o1") ||
-      options.config.model.startsWith("o3");
+      options.config.model.startsWith("o3") ||
+      options.config.model.startsWith("o4-mini");
     if (isDalle3) {
       const prompt = getMessageTextContent(
         options.messages.slice(-1)?.pop() as any,
@@ -243,7 +244,7 @@ export class ChatGPTApi implements LLMApi {
       }
 
       // add max_tokens to vision model
-      if (visionModel) {
+      if (visionModel && !isO1OrO3) {
         requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
       }
     }

+ 4 - 0
app/constant.ts

@@ -478,6 +478,8 @@ export const VISION_MODEL_REGEXES = [
   /^dall-e-3$/, // Matches exactly "dall-e-3"
   /glm-4v/,
   /vl/i,
+  /o3/,
+  /o4-mini/,
 ];
 
 export const EXCLUDE_VISION_MODEL_REGEXES = [/claude-3-5-haiku-20241022/];
@@ -516,6 +518,8 @@ const openaiModels = [
   "o1-mini",
   "o1-preview",
   "o3-mini",
+  "o3",
+  "o4-mini",
 ];
 
 const googleModels = [