Skip to content

Unsloth Studio: return the spoken text from /audio/generate instead of a truncated label - #12386

Merged
danielhanchen merged 8 commits into
unslothai:mainfrom
LeoBorcherding:voice/pr-d-audio-reply-text
Oct 1, 2026
Merged

danielhanchen merged 8 commits into
unslothai:mainfrom
LeoBorcherding:voice/pr-d-audio-reply-text

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces #11074, which closed automatically when its head fork was deleted.

One fix extracted from #6527 by @BardiaKoopah and @LeoBorcherding. It doesn't depend on the voice mode or benchmark PRs.

What this PR changes

  • Backend: /audio/generate used to answer with a status label, [Generated audio from: "<first 100 chars>"], in choices[0].message.content. It now returns the full text the clip speaks. /v1/chat/completions with a TTS model returns the same body, so API clients and the API monitor get the real text instead of a truncated label.
  • Tests: a backend test pinning the full-text reply (fails on main, passes here).

Scope note

An earlier revision also rendered that text under the audio player in chat. For Studio TTS the spoken text is always the user's own prompt, so it showed the same text twice (once in the user bubble, once under the player). That frontend half was removed; the chat still shows the player only, exactly as on main.

donaldfilimon and others added 4 commits September 16, 2026 00:18
The non-streaming audio path renders only <audio-player> and drops
result.choices[0].message.content on the floor. The model returns both -- the
clip and the text it spoke -- and the text is the half that is searchable,
copyable, readable on a muted device, and available to a screen reader.

Show the player above it, which is how a message with an attachment already
reads elsewhere in the thread. A reply with no text renders exactly as before.

Extracted from PR unslothai#6527, where it was one hunk inside a much larger branch; it
is independent of the voice conversation mode and of every other part of it.

Co-authored-by: Bardia Koopah <[email protected]>
Co-authored-by: LeoBorcherding <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TSaSnTn9AUf4wPbCaTTykW
The adapter now keeps the reply text beside the player tag, but the Markdown
renderer short-circuited on the tag and returned only the AudioPlayer, so the
transcript was stored and never shown. The tag is split out before the text
reaches the Markdown pipeline (a React-free helper, so it is unit-testable) and
the player renders above the remaining text; a clip-only reply renders exactly
as before. The conversation export already replaced the tag in place and kept
the surrounding text, so it needed nothing.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ks, whole

choices[0].message.content was a diagnostic label, '[Generated audio from:
"<text[:100]>"]', which the chat now renders under the player and keeps in
history. It is the spoken text itself now. The adapter drops the old label if
an older backend still sends it, so it is never shown as something the
assistant said.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…nd's label

The previous commit changed /audio/generate to answer with the spoken text but
landed without its test or the adapter's guard. This adds both: the route test
asserts a 200-character prompt comes back whole, and spokenReplyText drops the
old '[Generated audio from: ...]' label if an older backend still sends it, so
diagnostic text is never rendered as the assistant's words.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 1, 2026
@shimmyshimmer

shimmyshimmer commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Review record for #12386, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#297.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror 1b2f8cdd7 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 1b2f8cdd7f

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 1b2f8cdd7 (no equivalent commit found on this PR).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

@danielhanchen danielhanchen changed the title Unsloth Studio: keep an audio model's reply text beside its player (extracted from #6527) Unsloth Studio: return the spoken text from /audio/generate instead of a truncated label Oct 1, 2026
@danielhanchen
danielhanchen merged commit abf4cb4 into unslothai:main Oct 1, 2026
6 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants