From 4ad4c5f2d63556054d791afb57f2f64f965daece Mon Sep 17 00:00:00 2001 From: gagik Date: Fri, 8 Nov 2024 16:18:52 +0100 Subject: [PATCH] small cleanup --- src/participant/prompts/promptBase.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/participant/prompts/promptBase.ts b/src/participant/prompts/promptBase.ts index 4d8a5e988..37339d878 100644 --- a/src/participant/prompts/promptBase.ts +++ b/src/participant/prompts/promptBase.ts @@ -183,6 +183,9 @@ export abstract class PromptBase { | vscode.ChatRequestTurn | vscode.ChatResponseTurn | undefined = undefined; + + const namespaceIsKnown = + databaseName !== undefined && collectionName !== undefined; for (const historyItem of context.history) { if (historyItem instanceof vscode.ChatRequestTurn) { if ( @@ -200,11 +203,7 @@ export abstract class PromptBase { .intent; // If the namespace is already known, skip responses to prompts asking for it. - if ( - responseIntent === 'askForNamespace' && - databaseName !== undefined && - collectionName !== undefined - ) { + if (responseIntent === 'askForNamespace' && namespaceIsKnown) { previousItem = historyItem; continue; } @@ -241,11 +240,7 @@ export abstract class PromptBase { } // If the namespace is already known, skip including prompts asking for it. - if ( - responseType === 'askForNamespace' && - databaseName !== undefined && - collectionName !== undefined - ) { + if (responseType === 'askForNamespace' && namespaceIsKnown) { previousItem = historyItem; continue; }