From 79306bd59fdbd7a3a60933a1ad7f85f775cf5dd7 Mon Sep 17 00:00:00 2001 From: hitesh-1997 Date: Fri, 15 Nov 2024 03:22:38 +0530 Subject: [PATCH] add userId if available to enable session affinity --- vscode/src/autoedits/adapters/cody-gateway.ts | 1 + vscode/src/autoedits/adapters/fireworks.ts | 1 + vscode/src/autoedits/autoedits-provider.ts | 1 + vscode/src/autoedits/prompt-provider.ts | 1 + 4 files changed, 4 insertions(+) diff --git a/vscode/src/autoedits/adapters/cody-gateway.ts b/vscode/src/autoedits/adapters/cody-gateway.ts index 9fd8a89ac49..afbc1ee2d25 100644 --- a/vscode/src/autoedits/adapters/cody-gateway.ts +++ b/vscode/src/autoedits/adapters/cody-gateway.ts @@ -57,6 +57,7 @@ export class CodyGatewayAdapter implements AutoeditsModelAdapter { type: 'text', }, speculation: option.codeToRewrite, + user: option.userId, } const response = await getModelResponse( option.url, diff --git a/vscode/src/autoedits/adapters/fireworks.ts b/vscode/src/autoedits/adapters/fireworks.ts index ee505cea85f..1c1aa0923cc 100644 --- a/vscode/src/autoedits/adapters/fireworks.ts +++ b/vscode/src/autoedits/adapters/fireworks.ts @@ -58,6 +58,7 @@ export class FireworksAdapter implements AutoeditsModelAdapter { type: 'text', }, speculation: option.codeToRewrite, + user: option.userId, }), option.apiKey ) diff --git a/vscode/src/autoedits/autoedits-provider.ts b/vscode/src/autoedits/autoedits-provider.ts index b3f7dcb40bd..48069a768e7 100644 --- a/vscode/src/autoedits/autoedits-provider.ts +++ b/vscode/src/autoedits/autoedits-provider.ts @@ -206,6 +206,7 @@ export class AutoeditsProvider implements vscode.Disposable { apiKey, prompt, codeToRewrite: codeToReplace.codeToRewrite, + userId: (await currentResolvedConfig()).clientState.anonymousUserID, }) const postProcessedResponse = this.config.provider.postProcessResponse(codeToReplace, response) diff --git a/vscode/src/autoedits/prompt-provider.ts b/vscode/src/autoedits/prompt-provider.ts index ee989d66153..631617ea6ec 100644 --- a/vscode/src/autoedits/prompt-provider.ts +++ b/vscode/src/autoedits/prompt-provider.ts @@ -17,6 +17,7 @@ export interface AutoeditModelOptions { apiKey: string prompt: ChatPrompt codeToRewrite: string + userId: string | null } export interface PromptResponseData {