Skip to content

Fix TTS output text: audio not image#28133

Merged
elithrar merged 2 commits intoproductionfrom
opencode/issue25780-20260206110758
Feb 13, 2026
Merged

Fix TTS output text: audio not image#28133
elithrar merged 2 commits intoproductionfrom
opencode/issue25780-20260206110758

Conversation

@ask-bonk
Copy link
Contributor

@ask-bonk ask-bonk bot commented Feb 6, 2026

For melotts, the output is a oneOf schema, so model.schema.output.format is undefined (not "binary"), meaning it falls through to the SchemaViewer component. This is fine — the issue only affects models where the top-level output has format: "binary".

The image models with binary output have contentType values like "image/png" or "image/jpeg", which don't start with "audio/", so they'll still show the original "image in JPEG or PNG format" text.

Here's a summary of the change:

Problem: The model page template at src/pages/workers-ai/models/[name].astro:304 had a hardcoded description for all binary output models saying "The binding returns a ReadableStream with the image in JPEG or PNG format". This is incorrect for text-to-speech models like @cf/deepgram/aura-1, @cf/deepgram/aura-2-en, and @cf/deepgram/aura-2-es, which output audio, not images.

Fix: The template now checks the model's output contentType. If it starts with "audio/", it displays "audio in MPEG format" (derived from the actual content type). Otherwise, it falls back to the existing "image in JPEG or PNG format" text. This correctly handles both image generation models and TTS models.

Closes #25780

github run

Co-authored-by: elithrar <elithrar@users.noreply.github.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
*.astro @cloudflare/content-engineering, @kodster28

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

@elithrar
Copy link
Collaborator

elithrar commented Feb 6, 2026

/bonk fix the syntax issues

11:11:03 [check] Getting diagnostics for Astro files in /home/runner/work/cloudflare-docs/cloudflare-docs...
vitest.workspace.ts:7:19 - warning ts(6387): The signature '(config: TestProjectConfiguration[]): TestProjectConfiguration[]' of 'defineWorkspace' is deprecated.

7 const workspace = defineWorkspace([
                    ~~~~~~~~~~~~~~~
vitest.workspace.ts:1:10 - warning ts(6385): 'defineWorkspace' is deprecated.

1 import { defineWorkspace, defineProject } from "vitest/config";
           ~~~~~~~~~~~~~~~

src/components/OneTrust.astro:20:11 - warning ts(6133): 'OptanonWrapper' is declared but its value is never read.

20  function OptanonWrapper() {}
             ~~~~~~~~~~~~~~

src/pages/workers-ai/models/[name].astro:305:110 - error ts(2339): Property 'replace' does not exist on type '{}'.

305       <>The binding returns a <code>ReadableStream</code> with the audio in {model.schema.output.contentType.replace("audio/", "").toUpperCase()} format (check the model's output schema).</>
                                                                                                                 ~~~~~~~
src/pages/workers-ai/models/[name].astro:304:40 - error ts(2339): Property 'startsWith' does not exist on type '{}'.

304      {model.schema.output.contentType?.startsWith("audio/") ? (
                                           ~~~~~~~~~~

Result (285 files): 
- 2 errors
- 0 warnings
- 3 hints

Error: Process completed with exit code 1.

@elithrar elithrar requested a review from mchenco February 6, 2026 12:34
@ask-bonk
Copy link
Contributor Author

ask-bonk bot commented Feb 6, 2026

The two type errors are fixed by adding as string casts to model.schema.output.contentType at src/pages/workers-ai/models/[name].astro:304-305. The property's type definition is {} but it holds string values like "audio/mpeg" at runtime, so the cast is needed for .startsWith() and .replace() to compile.

github run

@elithrar elithrar enabled auto-merge (squash) February 13, 2026 21:45
@elithrar elithrar merged commit 53ecba8 into production Feb 13, 2026
9 checks passed
@elithrar elithrar deleted the opencode/issue25780-20260206110758 branch February 13, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change output text in Aura 1 TTS Docs

3 participants