Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make agents show up in main chat / menu #199192

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -468,18 +468,35 @@ class AgentCompletions extends Disposable {
return;
}

return <CompletionList>{
suggestions: agents.flatMap((agent, i) => commands[i].map((c, i) => {
const agentLabel = `@${agent.id}`;
const withSlash = `/${c.name}`;
return <CompletionItem>{
label: { label: withSlash, description: agentLabel },
insertText: `${agentLabel} ${withSlash} `,
detail: `(${agentLabel}) ${c.description}`,
const justAgents: CompletionItem[] = agents
.filter(a => !a.metadata.isDefault)
.map(agent => {
const agentLabel = `${chatAgentLeader}${agent.id}`;
return {
label: { label: agentLabel, description: agent.metadata.description },
filterText: `${chatSubcommandLeader}${agent.id}`,
insertText: `${agentLabel} `,
range: new Range(1, 1, 1, 1),
kind: CompletionItemKind.Text, // The icons are disabled here anyway
kind: CompletionItemKind.Text,
sortText: `${chatSubcommandLeader}${agent.id}`,
};
}))
});

return {
suggestions: justAgents.concat(
agents.flatMap((agent, i) => commands[i].map((c, i) => {
const agentLabel = `${chatAgentLeader}${agent.id}`;
const withSlash = `${chatSubcommandLeader}${c.name}`;
return {
label: { label: withSlash, description: agentLabel },
filterText: `${chatSubcommandLeader}${agent.id}${c.name}`,
insertText: `${agentLabel} ${withSlash} `,
detail: `(${agentLabel}) ${c.description}`,
range: new Range(1, 1, 1, 1),
kind: CompletionItemKind.Text, // The icons are disabled here anyway
sortText: `${chatSubcommandLeader}${agent.id}${c.name}`,
} satisfies CompletionItem;
})))
};
}
}));
Expand Down