From 5ba08c632d2a5bd3b3f0237b9d96074d0cfd721e Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Thu, 22 May 2025 10:54:14 +0800 Subject: [PATCH] chore: read model name from env --- translate.openai.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translate.openai.mjs b/translate.openai.mjs index 8dbed6cafcd..42c50fa5d79 100644 --- a/translate.openai.mjs +++ b/translate.openai.mjs @@ -5,7 +5,7 @@ import picocolors from 'picocolors'; import { sampleInput, sampleTranslations } from './translate.samples.mjs'; import { asIsTerms, patterns, terms } from './translate.terms.mjs'; -const model = 'gpt-4.1'; +const getModel = () => process.env.OPENAI_MODEL_NAME || 'gpt-4.1'; /** @type {typeof console.log} */ export const log = (...args) => { @@ -98,7 +98,7 @@ export class OpenAiTranslate { } const stream = await this.openai.chat.completions.create({ - model, + model: getModel(), messages: [ { role: 'system',