Skip to content

Commit c113290

Browse files
authored
Merge pull request #262 from nextcloud/fix/noid/preserve-inputs
Fix input preservation
2 parents 92e7aae + 51a7897 commit c113290

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/components/AssistantTextProcessingForm.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,18 +435,24 @@ export default {
435435
|| this.myInputs?.source_input // used in context write
436436
|| this.myInputs?.text // used in document generation
437437
438+
if (typeof lastInput === 'string' || lastInput instanceof String) {
439+
OCA.Assistant.last_text_input = lastInput
440+
}
441+
438442
this.$refs?.translateForm?.setDefaultValues(true)
439443
this.$refs?.assistantFormInputs?.setDefaultValues(true)
440444
441-
// keep last prompt if new task type has text input
442-
if (lastInput && this.selectedTaskType?.inputShape?.input) {
443-
this.myInputs.input = lastInput
444-
}
445-
if (lastInput && this.selectedTaskType?.inputShape?.source_input) {
446-
this.myInputs.source_input = lastInput
447-
}
448-
if (lastInput && this.selectedTaskType?.inputShape?.text) {
449-
this.myInputs.text = lastInput
445+
// keep last prompt if it's a string and if the new task type has text input
446+
if (OCA.Assistant.last_text_input) {
447+
if (this.selectedTaskType?.inputShape?.input && this.selectedTaskType?.inputShape?.input.type === SHAPE_TYPE_NAMES.Text) {
448+
this.myInputs.input = OCA.Assistant.last_text_input
449+
}
450+
if (this.selectedTaskType?.inputShape?.source_input && this.selectedTaskType?.inputShape?.source_input.type === SHAPE_TYPE_NAMES.Text) {
451+
this.myInputs.source_input = OCA.Assistant.last_text_input
452+
}
453+
if (this.selectedTaskType?.inputShape?.text && this.selectedTaskType?.inputShape?.text.type === SHAPE_TYPE_NAMES.Text) {
454+
this.myInputs.text = OCA.Assistant.last_text_input
455+
}
450456
}
451457
},
452458
onSyncSubmit() {

0 commit comments

Comments
 (0)