Skip to content

Commit 87cc80a

Browse files
authored
Merge pull request #238 from nextcloud/feat/preserve-input
feat: keep input prompt when switching task types
2 parents aca30b7 + b1a500b commit 87cc80a

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/components/AssistantFormInputs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default {
6464
watch: {
6565
selectedTaskType() {
6666
console.debug('[assistant] watch selectedTaskType', this.selectedTaskType, this.selectedTaskTypeId)
67-
this.setDefaultValues(true)
67+
this.setDefaultValues(false)
6868
},
6969
},
7070
mounted() {

src/components/AssistantTextProcessingForm.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,23 @@ export default {
429429
onTaskTypeUserChange() {
430430
this.$emit('new-task')
431431
432+
const lastInput = this.myInputs?.input
433+
|| this.myInputs?.source_input // used in context write
434+
|| this.myInputs?.text // used in document generation
435+
432436
this.$refs?.translateForm?.setDefaultValues(true)
433437
this.$refs?.assistantFormInputs?.setDefaultValues(true)
438+
439+
// keep last prompt if new task type has text input
440+
if (lastInput && this.selectedTaskType?.inputShape?.input) {
441+
this.myInputs.input = lastInput
442+
}
443+
if (lastInput && this.selectedTaskType?.inputShape?.source_input) {
444+
this.myInputs.source_input = lastInput
445+
}
446+
if (lastInput && this.selectedTaskType?.inputShape?.text) {
447+
this.myInputs.text = lastInput
448+
}
434449
},
435450
onSyncSubmit() {
436451
console.debug('[assistant] in form submit ---------', this.myInputs)

0 commit comments

Comments
 (0)