From 8e30ad41fe43a981bdb658b6f43d8da25ccb0927 Mon Sep 17 00:00:00 2001 From: Lukas Schaefer Date: Tue, 30 Jun 2026 17:37:22 -0400 Subject: [PATCH] Add improve button to text outputs to allow for iteration Signed-off-by: Lukas Schaefer --- .../AssistantTextProcessingForm.vue | 33 +++++++++ src/components/fields/TextInput.vue | 67 ++++++++++++------- 2 files changed, 74 insertions(+), 26 deletions(-) diff --git a/src/components/AssistantTextProcessingForm.vue b/src/components/AssistantTextProcessingForm.vue index c3006e8b..9103550e 100644 --- a/src/components/AssistantTextProcessingForm.vue +++ b/src/components/AssistantTextProcessingForm.vue @@ -215,6 +215,7 @@ import { saveLastSelectedTaskType } from '../assistant.js' const TEXT2TEXT_TASK_TYPE_ID = 'core:text2text' const CHAT_TASK_TYPE_ID = 'chatty-llm' +const TEXT2TEXT_IMPROVE_TASK_TYPE_ID = 'core:text2text:improve' export default { name: 'AssistantTextProcessingForm', @@ -253,6 +254,24 @@ export default { return { providedCurrentTaskId: () => this.selectedTaskId, streaming: () => this.streaming, + improveOutput: (content) => { + if (!this.showImproveWithNewInstructionsButton) { + return + } + this.$emit('new-task') + this.mySelectedTaskTypeId = TEXT2TEXT_IMPROVE_TASK_TYPE_ID + this.$nextTick(() => { + this.$refs?.assistantFormInputs?.setDefaultValues(true) + this.$nextTick(() => { + this.myInputs = { + ...this.myInputs, + input: content, + } + saveLastSelectedTaskType(this.mySelectedTaskTypeId) + }) + }) + }, + canImproveOutput: () => this.showImproveWithNewInstructionsButton, } }, props: { @@ -460,6 +479,20 @@ export default { actionButtonsToShow() { return this.hasOutput ? this.actionButtons : [] }, + contextWriteTaskType() { + const taskType = this.taskTypes.find(tt => tt.id === TEXT2TEXT_IMPROVE_TASK_TYPE_ID) + if (taskType === undefined) { + return null + } + if (this.taskTypeIdList !== null && !this.taskTypeIdList.includes(TEXT2TEXT_IMPROVE_TASK_TYPE_ID)) { + return null + } + return taskType + }, + showImproveWithNewInstructionsButton() { + return this.hasOutput + && this.contextWriteTaskType !== null + }, showRunningEmptyContent() { return this.showSyncTaskRunning && this.myOutputs === null }, diff --git a/src/components/fields/TextInput.vue b/src/components/fields/TextInput.vue index 8372ce86..88ae7c52 100644 --- a/src/components/fields/TextInput.vue +++ b/src/components/fields/TextInput.vue @@ -22,23 +22,33 @@ :title="title" @submit="hasValue && $emit('submit', $event)" @update:model-value="$emit('update:value', $event)" /> - - - - {{ t('assistant', 'Getting results...') }} - - - {{ t('assistant', 'Copy') }} - - +
+ + {{ t('assistant', 'Improve') }} + + + + + {{ t('assistant', 'Getting results...') }} + + + {{ t('assistant', 'Copy') }} + + +