Skip to content

Commit 0cb3684

Browse files
committed
ensure 'tools' are returned by 'getCustomChatModes' method
1 parent 3835b05 commit 0cb3684

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/vs/workbench/contrib/chat/common/promptSyntax/parsers/basePromptParser.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -612,21 +612,18 @@ export class BasePromptParser<TContentsProvider extends IPromptContentsProvider>
612612
* Valid metadata records defined in the prompt header.
613613
*/
614614
public get metadata(): TMetadata | null {
615-
if (this.header === undefined) {
616-
const { promptType } = this.promptContentsProvider;
617-
618-
if (promptType === 'non-prompt') {
619-
return null;
620-
}
615+
const { promptType } = this.promptContentsProvider;
616+
if (promptType === 'non-prompt') {
617+
return null;
618+
}
621619

622-
return {
623-
promptType,
624-
};
620+
if (this.header === undefined) {
621+
return { promptType };
625622
}
626623

627624
if (this.header instanceof InstructionsHeader) {
628625
return {
629-
promptType: PromptsType.instructions,
626+
promptType,
630627
...this.header.metadata,
631628
};
632629
}
@@ -654,7 +651,7 @@ export class BasePromptParser<TContentsProvider extends IPromptContentsProvider>
654651
}
655652

656653
return {
657-
promptType: PromptsType.prompt,
654+
promptType,
658655
...result,
659656
};
660657
}

src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class PromptsService extends Disposable implements IPromptsService {
208208
await parser.settled();
209209

210210
const { metadata } = parser;
211-
const tools = (metadata?.promptType === PromptsType.mode)
211+
const tools = (metadata && ('tools' in metadata))
212212
? metadata.tools
213213
: undefined;
214214

0 commit comments

Comments
 (0)