Connect-src needs hold the entire path for chat completions for OpenAICompatible

Simply using the enpoint will trigger a Content-Security-Policy error in vscode when trying to send messages to the LLM
This commit is contained in:
Tom Spielvogel 2024-10-16 10:56:46 +02:00 committed by GitHub
parent f86b84dcc6
commit b565a91194
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -55,7 +55,7 @@ export class SidebarWebviewProvider implements vscode.WebviewViewProvider {
const openAICompatibleEndpoint: string | undefined = vscode.workspace.getConfiguration('void.openAICompatible').get('endpoint');
this._webviewDeps.push('void.openAICompatible.endpoint');
if (openAICompatibleEndpoint)
allowed_urls.push(openAICompatibleEndpoint);
allowed_urls.push(openAICompatibleEndpoint+'/chat/completions');
const scriptUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'dist/sidebar/index.js'));
const stylesUri = webview.asWebviewUri(vscode.Uri.joinPath(this._extensionUri, 'dist/sidebar/styles.css'));