File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { OpenAiHandler } from "./openai"
2+ import * as vscode from "vscode"
23import { ApiHandlerOptions , PEARAI_URL } from "../../shared/api"
34import { AnthropicHandler } from "./anthropic"
45
56export class PearAiHandler extends AnthropicHandler {
67 constructor ( options : ApiHandlerOptions ) {
78 if ( ! options . pearaiApiKey ) {
9+ vscode . window . showErrorMessage ( "PearAI API key not found." , "Login to PearAI" ) . then ( async ( selection ) => {
10+ if ( selection === "Login to PearAI" ) {
11+ const extensionUrl = `${ vscode . env . uriScheme } ://pearai.pearai/auth`
12+ const callbackUri = await vscode . env . asExternalUri ( vscode . Uri . parse ( extensionUrl ) )
13+
14+ vscode . env . openExternal (
15+ await vscode . env . asExternalUri (
16+ vscode . Uri . parse (
17+ `https://trypear.ai/signin?callback=${ callbackUri . toString ( ) } ` , // Change to localhost if running locally
18+ ) ,
19+ ) ,
20+ )
21+ }
22+ } )
823 throw new Error ( "PearAI API key not found. Please login to PearAI." )
924 }
1025 super ( {
You can’t perform that action at this time.
0 commit comments