From 17befe4bab95140f9baca24ddd1b071bfedbf0c7 Mon Sep 17 00:00:00 2001 From: Simon <10131203+gaomeng1900@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:37:09 +0800 Subject: [PATCH] refactor: unify LLM configuration types --- packages/llms/src/OpenAIClient.ts | 6 +++--- packages/llms/src/OpenAILenientClient.ts | 13 +++---------- packages/llms/src/types.ts | 14 +------------- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/packages/llms/src/OpenAIClient.ts b/packages/llms/src/OpenAIClient.ts index 927e11c..67e7de2 100644 --- a/packages/llms/src/OpenAIClient.ts +++ b/packages/llms/src/OpenAIClient.ts @@ -4,16 +4,16 @@ * @note Use OpenAILenientClient instead. */ import { InvokeError, InvokeErrorType } from './errors' -import type { InvokeResult, LLMClient, Message, OpenAIClientConfig, Tool } from './types' +import type { InvokeResult, LLMClient, LLMConfig, Message, Tool } from './types' import { modelPatch, zodToOpenAITool } from './utils' /** * @deprecated Use OpenAILenientClient instead. */ export class OpenAIClient implements LLMClient { - config: OpenAIClientConfig + config: LLMConfig - constructor(config: OpenAIClientConfig) { + constructor(config: LLMConfig) { this.config = config } diff --git a/packages/llms/src/OpenAILenientClient.ts b/packages/llms/src/OpenAILenientClient.ts index a0e2761..64c723d 100644 --- a/packages/llms/src/OpenAILenientClient.ts +++ b/packages/llms/src/OpenAILenientClient.ts @@ -2,20 +2,13 @@ * OpenAI Client implementation */ import { InvokeError, InvokeErrorType } from './errors' -import type { - InvokeResult, - LLMClient, - MacroToolInput, - Message, - OpenAIClientConfig, - Tool, -} from './types' +import type { InvokeResult, LLMClient, LLMConfig, MacroToolInput, Message, Tool } from './types' import { lenientParseMacroToolCall, modelPatch, zodToOpenAITool } from './utils' export class OpenAIClient implements LLMClient { - config: OpenAIClientConfig + config: LLMConfig - constructor(config: OpenAIClientConfig) { + constructor(config: LLMConfig) { this.config = config } diff --git a/packages/llms/src/types.ts b/packages/llms/src/types.ts index d219e70..d978417 100644 --- a/packages/llms/src/types.ts +++ b/packages/llms/src/types.ts @@ -65,19 +65,7 @@ export interface InvokeResult { } /** - * OpenAI Client config - */ -export interface OpenAIClientConfig { - model: string - apiKey: string - baseURL: string - temperature?: number - maxTokens?: number - maxRetries?: number -} - -/** - * LLM configuration for PageAgent + * LLM configuration */ export interface LLMConfig { baseURL?: string