Skip to content

Commit

Permalink
Improved copilot error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkMpn committed Jul 8, 2024
1 parent 9fd57a2 commit 71dd652
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 10 additions & 6 deletions MarkMpn.Sql4Cds.XTB/Resources/Copilot.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,16 @@
const icon = document.getElementById(type).cloneNode(true);
div.appendChild(icon);
div.appendChild(block);
const button = document.createElement('button');
button.textContent = action;
button.addEventListener('click', () => {
sendMessage(message);
});
block.appendChild(button);

if (action) {
const button = document.createElement('button');
button.textContent = action;
button.addEventListener('click', () => {
sendMessage(message);
});
block.appendChild(button);
}

result.appendChild(div);
div.scrollIntoView(false);
}
Expand Down
2 changes: 2 additions & 0 deletions MarkMpn.Sql4Cds.XTB/SqlQueryControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using MarkMpn.Sql4Cds.Export.DataStorage;
using McTools.Xrm.Connection;
using Microsoft.ApplicationInsights;
using Microsoft.Identity.Client;
using Microsoft.SqlServer.TransactSql.ScriptDom;
using Microsoft.Web.WebView2.WinForms;
using Microsoft.Xrm.Sdk;
Expand Down Expand Up @@ -2417,6 +2418,7 @@ public async Task<string[]> SendMessage(string request)
}
catch (Exception ex)
{
await ShowPromptSuggestionAsync("warning", HttpUtility.HtmlEncode(ex.Message), null, null);
return new[] { ex.Message };
}
finally
Expand Down

0 comments on commit 71dd652

Please sign in to comment.