Skip to content

Commit b40e406

Browse files
committed
Working
1 parent 7150202 commit b40e406

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

src/api/providers/pearai.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { DeepSeekHandler } from "./deepseek"
55
import Anthropic from "@anthropic-ai/sdk"
66
import { BaseProvider } from "./base-provider"
77
import { SingleCompletionHandler } from "../"
8+
import { OpenRouterHandler } from "./openrouter"
89

910
interface PearAiModelsResponse {
1011
models: {
@@ -17,7 +18,7 @@ interface PearAiModelsResponse {
1718
}
1819

1920
export class PearAiHandler extends BaseProvider implements SingleCompletionHandler {
20-
private handler!: AnthropicHandler | DeepSeekHandler
21+
private handler!: AnthropicHandler | DeepSeekHandler | OpenRouterHandler
2122

2223
constructor(options: ApiHandlerOptions) {
2324
super()
@@ -36,12 +37,19 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
3637
throw new Error("PearAI API key not found. Please login to PearAI.")
3738
}
3839

39-
// Initialize with a default handler synchronously
40-
this.handler = new AnthropicHandler({
40+
// // Initialize with a default handler synchronously
41+
// this.handler = new AnthropicHandler({
42+
// ...options,
43+
// apiKey: options.pearaiApiKey,
44+
// anthropicBaseUrl: PEARAI_URL,
45+
// apiModelId: "claude-3-5-sonnet-20241022",
46+
// })
47+
48+
this.handler = new OpenRouterHandler({
4149
...options,
42-
apiKey: options.pearaiApiKey,
43-
anthropicBaseUrl: PEARAI_URL,
44-
apiModelId: "claude-3-5-sonnet-20241022",
50+
openRouterBaseUrl: PEARAI_URL,
51+
openRouterApiKey: options.pearaiApiKey,
52+
openRouterModelId: "deepseek/deepseek-chat-v3-0324",
4553
})
4654

4755
// Then try to initialize the correct handler asynchronously
@@ -95,10 +103,16 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
95103
anthropicBaseUrl: PEARAI_URL,
96104
})
97105
} else if (modelId.startsWith("deepseek")) {
98-
this.handler = new DeepSeekHandler({
106+
// this.handler = new DeepSeekHandler({
107+
// ...options,
108+
// deepSeekApiKey: options.pearaiApiKey,
109+
// deepSeekBaseUrl: PEARAI_URL,
110+
// })
111+
this.handler = new OpenRouterHandler({
99112
...options,
100-
deepSeekApiKey: options.pearaiApiKey,
101-
deepSeekBaseUrl: PEARAI_URL,
113+
openRouterBaseUrl: PEARAI_URL,
114+
openRouterApiKey: options.pearaiApiKey,
115+
openRouterModelId: modelId,
102116
})
103117
} else {
104118
throw new Error(`Unsupported model: ${modelId}`)

src/core/Cline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ export class Cline extends EventEmitter<ClineEvents> {
582582
async sayAndCreateMissingParamError(toolName: ToolUseName, paramName: string, relPath?: string) {
583583
await this.say(
584584
"error",
585-
`Roo tried to use ${toolName}${
585+
`Agent tried to use ${toolName}${
586586
relPath ? ` for '${relPath.toPosix()}'` : ""
587587
} without value for required parameter '${paramName}'. Retrying...`,
588588
)
@@ -2750,7 +2750,7 @@ export class Cline extends EventEmitter<ClineEvents> {
27502750
this.consecutiveMistakeCount++
27512751
await this.say(
27522752
"error",
2753-
`Roo tried to use ${tool_name} with an invalid JSON argument. Retrying...`,
2753+
`Agent tried to use ${tool_name} with an invalid JSON argument. Retrying...`,
27542754
)
27552755
pushToolResult(
27562756
formatResponse.toolError(

0 commit comments

Comments
 (0)