Files
cobble/src/utils/speech-text.test.ts
T
tbenandClaude Opus 5.5 163d9a434c Add dictation and streamed read-aloud to the chat
- A mic in the composer records, transcribes with the bot's
  transcription model (api/admin/bots/transcribe) and writes the text
  into the input at the cursor to edit before sending. Escape cancels;
  recordings aren't stored.
- Every bot message has a read-aloud button that plays
  GET api/admin/bots/speak-message, streamed from the provider as the
  audio is made, so it starts in a couple of seconds. One message plays
  at a time; only the user's own sessions can be read.
- Both buttons stay visible but disabled while the bot has no model for
  them (bot_voice page prop).
- Transcription and speech no longer pick free models automatically:
  they're not available until a model is picked, and Settings says so.
  Transcription lists speech-to-text models only, so the chat-model
  transcript path and its missing-audio check are gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 21:21:04 +01:00

19 lines
650 B
TypeScript

import { describe, expect, test } from "bun:test";
import { AppData } from "@/src/data/app-data";
import speechText from "./speech-text";
describe("speechText", () => {
test("reads refs and markdown plainly", () => {
expect(
speechText({ text: "**Done.** Sign in on [computer:2]: [take-over:2:desktop]" }),
).toBe("Done. Sign in on a computer: a take-over link");
});
test("cuts long messages", () => {
const out = speechText({ text: "a".repeat(AppData.SpeechMaxChars + 50) });
expect(out.length).toBe(AppData.SpeechMaxChars + 1);
expect(out.endsWith("…")).toBe(true);
});
});