nextcloud / nextcloud/integration_openai

Chunking of long strings for TTS

Open
#379 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
PHP
Stars
75
Forks
32
Avg merge
9d 8h
Merged PRs (30d)
4

Description

Which version of assistant are you using?

2.13.0

Which version of Nextcloud are you using?

32.0.11

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Chrome Version 148.0.7778.179

Describe the Bug

Text-to-Speech generation fails when the input text exceeds the maximum length accepted by the OpenAI TTS API.

Instead of reporting a TTS-related error, the integration returns a misleading message:

OpenAI/LocalAI's text to image generation failed

although the request is sent to the audio endpoint.

Additional information

PDF summarization using GPT-4.1-mini works correctly with large documents, so the issue appears specific to the TTS pipeline.

Expected Behavior

Expected result

The integration should automatically split long text into chunks smaller than the OpenAI TTS input limit.

  • Alternatively, the UI should prevent submission of oversized text.
  • Error messages should refer to Text-to-Speech instead of Text-to-Image.
  • The actual OpenAI validation error should be surfaced to the user.
To Reproduce

Steps to Reproduce

Configure OpenAI as AI provider.
Configure a TTS model (gpt-4o-mini-tts or tts-1).
Select a long document (e.g. PDF/manual).
Generate speech from the document.

Actual result

The job fails with:

RuntimeException
OpenAI/LocalAI's text to image generation failed with:
API request error:
[{
'type': 'string_too_long',
'loc': ('body', 'input'),
'msg': 'String should have at most 4096 characters',
'ctx': {'max_length': 4096}
}]

Other log entries also show:

Invalid URL (POST /v1/audio/speech)

and

OpenAI/LocalAI's text to image generation failed

even though the request is clearly related to Text-to-Speech.

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 at the TTS pipeline that sends POST /v1/audio/speech and trace how oversized input and API validation errors are handled. Reproduce with a long PDF or manual using the configured TTS model, then verify that long text is handled or rejected clearly and that failures identify Text-to-Speech rather than Text-to-Image.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.