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
8 changes: 6 additions & 2 deletions lib/Controller/ChattyLLMController.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public function regenerateForSession(int $sessionId, int $messageId): JSONRespon
*
* @param int $taskId The message generation task ID
* @param int $sessionId The chat session ID
* @return JSONResponse<Http::STATUS_OK, AssistantChatAgencyMessage, array{}>|JSONResponse<Http::STATUS_EXPECTATION_FAILED, array{task_status: int, slow_pickup: bool, task_output?: array<string, list<numeric|string>|numeric|string>|null}, array{}>|JSONResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_UNAUTHORIZED|Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, array{error: string}, array{}>
* @return JSONResponse<Http::STATUS_OK, AssistantChatAgencyMessage, array{}>|JSONResponse<Http::STATUS_EXPECTATION_FAILED, array{task_status: int, slow_pickup: bool, task_output?: array<string, list<numeric|string>|numeric|string>|null}, array{}>|JSONResponse<Http::STATUS_BAD_REQUEST, array{error: string, task_status?: int, userFacingErrorMessage?: ?string}, array{}>|JSONResponse<Http::STATUS_INTERNAL_SERVER_ERROR|Http::STATUS_UNAUTHORIZED|Http::STATUS_NOT_FOUND, array{error: string}, array{}>
* @throws MultipleObjectsReturnedException
* @throws \OCP\DB\Exception
*
Expand Down Expand Up @@ -610,7 +610,11 @@ public function checkMessageGenerationTask(int $taskId, int $sessionId): JSONRes
}
return new JSONResponse($responsePayload, Http::STATUS_EXPECTATION_FAILED);
} elseif ($task->getstatus() === Task::STATUS_FAILED || $task->getstatus() === Task::STATUS_CANCELLED) {
return new JSONResponse(['error' => 'task_failed_or_canceled', 'task_status' => $task->getstatus()], Http::STATUS_BAD_REQUEST);
return new JSONResponse([
'error' => 'task_failed_or_canceled',
'task_status' => $task->getstatus(),
'userFacingErrorMessage' => $task->getUserFacingErrorMessage(),
], Http::STATUS_BAD_REQUEST);
}
return new JSONResponse(['error' => 'unknown_error', 'task_status' => $task->getstatus()], Http::STATUS_BAD_REQUEST);
}
Expand Down
44 changes: 26 additions & 18 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5052,6 +5052,32 @@
}
}
},
"400": {
"description": "Task processing failed",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
},
"task_status": {
"type": "integer",
"format": "int64"
},
"userFacingErrorMessage": {
"type": "string",
"nullable": true
}
}
}
}
}
},
"500": {
"description": "",
"content": {
Expand Down Expand Up @@ -5118,24 +5144,6 @@
}
}
},
"400": {
"description": "Task processing failed",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
}
}
}
}
}
},
"404": {
"description": "Session was not found",
"content": {
Expand Down
8 changes: 4 additions & 4 deletions src/components/ChattyLLM/ChattyLLMInputForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ export default {
}
} catch (error) {
console.error('checkGenerationTask error:', error)
showError(t('assistant', 'Error generating a response'))
showError(error?.response?.data?.userFacingErrorMessage ?? t('assistant', 'Error generating a response'))
}
this.streamingMessage = null
this.userScrolled = false
Expand Down Expand Up @@ -945,7 +945,7 @@ export default {
}
} catch (error) {
console.error('scheduleGenerationTask error:', error)
showError(t('assistant', 'Error generating a response'))
showError(error?.response?.data?.userFacingErrorMessage ?? t('assistant', 'Error generating a response'))
} finally {
this.loading.llmGeneration = false
this.loading.llmRunning = false
Expand Down Expand Up @@ -973,7 +973,7 @@ export default {
}
} catch (error) {
console.error('scheduleRegenerationTask error:', error)
showError(t('assistant', 'Error regenerating a response'))
showError(error?.response?.data?.userFacingErrorMessage ?? t('assistant', 'Error regenerating a response'))
} finally {
this.loading.llmGeneration = false
this.loading.llmRunning = false
Expand Down Expand Up @@ -1052,7 +1052,7 @@ export default {
if (error.response?.status !== 417) {
console.error('checkTaskPolling error', error)
clearInterval(this.pollMessageGenerationTimerId)
reject(new Error('Message generation task check failed'))
reject(error)
} else {
console.debug('checkTaskPolling, task is still scheduled or running')
this.slowPickup = error.response.data.slow_pickup
Expand Down
Loading