Skip to content

Commit

Permalink
refresh context for UnauthorizedRequest (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
samanhappy authored Oct 17, 2024
1 parent baa77eb commit ef042e1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bots/microsoft/BingChatBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ export default class BingChatBot extends Bot {
} else if (event.type === 2) {
if (event.item.result.value !== "Success") {
console.error("Error sending prompt to Copilot:", event);
if (event.item.result.value === "InvalidSession") {
if (
event.item.result.value === "InvalidSession" ||
event.item.result.value === "UnauthorizedRequest"
) {
// Create a new conversation and retry
context = await this.createChatContext();
this.setChatContext(context);
Expand Down

0 comments on commit ef042e1

Please sign in to comment.