Skip to content
Open
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
12 changes: 11 additions & 1 deletion src/components/ChattyLLM/ChattyLLMInputForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ import { showError } from '@nextcloud/dialogs'
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
import { loadState } from '@nextcloud/initial-state'
import moment from 'moment'
import { SHAPE_TYPE_NAMES } from '../../constants.js'
import { SHAPE_TYPE_NAMES, TASK_STATUS_INT } from '../../constants.js'

// future: type (text, image, file, etc), attachments, etc support

Expand Down Expand Up @@ -272,6 +272,7 @@ export default {
initialMessages: false,
olderMessages: false,
llmGeneration: false,
llmRunning: false,
titleGeneration: false,
updateTitle: false,
newHumanMessage: false,
Expand Down Expand Up @@ -320,6 +321,7 @@ export default {
async active() {
this.allMessagesLoaded = false
this.loading.llmGeneration = false
this.loading.llmRunning = false
this.loading.titleGeneration = false
this.chatContent = ''
this.msgCursor = 0
Expand Down Expand Up @@ -386,6 +388,7 @@ export default {
showError(t('assistant', 'Error checking if the session is thinking'))
} finally {
this.loading.llmGeneration = false
this.loading.llmRunning = false
this.loading.titleGeneration = false
}
},
Expand Down Expand Up @@ -718,6 +721,7 @@ export default {
try {
this.slowPickup = false
this.loading.llmGeneration = true
this.loading.llmRunning = false
const params = {
sessionId,
}
Expand All @@ -737,13 +741,15 @@ export default {
showError(t('assistant', 'Error generating a response'))
} finally {
this.loading.llmGeneration = false
this.loading.llmRunning = false
}
},

async runRegenerationTask(messageId) {
try {
const sessionId = this.active.id
this.loading.llmGeneration = true
this.loading.llmRunning = false
const regenerationResponse = await axios.get(getChatURL('/regenerate'), { params: { messageId, sessionId } })
const regenerationResponseData = regenerationResponse.data
console.debug('scheduleRegenerationTask response:', regenerationResponse)
Expand All @@ -756,6 +762,7 @@ export default {
showError(t('assistant', 'Error regenerating a response'))
} finally {
this.loading.llmGeneration = false
this.loading.llmRunning = false
}
},

Expand Down Expand Up @@ -801,6 +808,9 @@ export default {
} else {
console.debug('checkTaskPolling, task is still scheduled or running')
this.slowPickup = error.response.data.slow_pickup
if (error.response.data.task_status === TASK_STATUS_INT.running) {
this.loading.llmRunning = true
}
}
})
}, 2000)
Expand Down
12 changes: 10 additions & 2 deletions src/components/ChattyLLM/InputArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
:auto-complete="() => {}"
:link-auto-complete="false"
:disabled="disabled"
:placeholder="loading.llmGeneration ? thinkingText : placeholderText"
:aria-label="loading.llmGeneration ? thinkingText : placeholderText"
:placeholder="placeholder"
:aria-label="placeholder"
:maxlength="64_000"
:multiline="isMobile"
dir="auto"
Expand Down Expand Up @@ -103,6 +103,7 @@ export default {
return {
placeholderText: t('assistant', 'Type a message…'),
thinkingText: t('assistant', 'Processing…'),
scheduledText: t('assistant', 'Waiting…'),
submitBtnAriaText: t('assistant', 'Submit'),
isRecording: false,
audioChatAvailable: loadState('assistant', 'audio_chat_available', false),
Expand All @@ -116,6 +117,13 @@ export default {
chatContentTooLong() {
return this.chatContent.length > MAX_TEXT_INPUT_LENGTH
},
placeholder() {
return this.loading.llmGeneration
? this.loading.llmRunning
? this.thinkingText
: this.scheduledText
: this.placeholderText
},
},

mounted() {
Expand Down
9 changes: 9 additions & 0 deletions src/components/RunningEmptyContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
<div v-if="formattedRuntime">
{{ formattedRuntime }}
</div>
<div class="info-text-block">
{{ t('assistant', 'This task is running in the background.',) }}
<br>
{{ t('assistant', 'You can safely close the assistant or browse other tasks.',) }}
</div>
<NcButton
@click="$emit('background-notify', !isNotifyEnabled)">
<template #icon>
Expand Down Expand Up @@ -165,5 +170,9 @@ export default {
align-items: center;
gap: 2px;
}

.info-text-block {
text-align: center;
}
}
</style>
Loading