From eacd109352c9bd80c5e867b45404ba12e324ba0f Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Fri, 26 Jul 2024 15:20:36 +0200 Subject: [PATCH] feat(assistant): inject 'insert' button when displaying a task result Signed-off-by: Julien Veyssier --- src/components/Assistant.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/Assistant.vue b/src/components/Assistant.vue index 53180b9bbdc..487448fd502 100644 --- a/src/components/Assistant.vue +++ b/src/components/Assistant.vue @@ -287,7 +287,19 @@ export default { emit('text:translate-modal:show', { content: this.selection || '' }) }, async openResult(task) { - window.OCA.Assistant.openAssistantTask(task) + window.OCA.Assistant.openAssistantTask(task, { + isInsideViewer: true, + actionButtons: [ + { + type: 'primary', + title: t('text', 'Insert result'), + label: t('text', 'Insert result'), + onClick: (lastTask) => { + this.insertResult(lastTask) + }, + }, + ], + }) }, async insertResult(task) { this.$editor.commands.insertContent(task.output.output)