Skip to content

Commit 8d5d2d2

Browse files
committed
Fix issues
1 parent aa3d8da commit 8d5d2d2

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

shell/AIShell.Kernel/Command/CommandRunner.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,12 @@ internal void LoadCommands(IEnumerable<CommandBase> commands, string agentName)
5858
command.Shell = _shell;
5959
command.Source = agentName;
6060

61+
// The 'command.Name' is included in the 'command.Aliases' collection.
6162
// TODO: need to think about how to handle command names/aliases collision.
6263
// We don't handle collision today -- it will throw when collision happens.
63-
_commands.Add(command.Name, command);
6464
foreach (string alias in command.Aliases)
6565
{
66-
if (!string.IsNullOrWhiteSpace(alias))
67-
{
68-
_commands.Add(alias, command);
69-
}
66+
_commands.Add(alias, command);
7067
}
7168
}
7269
}
@@ -89,14 +86,11 @@ internal void UnloadAgentCommands()
8986

9087
foreach (var command in agentCommands)
9188
{
89+
// The 'command.Name' is included in the 'command.Aliases' collection.
9290
// TODO: need to update accordingly when we handle command names/aliases collision.
93-
_commands.Remove(command.Name);
9491
foreach (string alias in command.Aliases)
9592
{
96-
if (!string.IsNullOrWhiteSpace(alias))
97-
{
98-
_commands.Remove(alias);
99-
}
93+
_commands.Remove(alias);
10094
}
10195

10296
command.Dispose();

shell/AIShell.Kernel/Command/HelpCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private void HelpAction()
1717
var host = shellImpl.Host;
1818

1919
var commands = shellImpl.CommandRunner.Commands;
20-
var list = commands.Values.Order(new CommandComparer()).ToList();
20+
var list = commands.Values.Distinct().Order(new CommandComparer()).ToList();
2121

2222
host.WriteLine();
2323
host.MarkupLine("[bold white]-[/] Type then press [bold olive underline]Enter[/] to chat with the chosen AI agent.");

0 commit comments

Comments
 (0)