Skip to content

Commit 638df01

Browse files
authored
Merge pull request #419 from nextcloud/fix/last-task-type
Fix: no last task type
2 parents 797516a + af4f02a commit 638df01

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/Controller/AssistantController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getAssistantTaskResultPage(int $taskId): TemplateResponse {
6363
public function getAssistantStandalonePage(): TemplateResponse {
6464
if ($this->userId !== null) {
6565
$task = new Task(
66-
$this->config->getUserValue($this->userId, Application::APP_ID, 'last_task_type'),
66+
$this->config->getUserValue($this->userId, Application::APP_ID, 'last_task_type', 'chatty-llm'),
6767
['something' => ''],
6868
Application::APP_ID,
6969
$this->userId,

src/assistant.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,14 @@ async function getLastSelectedTaskType() {
409409
},
410410
}
411411
const url = generateUrl('/apps/assistant/config')
412-
return axios.get(url, req)
412+
return axios.get(url, req).catch(error => {
413+
if (error.response?.status === 404) {
414+
console.debug(t('assistant', 'No last task type available, falling back to default'))
415+
return { data: 'chatty-llm' }
416+
}
417+
418+
console.error(error)
419+
})
413420
}
414421

415422
async function saveLastTargetLanguage(targetLanguage) {

0 commit comments

Comments
 (0)