Skip to content

Commit

Permalink
fix resolveMetaTaskToOcpTask, keep OCA.TPAssistant.openAssistantResul…
Browse files Browse the repository at this point in the history
…t for retro compatibility

Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Feb 1, 2024
1 parent c5c94ae commit 15b317c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { getRequestToken } from '@nextcloud/auth'
__webpack_nonce__ = btoa(getRequestToken()) // eslint-disable-line
__webpack_public_path__ = linkTo('assistant', 'js/') // eslint-disable-line

export async function openAssistantForm(params) {
return openAssistantTextProcessingForm(params)
}

/**
* Creates an assistant modal and return a promise which provides the result
*
Expand Down Expand Up @@ -158,8 +162,8 @@ async function resolveMetaTaskToOcpTask(metaTask) {
return null
}

const url = generateOcsUrl('textprocessing/tasks/{taskId}', { taskId: metaTask.ocpTaskId })
axios.post(url).then(response => {
const url = generateOcsUrl('textprocessing/task/{taskId}', { taskId: metaTask.ocpTaskId })
axios.get(url).then(response => {
console.debug('resolved meta task', response.data?.ocs?.data?.task)
return response.data?.ocs?.data?.task
}).catch(error => {
Expand Down
7 changes: 6 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { handleNotification, addAssistantMenuEntry, openAssistantTextProcessingForm, openAssistantTaskResult } from './assistant.js'
import {
handleNotification, addAssistantMenuEntry,
openAssistantForm, openAssistantTextProcessingForm,
openAssistantTaskResult,
} from './assistant.js'
import { subscribe } from '@nextcloud/event-bus'
import { loadState } from '@nextcloud/initial-state'

Expand All @@ -13,6 +17,7 @@ function init() {
* @namespace
*/
OCA.TPAssistant = {
openAssistantForm,
openAssistantTextProcessingForm,
openAssistantTaskResult,
}
Expand Down

0 comments on commit 15b317c

Please sign in to comment.