From b6bf6fe06ab0474ca64868acee9b301689b8ebcf Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Tue, 21 Oct 2025 15:13:16 +0800 Subject: [PATCH] feat: rename config modelName to model --- src/config/index.ts | 4 ++-- src/entry.ts | 4 ++-- src/llms/index.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/config/index.ts b/src/config/index.ts index c17333a..d2fb6a6 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -13,7 +13,7 @@ import { export interface LLMConfig { baseURL?: string apiKey?: string - modelName?: string + model?: string temperature?: number maxTokens?: number maxRetries?: number @@ -30,7 +30,7 @@ export function parseLLMConfig(config: LLMConfig): Required { return { baseURL: config.baseURL ?? DEFAULT_BASE_URL, apiKey: config.apiKey ?? DEFAULT_API_KEY, - modelName: config.modelName ?? DEFAULT_MODEL_NAME, + model: config.model ?? DEFAULT_MODEL_NAME, temperature: config.temperature ?? DEFAULT_TEMPERATURE, maxTokens: config.maxTokens ?? DEFAULT_MAX_TOKENS, maxRetries: config.maxRetries ?? LLM_MAX_RETRIES, diff --git a/src/entry.ts b/src/entry.ts index c771685..79a484b 100644 --- a/src/entry.ts +++ b/src/entry.ts @@ -19,9 +19,9 @@ console.log('🚀 page-agent.js loaded!') const currentScript = document.currentScript as HTMLScriptElement | null if (currentScript) { const url = new URL(currentScript.src) - const modelName = url.searchParams.get('model') + const model = url.searchParams.get('model') const language = (url.searchParams.get('lang') as 'zh-CN' | 'en-US') || 'zh-CN' - const config = { modelName, language } as PageAgentConfig + const config = { model, language } as PageAgentConfig window.pageAgent = new PageAgent(config) } else { window.pageAgent = new PageAgent() diff --git a/src/llms/index.ts b/src/llms/index.ts index 3ba7a62..eb38ddf 100644 --- a/src/llms/index.ts +++ b/src/llms/index.ts @@ -55,7 +55,7 @@ export class LLM { // Default to OpenAI client this.client = new OpenAIClient({ - model: this.config.modelName, + model: this.config.model, apiKey: this.config.apiKey, baseURL: this.config.baseURL, temperature: this.config.temperature,