Fix multiple agent id/name mixups (#208450)

This commit is contained in:
Rob Lourens 2024-03-22 16:13:13 -03:00 committed by GitHub
parent a7dc4a5246
commit 34f6d642e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 4 deletions

View file

@ -267,7 +267,7 @@ class ChatSlashStaticSlashCommandsContribution extends Disposable {
const agentText = (await Promise.all(agents
.filter(a => a.id !== defaultAgent?.id)
.map(async a => {
const agentWithLeader = `${chatAgentLeader}${a.id}`;
const agentWithLeader = `${chatAgentLeader}${a.name}`;
const actionArg: IChatExecuteActionContext = { inputValue: `${agentWithLeader} ${a.metadata.sampleRequest}` };
const urlSafeArg = encodeURIComponent(JSON.stringify(actionArg));
const agentLine = `* [\`${agentWithLeader}\`](command:${SubmitAction.ID}?${urlSafeArg}) - ${a.description}`;

View file

@ -45,7 +45,13 @@ export class ChatFollowups<T extends IChatFollowup | IInlineChatFollowup> extend
let tooltipPrefix = '';
if ('agentId' in followup && followup.agentId && followup.agentId !== this.chatAgentService.getDefaultAgent(this.location)?.id) {
tooltipPrefix += `${chatAgentLeader}${followup.agentId} `;
const agent = this.chatAgentService.getAgent(followup.agentId);
if (!agent) {
// Refers to agent that doesn't exist
return;
}
tooltipPrefix += `${chatAgentLeader}${agent.name} `;
if ('subCommand' in followup && followup.subCommand) {
tooltipPrefix += `${chatSubcommandLeader}${followup.subCommand} `;
}

View file

@ -504,7 +504,7 @@ class SubmitButtonActionViewItem extends ActionViewItem {
if (secondaryAgent) {
const secondaryKeybinding = keybindingService.lookupKeybinding(ChatSubmitSecondaryAgentEditorAction.ID)?.getLabel();
if (secondaryKeybinding) {
tooltip += `\n${chatAgentLeader}${secondaryAgent.id} (${secondaryKeybinding})`;
tooltip += `\n${chatAgentLeader}${secondaryAgent.name} (${secondaryKeybinding})`;
}
}

View file

@ -211,7 +211,7 @@ class InputEditorDecorations extends Disposable {
const textDecorations: IDecorationOptions[] | undefined = [];
if (agentPart) {
const agentHover = `(${agentPart.agent.id}) ${agentPart.agent.description}`;
const agentHover = `(${agentPart.agent.name}) ${agentPart.agent.description}`;
textDecorations.push({ range: agentPart.editorRange, hoverMessage: new MarkdownString(agentHover) });
if (agentSubcommandPart) {
textDecorations.push({ range: agentSubcommandPart.editorRange, hoverMessage: new MarkdownString(agentSubcommandPart.command.description) });