Skip to content

Commit ac66c27

Browse files
committed
Add some comments/clarifications and fix missing function param
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
1 parent 85dd857 commit ac66c27

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

lib/Controller/ChattyLLMController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ public function regenerateForSession(int $sessionId, int $messageId): JSONRespon
655655
}
656656

657657
/**
658-
* Check the status of a generation task
658+
* Check the status of a generation task. The value of slow_pickup will be set to true if the task is not being picked up.
659659
*
660660
* Used by the frontend to poll a generation task status. If the task succeeds, a new message is stored and returned.
661661
*
@@ -711,7 +711,7 @@ public function checkMessageGenerationTask(int $taskId, int $sessionId): JSONRes
711711
}
712712
} elseif ($task->getstatus() === Task::STATUS_RUNNING || $task->getstatus() === Task::STATUS_SCHEDULED) {
713713
$startTime = $task->getStartedAt() ?? time();
714-
$slowPickup = $task->getScheduledAt() + 60 * 5 < $startTime;
714+
$slowPickup = ($task->getScheduledAt() + (60 * 5)) < $startTime;
715715
return new JSONResponse(['task_status' => $task->getstatus(), 'slow_pickup' => $slowPickup], Http::STATUS_EXPECTATION_FAILED);
716716
} elseif ($task->getstatus() === Task::STATUS_FAILED || $task->getstatus() === Task::STATUS_CANCELLED) {
717717
return new JSONResponse(['error' => 'task_failed_or_canceled', 'task_status' => $task->getstatus()], Http::STATUS_BAD_REQUEST);

openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3544,7 +3544,7 @@
35443544
"/ocs/v2.php/apps/assistant/chat/check_generation": {
35453545
"get": {
35463546
"operationId": "chattyllm-check-message-generation-task",
3547-
"summary": "Check the status of a generation task",
3547+
"summary": "Check the status of a generation task. The value of slow_pickup will be set to true if the task is not being picked up.",
35483548
"description": "Used by the frontend to poll a generation task status. If the task succeeds, a new message is stored and returned.",
35493549
"tags": [
35503550
"chat_api"

package-lock.json

Lines changed: 23 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
"@nextcloud/event-bus": "^3.1.0",
4949
"@nextcloud/files": "^3.11.0",
5050
"@nextcloud/initial-state": "^2.0.0",
51-
"@nextcloud/l10n": "^3.1.0",
51+
"@nextcloud/l10n": "~3.3.0",
5252
"@nextcloud/moment": "^1.3.1",
5353
"@nextcloud/router": "^3.0.0",
54-
"@nextcloud/vue": "^9.0.0-rc.4",
54+
"@nextcloud/vue": "^9.0.0-rc.5",
5555
"extendable-media-recorder": "^9.2.11",
5656
"extendable-media-recorder-wav-encoder": "^7.0.129",
5757
"moment": "^2.30.1",

src/components/RunningEmptyContent.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default {
110110
111111
computed: {
112112
tooLongForScheduling() {
113-
return this.scheduledAt !== null && this.scheduledAt + 60 * 5 < this.now
113+
return this.scheduledAt !== null && (this.scheduledAt + (60 * 5)) < this.now
114114
},
115115
TASK_STATUS_STRING() {
116116
return TASK_STATUS_STRING
@@ -133,6 +133,7 @@ export default {
133133
},
134134
135135
mounted() {
136+
// Need to use a timer to update the state for now otherwise the component won't re-render when the time changes
136137
this.timer = setInterval(() => {
137138
console.debug('scheduledAt', this.scheduledAt)
138139
console.debug('status', this.taskStatus)

src/views/AssistantPage.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export default {
196196
this.task.completionExpectedAt = updatedTask.completionExpectedAt
197197
this.task.scheduledAt = updatedTask.scheduledAt
198198
199-
pollTask(updatedTask.id, this).then(finishedTask => {
199+
pollTask(updatedTask.id, this, this.updateTask).then(finishedTask => {
200200
console.debug('pollTask.then', finishedTask)
201201
if (finishedTask.status === TASK_STATUS_STRING.successful) {
202202
this.task.output = finishedTask?.output

0 commit comments

Comments
 (0)