nextcloud / nextcloud/spreed

Migrate to the task processing API

Open
#13,115 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug client: 💻 desktop client: 🤖🍏 mobile feature: chat 💬 feature: recordings ⏺️ technical debt
Dominant language
PHP
Stars
2.2k
Forks
587
Avg merge
18h 27m
Merged PRs (30d)
333

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 https://github.com/nextcloud/assistant/issues/114

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the current Translation and SpeechToText API integrations in Talk, then read the assistant UI example and the Transcribe section of nextcloud/assistant#114. Migrate translation to OCA.Assistant.openAssistantForm with core:text2text:translate and transcription to core:audio2text; verify both flows use the task processing API.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, backend, frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.