From 2a0736847f678502343f5b3e5422379ae3d651c7 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 8 Sep 2025 15:03:05 +0200 Subject: [PATCH 1/4] fix(polling): stop polling when the assistant is closed Signed-off-by: Julien Veyssier --- src/assistant.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/assistant.js b/src/assistant.js index ee2e4c576..0c2fd46f2 100644 --- a/src/assistant.js +++ b/src/assistant.js @@ -107,6 +107,7 @@ export async function openAssistantForm({ let lastTask = null modalMountPoint.addEventListener('cancel', () => { + cancelTaskPolling() app.unmount() reject(new Error('User cancellation')) }) @@ -521,6 +522,7 @@ export async function openAssistantTask( let lastTask = task modalMountPoint.addEventListener('cancel', () => { + cancelTaskPolling() app.unmount() }) modalMountPoint.addEventListener('submit', (data) => { From 4a71970e4cd19add7485edaef5a4abf65db9914b Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 8 Sep 2025 15:09:26 +0200 Subject: [PATCH 2/4] fix(polling): stop polling chat task when the assistant is closed (anytime the ChattyLLMInputForm component is unmounted) Signed-off-by: Julien Veyssier --- src/components/ChattyLLM/ChattyLLMInputForm.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ChattyLLM/ChattyLLMInputForm.vue b/src/components/ChattyLLM/ChattyLLMInputForm.vue index 49407662e..6543b9959 100644 --- a/src/components/ChattyLLM/ChattyLLMInputForm.vue +++ b/src/components/ChattyLLM/ChattyLLMInputForm.vue @@ -345,7 +345,7 @@ export default { }, }, - onDestroy() { + beforeUnmount() { if (this.pollMessageGenerationTimerId) { clearInterval(this.pollMessageGenerationTimerId) } From 391f310b46a8225a7200a33d3f1cfcc1483d78b2 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Mon, 8 Sep 2025 15:17:01 +0200 Subject: [PATCH 3/4] fix(ChattyLLMInputForm): get rid of eslint warning about importing axios.isCancel Signed-off-by: Julien Veyssier --- src/components/ChattyLLM/ChattyLLMInputForm.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ChattyLLM/ChattyLLMInputForm.vue b/src/components/ChattyLLM/ChattyLLMInputForm.vue index 6543b9959..592ac86f2 100644 --- a/src/components/ChattyLLM/ChattyLLMInputForm.vue +++ b/src/components/ChattyLLM/ChattyLLMInputForm.vue @@ -183,7 +183,7 @@ import InputArea from './InputArea.vue' import NoSession from './NoSession.vue' import AgencyConfirmation from './AgencyConfirmation.vue' -import axios from '@nextcloud/axios' +import axios, { isCancel } from '@nextcloud/axios' import { showError } from '@nextcloud/dialogs' import { generateUrl, generateOcsUrl } from '@nextcloud/router' import { loadState } from '@nextcloud/initial-state' @@ -591,7 +591,7 @@ export default { this.loading.initialMessages = false this.messagesAxiosController = null } catch (error) { - if (axios.isCancel(error)) { + if (isCancel(error)) { console.debug('fetchMessages cancelled') return } From 52ac775eb8b4a95fd45e306ee9f20ebc9148af09 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 9 Sep 2025 15:14:04 +0200 Subject: [PATCH 4/4] fix(polling): reset assistantPollTimerId when task is not found and we stop polling Signed-off-by: Julien Veyssier --- src/assistant.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/assistant.js b/src/assistant.js index 0c2fd46f2..cb302e100 100644 --- a/src/assistant.js +++ b/src/assistant.js @@ -313,6 +313,7 @@ export async function pollTask(taskId, obj, callback = updateTask) { console.debug('[assistant] poll request failed', error) if (error.status === 404) { clearInterval(window.assistantPollTimerId) + window.assistantPollTimerId = null reject(new Error('task-not-found')) return }