chore: add docs/ai.md about document generation

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Julien Veyssier 2025-04-17 11:52:39 +02:00
parent 785c9ef74d
commit fe52cf4460
No known key found for this signature in database
GPG key ID: 4141FEE162030638
3 changed files with 33 additions and 9 deletions

View file

@ -37,7 +37,9 @@ Collaborative editing of federated documents requires richdocuments version 3.4
**Note:** Due to our content security policy we cannot open a document on a remote instance without reloading the page to allow Nextcloud embedding the remote Collabora Online instance in a frame. **Note:** Due to our content security policy we cannot open a document on a remote instance without reloading the page to allow Nextcloud embedding the remote Collabora Online instance in a frame.
### AI document generation
This app is able to generate office documents from a prompt using AI. See the [AI doc](./docs/ai.md).
## Development setup ## Development setup

31
docs/ai.md Normal file
View file

@ -0,0 +1,31 @@
<!--
- SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
# AI document generation
This app implements task processing providers to generate office documents from a user prompt. You can disable these providers
in the "Artificial intelligence" admin settings section.
This feature is accessible in the Assistant app.
These providers require to setup multiple background job workers because each task schedules an extra one
to actually generate the document content with a TextToText provider.
You need a provider for the TextToText task type for this document generation feature to work.
You can find the apps that implement such provider in
[the overview of AI features](https://docs.nextcloud.com/server/latest/admin_manual/ai/overview.html#overview-of-ai-features).
Look for the "Text processing using LLMs" feature in the app table.
See how to set up background job workers in the
[related page of the Nextcloud admin documentation](https://docs.nextcloud.com/server/latest/admin_manual/ai/overview.html#ai-overview-improve-ai-task-pickup-speed).
## Office text document generation
You can generate docx/odt/pdf documents from a prompt with the "Generate Office text document" task type in the Assistant.
This feature actually first generates markdown from the prompt, then converts it to HTML and then asks Collabora
to convert it into a document.
## Spreadsheet document generation
You can generate xlsx/ods documents from a prompt with the "Generate Office spreadsheet document" task type in the Assistant.
This feature first generates CSV content from the prompt and asks Collabora to convert it into a document.

View file

@ -105,15 +105,6 @@ EOF;
$stream = fopen('php://memory', 'r+'); $stream = fopen('php://memory', 'r+');
fwrite($stream, $text); fwrite($stream, $text);
rewind($stream); rewind($stream);
// This also works fine
//$tmpFilePath = $this->tempManager->getTemporaryFile();
//file_put_contents($tmpFilePath, $text);
//$stream = fopen($tmpFilePath, 'r');
//if ($stream === false) {
// throw new RuntimeException('Failed to generate stream from string');
//}
return $stream; return $stream;
} }
} }