Leverage AuthenticationProviders for gating Language Model Access (#204859)

* Leverage AuthenticationProviders for gating Language Model Access

Since we already have the Auth Stack which has a concept of "Managing Trusted Extensions" we can initially use that for gating Language Model Access so that when an extension asks for Language Model Access, they have to see a dialog first.

* Support multiple models and create AuthProviders on Core side
This commit is contained in:
Tyler James Leonhardt
2024-02-09 12:19:16 -08:00
committed by GitHub
parent c9215c87ba
commit f10f059a54
6 changed files with 166 additions and 18 deletions

View File

@@ -207,7 +207,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostProfileContentHandlers = rpcProtocol.set(ExtHostContext.ExtHostProfileContentHandlers, new ExtHostProfileContentHandlers(rpcProtocol));
rpcProtocol.set(ExtHostContext.ExtHostInteractive, new ExtHostInteractive(rpcProtocol, extHostNotebook, extHostDocumentsAndEditors, extHostCommands, extHostLogService));
const extHostInteractiveEditor = rpcProtocol.set(ExtHostContext.ExtHostInlineChat, new ExtHostInteractiveEditor(rpcProtocol, extHostCommands, extHostDocuments, extHostLogService));
const extHostChatProvider = rpcProtocol.set(ExtHostContext.ExtHostChatProvider, new ExtHostChatProvider(rpcProtocol, extHostLogService));
const extHostChatProvider = rpcProtocol.set(ExtHostContext.ExtHostChatProvider, new ExtHostChatProvider(rpcProtocol, extHostLogService, extHostAuthentication));
const extHostChatAgents2 = rpcProtocol.set(ExtHostContext.ExtHostChatAgents2, new ExtHostChatAgents2(rpcProtocol, extHostChatProvider, extHostLogService, extHostCommands));
const extHostChatVariables = rpcProtocol.set(ExtHostContext.ExtHostChatVariables, new ExtHostChatVariables(rpcProtocol));
const extHostChat = rpcProtocol.set(ExtHostContext.ExtHostChat, new ExtHostChat(rpcProtocol));
@@ -1399,7 +1399,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
requestLanguageModelAccess(id, options) {
checkProposedApiEnabled(extension, 'chatRequestAccess');
return extHostChatProvider.requestLanguageModelAccess(extension.identifier, id, options);
return extHostChatProvider.requestLanguageModelAccess(extension, id, options);
},
get languageModels() {
checkProposedApiEnabled(extension, 'chatRequestAccess');