From 2e63d019519c5659bc4efbbe317bcbad7dbbeaa4 Mon Sep 17 00:00:00 2001 From: Roopan-Microsoft <168007406+Roopan-Microsoft@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:28:27 +0530 Subject: [PATCH 1/2] fix: Updated packages due to incompatibility (#285) * Downgrade msal[broker] to 1.24.0b1 and azure-mgmt-resource to 23.1.0b2 * Downgrade azure-ai-ml package to version 1.17.1 to resolve package version conflicts (#283) * Upgrade azure-ai-ml package to compatible version --------- Co-authored-by: Prasanjeet-Microsoft Co-authored-by: Prajwal-Microsoft --- .../Deployment/scripts/aihub_scripts/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ResearchAssistant/Deployment/scripts/aihub_scripts/requirements.txt b/ResearchAssistant/Deployment/scripts/aihub_scripts/requirements.txt index 0b492679..e5b81109 100644 --- a/ResearchAssistant/Deployment/scripts/aihub_scripts/requirements.txt +++ b/ResearchAssistant/Deployment/scripts/aihub_scripts/requirements.txt @@ -1,8 +1,8 @@ azure-identity azure-keyvault-secrets azure-ai-resources -azure-ai-ml==1.23.0 -msal[broker]==1.31.1 -azure-mgmt-resource +azure-ai-ml==1.23.1 +msal[broker]==1.24.0b1 +azure-mgmt-resource==23.1.0b2 azure-mgmt-cognitiveservices azure-mgmt-search \ No newline at end of file From 501d614d86688e23563fff448a49290e008d39f8 Mon Sep 17 00:00:00 2001 From: pradeepjha-microsoft Date: Thu, 30 Jan 2025 16:56:52 +0530 Subject: [PATCH 2/2] updatew history method changes --- ClientAdvisor/App/frontend/src/api/api.ts | 52 +++++++++++++++-------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/ClientAdvisor/App/frontend/src/api/api.ts b/ClientAdvisor/App/frontend/src/api/api.ts index b59dceb0..193aa4d0 100644 --- a/ClientAdvisor/App/frontend/src/api/api.ts +++ b/ClientAdvisor/App/frontend/src/api/api.ts @@ -201,31 +201,47 @@ export const selectUser = async (options: ClientIdRequest): Promise => return new Response(null, { status: 500, statusText: 'Internal Server Error' }); } }; - +function isLastObjectNotEmpty(arr:any) + { + if (arr.length === 0) return false; + // Handle empty array case + const lastObj = arr[arr.length - 1]; + return Object.keys(lastObj).length > 0; + } export const historyUpdate = async (messages: ChatMessage[], convId: string): Promise => { - const response = await fetch('/history/update', { - method: 'POST', - body: JSON.stringify({ - conversation_id: convId, - messages: messages - }), - headers: { - 'Content-Type': 'application/json' - } - }) - .then(async res => { - return res + if(isLastObjectNotEmpty(messages)){ + const response = await fetch('/history/update', { + method: 'POST', + body: JSON.stringify({ + conversation_id: convId, + messages: messages + }), + headers: { + 'Content-Type': 'application/json' + } }) - .catch(_err => { - console.error('There was an issue fetching your data.') + .then(async res => { + return res + }) + .catch(_err => { + console.error('There was an issue fetching your data.') + const errRes: Response = { + ...new Response(), + ok: false, + status: 500 + } + return errRes + }) + return response + } + else{ const errRes: Response = { ...new Response(), ok: false, status: 500 } - return errRes - }) - return response + return errRes + } } export const historyDelete = async (convId: string): Promise => {