feat: improve prompt management (#7853)

This commit is contained in:
darkskygit
2024-08-14 08:38:36 +00:00
parent cd3924b8fc
commit 339c39c1ec
13 changed files with 161 additions and 105 deletions

View File

@@ -517,7 +517,16 @@ export class PromptsManagementResolver {
description: 'List all copilot prompts',
})
async listCopilotPrompts() {
return this.promptService.list();
const prompts = await this.promptService.list();
return prompts.filter(
p =>
p.messages.length > 0 &&
// ignore internal prompts
!p.name.startsWith('workflow:') &&
!p.name.startsWith('debug:') &&
!p.name.startsWith('chat:') &&
!p.name.startsWith('action:')
);
}
@Mutation(() => CopilotPromptType, {
@@ -544,7 +553,7 @@ export class PromptsManagementResolver {
@Args('messages', { type: () => [CopilotPromptMessageType] })
messages: CopilotPromptMessageType[]
) {
await this.promptService.update(name, messages);
await this.promptService.update(name, messages, true);
return this.promptService.get(name);
}
}