Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: schedule task on text prompt input submit event
This enables the Ctrl+Enter shortcut to submit a prompt in the text input field to the AI.

Signed-off-by: Edward Ly <[email protected]>
  • Loading branch information
edward-ly committed May 5, 2025
commit 581fac2ebc3bf7cee8f69681968164b34919c134
1 change: 1 addition & 0 deletions src/components/AssistantFormInputs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
:optional-shape-options="selectedTaskType.optionalInputShapeEnumValues ?? null"
:values="inputs"
:show-advanced="showAdvanced"
@submit="$emit('submit', $event)"
@update:show-advanced="$emit('update:show-advanced', $event)"
@update:values="$emit('update:inputs', $event)" />
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/AssistantTextProcessingForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
:inputs.sync="myInputs"
:selected-task-id="selectedTaskId"
:selected-task-type="selectedTaskType"
:show-advanced.sync="showAdvanced" />
:show-advanced.sync="showAdvanced"
@submit="onSyncSubmit" />
<AssistantFormOutputs v-if="hasOutput"
:inputs="myInputs"
:outputs.sync="myOutputs"
Expand Down
2 changes: 2 additions & 0 deletions src/components/fields/TaskTypeField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:field="field"
:options="options ?? undefined"
:is-output="isOutput"
@submit="$emit('submit', $event)"
@update:value="$emit('update:value', $event)" />
</template>

Expand Down Expand Up @@ -53,6 +54,7 @@ export default {
},

emits: [
'submit',
'update:value',
],

Expand Down
6 changes: 6 additions & 0 deletions src/components/fields/TaskTypeFields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:value="values[key] ?? null"
:options="getInputFieldOptions(field, key)"
:is-output="isOutput"
@submit="onSubmit"
@update:value="onValueChange(key, $event)" />
<!--NcButton v-if="hasOptionalShape"
@click="$emit('update:show-advanced', !showAdvanced)">
Expand Down Expand Up @@ -76,6 +77,7 @@ export default {
},

emits: [
'submit',
'update:values',
],

Expand Down Expand Up @@ -125,6 +127,10 @@ export default {
}
return undefined
},
onSubmit(event) {
console.debug('[assistant] field value submitted', event)
this.$emit('submit', event)
},
onValueChange(key, value) {
const newValues = {
...this.values,
Expand Down
6 changes: 6 additions & 0 deletions src/components/fields/TextField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:label="field.description"
:placeholder="field.placeholder ?? field.description"
:title="field.name"
@submit="onSubmit"
@update:value="onUpdateValue" />
</template>

Expand Down Expand Up @@ -44,6 +45,7 @@ export default {
},

emits: [
'submit',
'update:value',
],

Expand All @@ -62,6 +64,10 @@ export default {
},

methods: {
onSubmit(event) {
console.debug('[Assistant] submit task event', event)
this.$emit('submit', event)
},
onUpdateValue(newValue) {
console.debug('[Assistant] new text value', newValue)
this.$emit('update:value', newValue?.trim())
Expand Down
2 changes: 2 additions & 0 deletions src/components/fields/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
:class="{ shadowed: isOutput }"
:placeholder="placeholder"
:title="title"
@submit="hasValue && $emit('submit', $event)"
@update:value="$emit('update:value', $event)" />
<NcButton v-if="isOutput && hasValue"
class="copy-button"
Expand Down Expand Up @@ -122,6 +123,7 @@ export default {
},

emits: [
'submit',
'update:value',
],

Expand Down