chore: parse config method

This commit is contained in:
Simon
2025-10-10 17:46:40 +08:00
parent abe58e5950
commit 3415e0bc3b
3 changed files with 15 additions and 16 deletions

View File

@@ -2,9 +2,20 @@ import type { DomConfig } from '@/dom'
import type { SupportedLanguage } from '@/i18n'
import type { LLMConfig } from '@/llms'
import { DEFAULT_API_KEY, DEFAULT_BASE_URL, DEFAULT_MODEL_NAME, LLM_MAX_RETRIES } from './constants'
export interface UIConfig {
// theme?: 'light' | 'dark'
language?: SupportedLanguage
}
export type PageAgentConfig = LLMConfig & DomConfig & UIConfig
export function parseLLMConfig(config: LLMConfig): Required<LLMConfig> {
return {
baseURL: config.baseURL ?? DEFAULT_BASE_URL,
apiKey: config.apiKey ?? DEFAULT_API_KEY,
modelName: config.modelName ?? DEFAULT_MODEL_NAME,
maxRetries: config.maxRetries ?? LLM_MAX_RETRIES,
}
}