Skip to content

Commit 3625eac

Browse files
committed
Disable submit when uploading
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
1 parent adb7bd8 commit 3625eac

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/Listener/ChattyLLMTaskListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function handle(Event $event): void {
134134
$this->runTtsIfNeeded($sessionId, $message, $taskTypeId, $task->getUserId());
135135
if ($isMultimodalChat) {
136136
$attachments = $taskOutput['output_attachments'] ?? [];
137-
$attachments = array_map(function($attachment) {
137+
$attachments = array_map(function ($attachment) {
138138
return [
139139
'type' => 'File',
140140
'file_id' => $attachment,

lib/Service/ChatService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public function scheduleMessageGeneration(?string $userId, int $sessionId, int $
438438
$assistantService = $this->assistantService;
439439
$historyMessages = array_map(static function (Message $message) use ($userId, $assistantService) {
440440
$attachments = $message->jsonSerialize()['attachments'];
441-
// Attachments that were generated need to be saved in the user's files so they are ac
441+
// Attachments that were generated need to be saved in the user's files so they are accessible to provider
442442
$content = array_map(static function (array $attachment) use ($userId, $assistantService, $message) {
443443
if ($message->getRole() === Message::ROLE_ASSISTANT) {
444444
$info = $assistantService->saveOutputFile($userId, $message->getOcpTaskId(), $attachment['file_id']);

src/components/ChattyLLM/InputArea.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<NcButton v-if="!audioChatAvailable || chatContent"
5858
class="input-area__button-box__button"
5959
:aria-label="submitBtnAriaText"
60-
:disabled="disabled || !chatContent.trim() || chatContentTooLong"
60+
:disabled="disabled || isUploading || !chatContent.trim() || chatContentTooLong"
6161
variant="primary"
6262
@click="onSubmitText">
6363
<template #icon>
@@ -183,7 +183,7 @@ export default {
183183
return this.loading.llmGeneration || this.loading.olderMessages || this.loading.initialMessages || this.loading.titleGeneration || this.loading.newHumanMessage || this.loading.newSession
184184
},
185185
chatContentTooLong() {
186-
return this.chatContent.length > MAX_TEXT_INPUT_LENGTH && this.attachedFileIds.length > MAX_ATTACHED_FILES
186+
return this.chatContent.length > MAX_TEXT_INPUT_LENGTH || this.attachedFileIds.length > MAX_ATTACHED_FILES
187187
},
188188
placeholder() {
189189
return this.loading.llmGeneration
@@ -227,7 +227,7 @@ export default {
227227
})
228228
},
229229
onSubmitText(e) {
230-
if (!this.chatContentTooLong) {
230+
if (!this.chatContentTooLong && !this.isUploading) {
231231
this.$emit('submit', this.attachedFileIds)
232232
this.attachedFileIds = []
233233
}

0 commit comments

Comments
 (0)