This commit is contained in:
Thibault Sottiaux
2025-04-16 10:32:45 -07:00
committed by GitHub
parent 8794df3c08
commit 1b40e19baf
2 changed files with 8 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
import { OPENAI_API_KEY } from "./config";
import OpenAI from "openai";
const MODEL_LIST_TIMEOUT_MS = 2_000; // 2 seconds
export const RECOMMENDED_MODELS: Array<string> = ["o4-mini", "o3"];
/**
@@ -14,9 +15,9 @@ export const RECOMMENDED_MODELS: Array<string> = ["o4-mini", "o3"];
let modelsPromise: Promise<Array<string>> | null = null;
async function fetchModels(): Promise<Array<string>> {
// If the user has not configured an API key we cannot hit the network
// If the user has not configured an API key we cannot hit the network.
if (!OPENAI_API_KEY) {
return ["o4-mini"];
return RECOMMENDED_MODELS;
}
try {
@@ -67,8 +68,6 @@ export async function isModelSupportedForResponses(
return true;
}
const MODEL_LIST_TIMEOUT_MS = 2_000;
try {
const models = await Promise.race<Array<string>>([
getAvailableModels(),