Skip to content

Commit 99d8607

Browse files
committed
Added fixes
1 parent 3f7a2bc commit 99d8607

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/api/providers/pearai.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,17 @@ export class PearAiHandler {
3232
throw new Error("PearAI API key not found. Please login to PearAI.")
3333
}
3434

35+
// Initialize with a default handler synchronously
36+
this.handler = new AnthropicHandler({
37+
...options,
38+
apiKey: options.pearaiApiKey,
39+
anthropicBaseUrl: PEARAI_URL,
40+
apiModelId: "claude-3-5-sonnet-20241022",
41+
})
42+
43+
// Then try to initialize the correct handler asynchronously
3544
this.initializeHandler(options).catch((error) => {
3645
console.error("Failed to initialize PearAI handler:", error)
37-
throw error
3846
})
3947
}
4048

@@ -94,6 +102,7 @@ export class PearAiHandler {
94102
}
95103

96104
getModel(): { id: string; info: ModelInfo } {
105+
console.dir(this.handler)
97106
const baseModel = this.handler.getModel()
98107
return {
99108
id: baseModel.id,

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
requestyDefaultModelId,
1414
requestyDefaultModelInfo,
1515
PEARAI_URL,
16+
pearAiModels,
1617
} from "../../../src/shared/api"
1718
import { vscode } from "../utils/vscode"
1819
import { convertTextMateToHljs } from "../utils/textMateToHljs"
@@ -153,6 +154,8 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
153154
apiConfiguration: {
154155
apiProvider: "pearai",
155156
pearaiBaseUrl: PEARAI_URL,
157+
pearaiModelId: "pearai-model",
158+
pearaiModelInfo: pearAiModels["pearai-model"],
156159
},
157160
})
158161
}

0 commit comments

Comments
 (0)