diff --git a/src/api/providers/pearai.ts b/src/api/providers/pearai.ts index 0379288bd5a..aa2bac09835 100644 --- a/src/api/providers/pearai.ts +++ b/src/api/providers/pearai.ts @@ -5,6 +5,7 @@ import { DeepSeekHandler } from "./deepseek" import Anthropic from "@anthropic-ai/sdk" import { BaseProvider } from "./base-provider" import { SingleCompletionHandler } from "../" +import { OpenRouterHandler } from "./openrouter" interface PearAiModelsResponse { models: { @@ -17,7 +18,7 @@ interface PearAiModelsResponse { } export class PearAiHandler extends BaseProvider implements SingleCompletionHandler { - private handler!: AnthropicHandler | DeepSeekHandler + private handler!: AnthropicHandler | DeepSeekHandler | OpenRouterHandler constructor(options: ApiHandlerOptions) { super() @@ -36,12 +37,11 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl throw new Error("PearAI API key not found. Please login to PearAI.") } - // Initialize with a default handler synchronously - this.handler = new AnthropicHandler({ + this.handler = new OpenRouterHandler({ ...options, - apiKey: options.pearaiApiKey, - anthropicBaseUrl: PEARAI_URL, - apiModelId: "claude-3-5-sonnet-20241022", + openRouterBaseUrl: PEARAI_URL, + openRouterApiKey: options.pearaiApiKey, + openRouterModelId: "deepseek/deepseek-chat-v3-0324", }) // Then try to initialize the correct handler asynchronously @@ -63,11 +63,11 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl const underlyingModel = data.models[modelId]?.underlyingModel || "claude-3-5-sonnet-20241022" console.dir(underlyingModel) if (underlyingModel.startsWith("deepseek")) { - this.handler = new DeepSeekHandler({ + this.handler = new OpenRouterHandler({ ...options, - deepSeekApiKey: options.pearaiApiKey, - deepSeekBaseUrl: PEARAI_URL, - apiModelId: underlyingModel, + openRouterBaseUrl: PEARAI_URL, + openRouterApiKey: options.pearaiApiKey, + openRouterModelId: underlyingModel, }) } else { // Default to Claude @@ -95,10 +95,11 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl anthropicBaseUrl: PEARAI_URL, }) } else if (modelId.startsWith("deepseek")) { - this.handler = new DeepSeekHandler({ + this.handler = new OpenRouterHandler({ ...options, - deepSeekApiKey: options.pearaiApiKey, - deepSeekBaseUrl: PEARAI_URL, + openRouterBaseUrl: PEARAI_URL, + openRouterApiKey: options.pearaiApiKey, + openRouterModelId: modelId, }) } else { throw new Error(`Unsupported model: ${modelId}`) diff --git a/src/core/Cline.ts b/src/core/Cline.ts index b7bfc021183..21ad1ae0a85 100644 --- a/src/core/Cline.ts +++ b/src/core/Cline.ts @@ -582,7 +582,7 @@ export class Cline extends EventEmitter { async sayAndCreateMissingParamError(toolName: ToolUseName, paramName: string, relPath?: string) { await this.say( "error", - `Roo tried to use ${toolName}${ + `Agent tried to use ${toolName}${ relPath ? ` for '${relPath.toPosix()}'` : "" } without value for required parameter '${paramName}'. Retrying...`, ) @@ -2750,7 +2750,7 @@ export class Cline extends EventEmitter { this.consecutiveMistakeCount++ await this.say( "error", - `Roo tried to use ${tool_name} with an invalid JSON argument. Retrying...`, + `Agent tried to use ${tool_name} with an invalid JSON argument. Retrying...`, ) pushToolResult( formatResponse.toolError(