changes and stuff
This commit is contained in:
@@ -2,26 +2,17 @@ import OpenAI from 'openai';
|
||||
import * as dotenv from 'dotenv';
|
||||
dotenv.config({ path: ['.env.local', '.env'] });
|
||||
|
||||
const AI_PROVIDER = process.env.AI_PROVIDER ?? 'OPENAI';
|
||||
const isGeneric = AI_PROVIDER === 'GENERIC';
|
||||
export const openai = new OpenAI({
|
||||
apiKey: process.env.BEARER_TOKEN,
|
||||
baseURL: process.env.PROVIDER_URL,
|
||||
timeout: 600000, // 10 minutes
|
||||
maxRetries: 3,
|
||||
});
|
||||
|
||||
export const openai = isGeneric
|
||||
? new OpenAI({
|
||||
apiKey: process.env.BEARER_TOKEN,
|
||||
baseURL: process.env.PROVIDER_URL,
|
||||
timeout: 600000, // 10 minutes
|
||||
maxRetries: 3,
|
||||
})
|
||||
: new OpenAI({
|
||||
apiKey: process.env.OPENAI_API_KEY,
|
||||
timeout: 600000, // 10 minutes
|
||||
maxRetries: 3,
|
||||
});
|
||||
|
||||
export const defaultModel = isGeneric ? (process.env.MODEL_NAME ?? 'default') : 'gpt-5.4';
|
||||
export const miniModel = isGeneric ? (process.env.MODEL_NAME ?? 'default') : 'gpt-5.4-mini';
|
||||
export const serviceOptions = isGeneric ? {} : { service_tier: 'flex' as const };
|
||||
export const supportsWebSearch = !isGeneric;
|
||||
export const defaultModel = process.env.MODEL_NAME ?? 'gpt-5.4';
|
||||
export const miniModel = process.env.MODEL_NAME ?? 'gpt-5.4-mini';
|
||||
export const serviceOptions = { service_tier: 'flex' as const };
|
||||
export const supportsWebSearch = true;
|
||||
|
||||
function isJsonParseError(err: unknown): boolean {
|
||||
if (err instanceof SyntaxError) return true;
|
||||
|
||||
Reference in New Issue
Block a user