From 4bb79a8cdd30f742aeb0da8ea9315eb51a3a0a65 Mon Sep 17 00:00:00 2001 From: Dongbo Wang Date: Tue, 9 Jan 2024 15:50:06 -0800 Subject: [PATCH] Avoid the selection prompt when there is only one available agent --- shell/ShellCopilot.Kernel/Shell.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/ShellCopilot.Kernel/Shell.cs b/shell/ShellCopilot.Kernel/Shell.cs index b7055f07..736e5e5b 100644 --- a/shell/ShellCopilot.Kernel/Shell.cs +++ b/shell/ShellCopilot.Kernel/Shell.cs @@ -141,8 +141,11 @@ private void LoadAvailableAgents() try { - LLMAgent chosenAgent = Host - .PromptForSelectionAsync( + // If there is only 1 agent available, use it as the active one. + // Otherwise, ask user to choose the active one from the list. + LLMAgent chosenAgent = _agents.Count is 1 + ? _agents[0] + : Host.PromptForSelectionAsync( title: "[orange1]Please select an [Blue]agent[/] to use[/]:", choices: _agents, converter: static a => a.Impl.Name)