Skip to content

Commit

Permalink
Update the error message when '/replace' cannot do its work
Browse files Browse the repository at this point in the history
  • Loading branch information
daxian-dbw committed Nov 12, 2024
1 parent 2671579 commit 40ae7e7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion shell/agents/Microsoft.Azure.Agent/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,21 @@ private void ReplaceAction()

if (ap is null)
{
host.WriteErrorLine("No argument placeholder to replace.");
CopilotResponse cr = _agent.CopilotResponse;
if (cr is null || cr.IsError)
{
host.WriteErrorLine("No AI response available.");
}
else if (!cr.Text.Contains("```"))
{
host.WriteErrorLine("The last AI response contains no code in it.");
}
else
{
Telemetry.Trace(AzTrace.Exception($"'/replace' command unavailable. TopicName: {cr.TopicName}"));
host.WriteErrorLine("The '/replace' command is experimental and could not successfully parse the response. This issue may occur intermittently due to specific response conditions.");
}

return;
}

Expand Down

0 comments on commit 40ae7e7

Please sign in to comment.