Skip to content

Fix: no last task type - #419

Merged
janepie merged 2 commits into
mainfrom
fix/last-task-type
Dec 9, 2025
Merged

Fix: no last task type#419
janepie merged 2 commits into
mainfrom
fix/last-task-type

Conversation

@janepie

@janepie janepie commented Dec 9, 2025

Copy link
Copy Markdown
Member

No description provided.

Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
@janepie
janepie force-pushed the fix/last-task-type branch from bf1401c to f3e760e Compare December 9, 2025 08:46
Comment thread src/assistant.js Outdated
}
const url = generateUrl('/apps/assistant/config')
return axios.get(url, req)
return axios.get(url, req).data.catch(error => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work, I think. axios.get returns a promise

Suggested change
return axios.get(url, req).data.catch(error => {
return axios.get(url, req).catch(error => {

Comment thread src/assistant.js Outdated

// fallback to the last used one
const selectedTaskTypeId = taskType ?? (await getLastSelectedTaskType())?.data
const selectedTaskTypeId = taskType ?? (await getLastSelectedTaskType())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const selectedTaskTypeId = taskType ?? (await getLastSelectedTaskType())
const selectedTaskTypeId = taskType ?? (await getLastSelectedTaskType())?.data

Comment thread src/assistant.js Outdated
return axios.get(url, req).data.catch(error => {
if (error.response?.status === 404) {
console.debug(t('assistant', 'No last task type available, falling back to default'))
return 'chatty-llm'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return 'chatty-llm'
return {data: 'chatty-llm'}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively you could make the whole function async and await the axios.get call, use a try-catch to catch the error and return the value directly.

Signed-off-by: Jana Peper <jana.peper@nextcloud.com>
@janepie
janepie force-pushed the fix/last-task-type branch from f3e760e to af4f02a Compare December 9, 2025 09:02
@janepie

janepie commented Dec 9, 2025

Copy link
Copy Markdown
Member Author

Thanks, fixed

@janepie
janepie requested a review from marcelklehr December 9, 2025 09:08

@marcelklehr marcelklehr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, didn't test

@janepie
janepie merged commit 638df01 into main Dec 9, 2025
17 checks passed
@janepie
janepie deleted the fix/last-task-type branch December 9, 2025 09:45
@janepie janepie mentioned this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants