Skip to content

Fix: no last task type#419

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

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

Conversation

@janepie
Copy link
Member

@janepie janepie commented Dec 9, 2025

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
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
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 => {

src/assistant.js Outdated

// fallback to the last used one
const selectedTaskTypeId = taskType ?? (await getLastSelectedTaskType())?.data
const selectedTaskTypeId = taskType ?? (await getLastSelectedTaskType())
Copy link
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

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
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
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
Copy link
Member Author

janepie commented Dec 9, 2025

Thanks, fixed

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

@marcelklehr marcelklehr left a comment

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