Skip to content

Commit 9f6e6ef

Browse files
committed
feat: keep input prompt when switching task types
Signed-off-by: Edward Ly <[email protected]>
1 parent d470a28 commit 9f6e6ef

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/components/AssistantFormInputs.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ export default {
6262
},
6363
},
6464
watch: {
65-
selectedTaskType() {
66-
console.debug('[assistant] watch selectedTaskType', this.selectedTaskType, this.selectedTaskTypeId)
67-
this.setDefaultValues(true)
68-
},
6965
},
7066
mounted() {
7167
console.debug('[assistant] mounted AssistantFormInputs', this.selectedTaskId, this.selectedTaskType)

src/components/AssistantTextProcessingForm.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,17 @@ export default {
429429
onTaskTypeUserChange() {
430430
this.$emit('new-task')
431431
432+
const lastInput = this.myInputs?.input || this.myInputs?.source_input // used in context write
432433
this.$refs?.translateForm?.setDefaultValues(true)
433434
this.$refs?.assistantFormInputs?.setDefaultValues(true)
435+
436+
// keep last prompt if new task type has text input
437+
if (lastInput && this.selectedTaskType?.inputShape?.input) {
438+
this.myInputs.input = lastInput
439+
}
440+
if (lastInput && this.selectedTaskType?.inputShape?.source_input) {
441+
this.myInputs.source_input = lastInput
442+
}
434443
},
435444
onSyncSubmit() {
436445
console.debug('[assistant] in form submit ---------', this.myInputs)

0 commit comments

Comments
 (0)