Skip to content

Migrate to the task processing API #13115

Open
@julien-nc

Description

Translation and SpeechToText backend APIs are deprecated. Those features are now included in the task processing API (since 30).

The old APIs will stay a few more NC major version. The old SpeechToText API can now use the new providers (for TaskProcessing) so there is no rush to migrate.

The providers for the Translate API and the translation providers for the TaskProcessing API can be installed side by side so there is no rush to migrate there either.

Translation

You can use the assistant's UI to run translation tasks in the UI. If the assistant app is enabled, the OCA.Assistant.openAssistantForm function should be available.

if (OCA.Assistant.openAssistantForm) {
	OCA.Assistant.openAssistantForm({
		appId: 'spreed',
		customId: 'message translation',
		taskType: 'core:text2text:translate',
		inputs: {
			input: 'the content of the message',
		},
		closeOnResult: false,
	}).then(task => {
		if (task.status === 'STATUS_SUCCESSFUL') {
			console.debug('assistant result task output', task.output.output)
		} else {
			console.debug('assistant result task', task)
		}
	})
}

The promise will resolve if the task succeeds, fails or is scheduled for later by the user. The promise result is the task object.
The closeOnResult parameter of OCA.Assistant.openAssistantForm decides if the assistant is closed when the task succeeds of fails. It can be false to stay close to the current behaviour of the translate modal in Talk. The user sees the result in the assistant and there is a "copy" button. The user can then close the assistant modal.

SpeechToText

Transcription can be done with the core:audio2text task type of the taskProcessing API. More details on how to run such task in the backend in the Transcribe section of nextcloud/assistant#114

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      🧭 Planning evaluation (don't pick)

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions