@@ -45,9 +45,6 @@ import { CustomSupportPrompts, supportPrompt } from "../../shared/support-prompt
4545
4646import { ACTION_NAMES } from "../CodeActionProvider"
4747
48- // Todo: Remove
49- const PEARAI_TOKEN = "temp"
50-
5148/*
5249https://github.com/microsoft/vscode-webview-ui-toolkit-samples/blob/main/default/weather-webview/src/providers/WeatherViewProvider.ts
5350
@@ -66,7 +63,8 @@ type SecretKey =
6663 | "openAiNativeApiKey"
6764 | "deepSeekApiKey"
6865 | "mistralApiKey"
69- | "pearaiApiKey"
66+ | "pearai-token"
67+ | "pearai-refresh" // Array of custom modes
7068type GlobalStateKey =
7169 | "apiProvider"
7270 | "apiModelId"
@@ -130,8 +128,6 @@ type GlobalStateKey =
130128 | "experiments" // Map of experiment IDs to their enabled state
131129 | "autoApprovalEnabled"
132130 | "customModes"
133- | "pearai-token"
134- | "pearai-refresh" // Array of custom modes
135131
136132export const GlobalFileNames = {
137133 apiConversationHistory : "api_conversation_history.json" ,
@@ -1278,6 +1274,19 @@ export class ClineProvider implements vscode.WebviewViewProvider {
12781274 await this . updateGlobalState ( "mode" , defaultModeSlug )
12791275 await this . postStateToWebview ( )
12801276 }
1277+ break
1278+ case "openPearAiAuth" :
1279+ const extensionUrl = `${ vscode . env . uriScheme } ://pearai.pearai/auth`
1280+ const callbackUri = await vscode . env . asExternalUri ( vscode . Uri . parse ( extensionUrl ) )
1281+
1282+ await vscode . env . openExternal (
1283+ await vscode . env . asExternalUri (
1284+ vscode . Uri . parse (
1285+ `https://trypear.ai/signin?callback=${ callbackUri . toString ( ) } ` , // Change to localhost if running locally
1286+ ) ,
1287+ ) ,
1288+ )
1289+ break
12811290 }
12821291 } ,
12831292 null ,
@@ -1373,7 +1382,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
13731382 openRouterUseMiddleOutTransform,
13741383 vsCodeLmModelSelector,
13751384 mistralApiKey,
1376- pearaiApiKey,
13771385 pearaiBaseUrl,
13781386 pearaiModelId,
13791387 pearaiModelInfo,
@@ -1415,7 +1423,6 @@ export class ClineProvider implements vscode.WebviewViewProvider {
14151423 await this . updateGlobalState ( "openRouterUseMiddleOutTransform" , openRouterUseMiddleOutTransform )
14161424 await this . updateGlobalState ( "vsCodeLmModelSelector" , vsCodeLmModelSelector )
14171425 await this . storeSecret ( "mistralApiKey" , mistralApiKey )
1418- await this . updateGlobalState ( "pearai-token" , PEARAI_TOKEN )
14191426 await this . updateGlobalState ( "pearaiBaseUrl" , PEARAI_URL )
14201427 await this . updateGlobalState ( "pearaiModelId" , pearaiModelId )
14211428 await this . updateGlobalState ( "pearaiModelInfo" , pearaiModelInfo )
@@ -2112,8 +2119,8 @@ export class ClineProvider implements vscode.WebviewViewProvider {
21122119 this . getSecret ( "openAiNativeApiKey" ) as Promise < string | undefined > ,
21132120 this . getSecret ( "deepSeekApiKey" ) as Promise < string | undefined > ,
21142121 this . getSecret ( "mistralApiKey" ) as Promise < string | undefined > ,
2115- this . getGlobalState ( "pearai-token" ) as Promise < string | undefined > ,
2116- this . getGlobalState ( "pearai-refresh" ) as Promise < string | undefined > ,
2122+ this . getSecret ( "pearai-token" ) as Promise < string | undefined > ,
2123+ this . getSecret ( "pearai-refresh" ) as Promise < string | undefined > ,
21172124 this . getGlobalState ( "pearaiBaseUrl" ) as Promise < string | undefined > ,
21182125 this . getGlobalState ( "pearaiModelId" ) as Promise < string | undefined > ,
21192126 this . getGlobalState ( "pearaiModelInfo" ) as Promise < ModelInfo | undefined > ,
0 commit comments