Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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("```") && !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