Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
8 changes: 7 additions & 1 deletion src/components/ChattyLLM/InputArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:placeholder="loading.llmGeneration ? thinkingText : placeholderText"
:aria-label="loading.llmGeneration ? thinkingText : placeholderText"
:maxlength="1600"
:multiline="false"
:multiline="isMobile"
dir="auto"
@update:value="$emit('update:chatContent', $event)"
@submit="$emit('submit', $event)" />
Expand All @@ -34,6 +34,8 @@
<script>
import SendIcon from 'vue-material-design-icons/Send.vue'

import isMobile from '../../mixins/isMobile.js'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcRichContenteditable from '@nextcloud/vue/dist/Components/NcRichContenteditable.js'

Expand All @@ -54,6 +56,10 @@ export default {
NcRichContenteditable,
},

mixins: [
isMobile,
],

props: {
chatContent: {
type: String,
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
9 changes: 8 additions & 1 deletion src/components/fields/TextInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
ref="input"
:value="value ?? ''"
:link-autocomplete="false"
:multiline="true"
:multiline="isMobile"
class="editable-input"
: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 @@ -48,6 +49,7 @@ import ClipboardCheckOutlineIcon from 'vue-material-design-icons/ClipboardCheckO
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcRichContenteditable from '@nextcloud/vue/dist/Components/NcRichContenteditable.js'

import isMobile from '../../mixins/isMobile.js'
import CopyIcon from '../icons/CopyIcon.vue'

import axios from '@nextcloud/axios'
Expand Down Expand Up @@ -90,6 +92,10 @@ export default {
CopyIcon,
},

mixins: [
isMobile,
],

props: {
id: {
type: String,
Expand Down Expand Up @@ -122,6 +128,7 @@ export default {
},

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

Expand Down
28 changes: 28 additions & 0 deletions src/mixins/isMobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

export default {
data() {
return {
isMobile: this._isMobile(),
}
},
beforeMount() {
window.addEventListener('resize', this._onResize)
},
beforeDestroy() {
window.removeEventListener('resize', this._onResize)
},
methods: {
_onResize() {
// Update mobile mode
this.isMobile = this._isMobile()
},
_isMobile() {
// check if content width is under 768px
return document.documentElement.clientWidth < 768
},
},
}
Loading