From 0787c6eedcb6c8dc26278681095568604a00d0f8 Mon Sep 17 00:00:00 2001 From: Beatrix Date: Fri, 3 Jan 2025 04:09:54 -0800 Subject: [PATCH] reviewed context --- vscode/src/chat/agentic/DeepCody.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vscode/src/chat/agentic/DeepCody.ts b/vscode/src/chat/agentic/DeepCody.ts index d8ecc89dde09..d1006023d270 100644 --- a/vscode/src/chat/agentic/DeepCody.ts +++ b/vscode/src/chat/agentic/DeepCody.ts @@ -216,9 +216,8 @@ export class DeepCodyAgent { } // Extract all the strings from between tags. - const contextListTag = ACTIONS_TAGS.CONTEXT.toString() - const validatedContext = PromptStringBuilder.extractTagContents(res, contextListTag) - const reviewed = [...this.context.filter(c => isUserAddedItem(c))] + const reviewed = [] + const validatedContext = PromptStringBuilder.extractTagContents(res, ACTIONS_TAGS.CONTEXT) for (const contextName of validatedContext || []) { const foundValidatedItems = this.context.filter(c => c.uri.path.endsWith(contextName)) for (const found of foundValidatedItems) { @@ -228,6 +227,7 @@ export class DeepCodyAgent { // Replace the current context list with the reviewed context. if (reviewed.length) { + reviewed.push(...this.context.filter(c => isUserAddedItem(c))) this.context = reviewed } @@ -303,7 +303,8 @@ export class PromptStringBuilder { this.parts = [] } - public static extractTagContents(response: string, tag: string): string[] { + public static extractTagContents(response: string, psTag: PromptString): string[] { + const tag = psTag.toString() const tagLength = tag.length return ( response