From ef042e1c7999001a14e5e99dad50eb92a3218c23 Mon Sep 17 00:00:00 2001 From: samanhappy Date: Thu, 17 Oct 2024 23:55:40 +0800 Subject: [PATCH] refresh context for UnauthorizedRequest (#658) --- src/bots/microsoft/BingChatBot.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bots/microsoft/BingChatBot.js b/src/bots/microsoft/BingChatBot.js index f2159bcf06..ede550b93a 100644 --- a/src/bots/microsoft/BingChatBot.js +++ b/src/bots/microsoft/BingChatBot.js @@ -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);