From fe52cf446007218aed291d45b98cac14d68dbb27 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Thu, 17 Apr 2025 11:52:39 +0200 Subject: [PATCH] chore: add docs/ai.md about document generation Signed-off-by: Julien Veyssier --- README.md | 2 ++ docs/ai.md | 31 +++++++++++++++++++++++ lib/Service/DocumentGenerationService.php | 9 ------- 3 files changed, 33 insertions(+), 9 deletions(-) create mode 100644 docs/ai.md diff --git a/README.md b/README.md index 623cdf606..ab09eb7cc 100644 --- a/README.md +++ b/README.md @@ -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. +### 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 diff --git a/docs/ai.md b/docs/ai.md new file mode 100644 index 000000000..dcde57cca --- /dev/null +++ b/docs/ai.md @@ -0,0 +1,31 @@ + +# 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. diff --git a/lib/Service/DocumentGenerationService.php b/lib/Service/DocumentGenerationService.php index fb36e0226..ece72d4eb 100644 --- a/lib/Service/DocumentGenerationService.php +++ b/lib/Service/DocumentGenerationService.php @@ -105,15 +105,6 @@ EOF; $stream = fopen('php://memory', 'r+'); fwrite($stream, $text); 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; } }