diff --git a/src/sidebar.ts b/src/sidebar.ts index c28c45802..7fc72dd6d 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -193,12 +193,12 @@ export class PanelWebview implements vscode.WebviewViewProvider { break; } case "save_enterprise": { - await vscode.workspace.getConfiguration().update('refactai.infurl', data.endpoint, vscode.ConfigurationTarget.Global); + await vscode.workspace.getConfiguration().update('refactai.addressURL', data.endpoint, vscode.ConfigurationTarget.Global); await vscode.workspace.getConfiguration().update('refactai.apiKey', data.apikey, vscode.ConfigurationTarget.Global); break; } case "save_selfhosted": { - await vscode.workspace.getConfiguration().update('refactai.infurl', data.endpoint, vscode.ConfigurationTarget.Global); + await vscode.workspace.getConfiguration().update('refactai.addressURL', data.endpoint, vscode.ConfigurationTarget.Global); await vscode.workspace.getConfiguration().update('refactai.apiKey', 'aaa', vscode.ConfigurationTarget.Global); break; } @@ -399,8 +399,10 @@ export class PanelWebview implements vscode.WebviewViewProvider { ); const nonce = this.getNonce(); const api_key = vscode.workspace.getConfiguration().get('refactai.apiKey'); - let manual_infurl = vscode.workspace.getConfiguration().get("refactai.infurl"); - + let existing_address = vscode.workspace.getConfiguration().get("refactai.addressURL"); + if (typeof existing_address !== "string" || (typeof existing_address === "string" && !existing_address.match(/^https?:\/\//))) { + existing_address = ""; + } return ` @@ -479,7 +481,7 @@ export class PanelWebview implements vscode.WebviewViewProvider {
You should have corporate endpoint URL and personal API key. Please contact your system administrator.
- +
@@ -511,7 +513,7 @@ export class PanelWebview implements vscode.WebviewViewProvider {
- +