feat: rename config modelName to model

This commit is contained in:
Simon
2025-10-21 15:13:16 +08:00
parent dc7e09b4ad
commit b6bf6fe06a
3 changed files with 5 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ import {
export interface LLMConfig { export interface LLMConfig {
baseURL?: string baseURL?: string
apiKey?: string apiKey?: string
modelName?: string model?: string
temperature?: number temperature?: number
maxTokens?: number maxTokens?: number
maxRetries?: number maxRetries?: number
@@ -30,7 +30,7 @@ export function parseLLMConfig(config: LLMConfig): Required<LLMConfig> {
return { return {
baseURL: config.baseURL ?? DEFAULT_BASE_URL, baseURL: config.baseURL ?? DEFAULT_BASE_URL,
apiKey: config.apiKey ?? DEFAULT_API_KEY, apiKey: config.apiKey ?? DEFAULT_API_KEY,
modelName: config.modelName ?? DEFAULT_MODEL_NAME, model: config.model ?? DEFAULT_MODEL_NAME,
temperature: config.temperature ?? DEFAULT_TEMPERATURE, temperature: config.temperature ?? DEFAULT_TEMPERATURE,
maxTokens: config.maxTokens ?? DEFAULT_MAX_TOKENS, maxTokens: config.maxTokens ?? DEFAULT_MAX_TOKENS,
maxRetries: config.maxRetries ?? LLM_MAX_RETRIES, maxRetries: config.maxRetries ?? LLM_MAX_RETRIES,

View File

@@ -19,9 +19,9 @@ console.log('🚀 page-agent.js loaded!')
const currentScript = document.currentScript as HTMLScriptElement | null const currentScript = document.currentScript as HTMLScriptElement | null
if (currentScript) { if (currentScript) {
const url = new URL(currentScript.src) 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 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) window.pageAgent = new PageAgent(config)
} else { } else {
window.pageAgent = new PageAgent() window.pageAgent = new PageAgent()

View File

@@ -55,7 +55,7 @@ export class LLM {
// Default to OpenAI client // Default to OpenAI client
this.client = new OpenAIClient({ this.client = new OpenAIClient({
model: this.config.modelName, model: this.config.model,
apiKey: this.config.apiKey, apiKey: this.config.apiKey,
baseURL: this.config.baseURL, baseURL: this.config.baseURL,
temperature: this.config.temperature, temperature: this.config.temperature,