From 1549b7a533f019fef5eb5f59780858ececfd4d82 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Fri, 21 Nov 2025 16:31:51 +0100 Subject: [PATCH 1/2] enh(tasktype): save the last selected task type when switching Signed-off-by: Julien Veyssier --- src/assistant.js | 3 +-- src/components/AssistantTextProcessingForm.vue | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/assistant.js b/src/assistant.js index bbdd58c2..45177dfa 100644 --- a/src/assistant.js +++ b/src/assistant.js @@ -373,7 +373,6 @@ export async function scheduleTask(appId, customId, taskType, inputs) { window.assistantAbortController = new AbortController() const { default: axios } = await import('@nextcloud/axios') const { generateOcsUrl } = await import('@nextcloud/router') - saveLastSelectedTaskType(taskType) if (taskType === 'core:text2text:translate') { saveLastTargetLanguage(inputs.target_language) } @@ -387,7 +386,7 @@ export async function scheduleTask(appId, customId, taskType, inputs) { return axios.post(url, params, { signal: window.assistantAbortController.signal }) } -async function saveLastSelectedTaskType(taskType) { +export async function saveLastSelectedTaskType(taskType) { const { default: axios } = await import('@nextcloud/axios') const { generateUrl } = await import('@nextcloud/router') diff --git a/src/components/AssistantTextProcessingForm.vue b/src/components/AssistantTextProcessingForm.vue index 765c3dcc..b1e5c446 100644 --- a/src/components/AssistantTextProcessingForm.vue +++ b/src/components/AssistantTextProcessingForm.vue @@ -159,6 +159,8 @@ import { generateOcsUrl, generateUrl } from '@nextcloud/router' import { showError } from '@nextcloud/dialogs' import '@nextcloud/dialogs/style.css' +import { saveLastSelectedTaskType } from '../assistant.js' + const TEXT2TEXT_TASK_TYPE_ID = 'core:text2text' export default { @@ -507,6 +509,7 @@ export default { this.myInputs.text = OCA.Assistant.last_text_input } } + saveLastSelectedTaskType(this.mySelectedTaskTypeId) }, onSyncSubmit() { console.debug('[assistant] in form submit ---------', this.myInputs) From 3947d7982ca8cc61aeb182aff5d56cf6715c768d Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 2 Dec 2025 12:37:34 +0100 Subject: [PATCH 2/2] select chat type if there is no saved one or if the saved one is not available Signed-off-by: Julien Veyssier --- src/components/AssistantTextProcessingForm.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/AssistantTextProcessingForm.vue b/src/components/AssistantTextProcessingForm.vue index b1e5c446..6dd8783b 100644 --- a/src/components/AssistantTextProcessingForm.vue +++ b/src/components/AssistantTextProcessingForm.vue @@ -162,6 +162,7 @@ import '@nextcloud/dialogs/style.css' import { saveLastSelectedTaskType } from '../assistant.js' const TEXT2TEXT_TASK_TYPE_ID = 'core:text2text' +const CHAT_TASK_TYPE_ID = 'chatty-llm' export default { name: 'AssistantTextProcessingForm', @@ -267,7 +268,7 @@ export default { myInputs: this.inputs, myOutputs: this.outputs, taskTypes: [], - mySelectedTaskTypeId: this.selectedTaskTypeId || TEXT2TEXT_TASK_TYPE_ID, + mySelectedTaskTypeId: this.selectedTaskTypeId || CHAT_TASK_TYPE_ID, loadingTaskTypes: false, historyLoading: false, showAdvanced: false, @@ -434,7 +435,10 @@ export default { const taskType = taskTypes.find(tt => tt.id === this.mySelectedTaskTypeId) if (taskType === undefined) { const text2textType = taskTypes.find(tt => tt.id === TEXT2TEXT_TASK_TYPE_ID) - if (text2textType) { + const chatType = taskTypes.find(tt => tt.id === CHAT_TASK_TYPE_ID) + if (chatType) { + this.mySelectedTaskTypeId = CHAT_TASK_TYPE_ID + } else if (text2textType) { this.parseTextFileInputs(text2textType) this.mySelectedTaskTypeId = TEXT2TEXT_TASK_TYPE_ID } else if (taskTypes.length > 0) {