mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #7353] [MERGED] feat(calls): let Calls use your own speech-to-text server #7696
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7696
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7353
Author: @SpicyMarinara
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @SpicyMarinara
Base:
staging← Head:feat/7344-custom-speech-to-text📝 Commits (8)
9ba3294feat(calls): let Calls use your own speech-to-text server (#7344)f24d4f7Move the CHANGELOG entry away from other open PRs4e502c6fix(calls): keep a pending Speech to Text edit when leaving Connections71a79fffix(calls): save Speech to Text edits in order and keep failed onescc5e923fix(calls): make Speech to Text help lines single sentences3fd12d9fix(calls): keep Speech to Text secrets out of logs and clear them with Connections5140debfix(calls): keep Speech to Text edits and long keys after leaving Connections5b931aafix(calls): send a Speech to Text edit once when the language changes📊 Changes
21 files changed (+1059 additions, -7 deletions)
View changed files
📝
.env.example(+1 -0)📝
CHANGELOG.md(+1 -0)📝
docs/CONFIGURATION.md(+1 -0)📝
docs/conversation/calls.md(+24 -2)📝
docs/data/clearing-data.md(+1 -1)📝
docs/development/optional-agent-packages.md(+1 -0)➕
e2e/speech-to-text-card.e2e.ts(+90 -0)📝
packages/client/src/components/panels/ConnectionsPanel.tsx(+4 -0)➕
packages/client/src/components/panels/settings/SpeechToTextCard.tsx(+296 -0)➕
packages/client/src/hooks/use-speech-to-text.ts(+46 -0)📝
packages/client/src/localization/locales/en.json(+20 -0)📝
packages/server/src/config/runtime-config.ts(+4 -0)📝
packages/server/src/routes/admin.routes.ts(+9 -1)📝
packages/server/src/routes/index.ts(+2 -0)➕
packages/server/src/routes/speech-to-text.routes.ts(+41 -0)📝
packages/server/src/services/capability-packages/capability-integrations.service.ts(+16 -2)📝
packages/server/src/services/capability-packages/capability-module-runtime.service.ts(+1 -1)➕
packages/server/src/services/speech-to-text.service.ts(+210 -0)📝
packages/shared/src/types/generation-integration.ts(+16 -0)📝
packages/shared/src/types/tts.ts(+35 -0)...and 1 more files
📄 Description
Linked issue
Closes #7344
Why this change
conversation-calls.routes.ts,POST /:id/media, which calls its own bundled copy ofSidecarSpeechService.transcribeWav). Settings, stored secrets, outbound URL policy and the package capability API belong to the Engine (AGENTS.md), so this PR adds the Engine half: the setting and a host call that Calls can use. Calls needs a small follow-up update to use it (see "Follow-up in Marinara-Agents" below).What changed
whisper-1), optional Language code, and a Test button that saves and sends a one-second silent clip. Errors use the steady accent, so they do not pulse with Accent Pulse; the card uses theme tokens only.GET/PUT /api/speech-to-text/configandPOST /api/speech-to-text/test(newspeech-to-text.routes.ts,services/speech-to-text.service.ts). Requests go to<base URL>/audio/transcriptionsas OpenAI-style multipart (file,model,response_format=json, optionallanguage) throughsafeFetch. As for model providers, a server on the same machine works as is; other private or LAN addresses need the newSTT_LOCAL_URLS_ENABLED=true. Limits: 25 MB upload, 2-minute timeout (30 s for Test), 1 MB response. The key never appears in responses, errors or logs.api.runtime.integrations.speech.transcribe(audio, { filename, mimeType, signal })resolves the transcript, ornullwhile the server is off, so a package keeps Local Whisper. It requires thenetworkpermission (Calls already has it). It is an optional member, likegetGameState, so no capability API bump: packages feature-detect it.FormDatabody throws an uncaughtERR_INVALID_STATEand crashes the server process; pre-encoding avoids it.docs/conversation/calls.md(new "Use your own speech-to-text server" section and a troubleshooting entry),docs/CONFIGURATION.md(STT_LOCAL_URLS_ENABLED),docs/development/optional-agent-packages.md(the host member),.env.example, CHANGELOG.scripts/regressions/speech-to-text-server.regression.tswith a loopback fake STT server (fixed routes and fixed delays): masked and encrypted key round trip, multipart fields, trailing slash and full-endpoint URLs, plain-text answers, provider errors without the key, hostnullwhen off, the network permission, refusal of private, metadata andfile:addresses naming the flag, timeout, cancellation and size cap.Follow-up in Marinara-Agents (Calls package)
sources/engine/packages/server/src/routes/conversation-calls.routes.ts,/:id/medialocal-Whisper branch: tryruntime.integrations?.speech?.transcribe?.(buffer, { filename: "call-audio.wav", mimeType: "audio/wav" })first, and fall back tosidecarSpeechService.transcribeWav(buffer)when it is missing or resolvesnull.scripts/build-feature-packages.mjs(Callsactivate) passesapi.runtimein the route options.CALL_MIC_SILENCE_MS = 3_000inConversationCallSurface.tsx: three seconds of quiet ends and sends the recording. While that piece is transcribed, anything else you say is dropped with "Still processing your last voice message." That fix also belongs in the package; it is not changed here.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
http://localhost:8000/v1) and clicking Test shows "The server answered.", and that a wrong address shows the server's reason under the button.Agent-run checks:
pnpm check(pass, through the shared slot limiter, after the last code change);node ./scripts/run-regressions.mjs --filter scripts/regressions/speech-to-text-server(pass; it crashed on the undiciFormDataabort before the pre-encoding fix);node ./scripts/run-regressions.mjs --filter scripts/regressions/capability-integrations(pass);pnpm localization:check(pass). A temporary Playwright proof (deleted, not committed) drove the real Engine server with a fake loopback STT server: the card showed only with a mocked Calls install, saved the settings, Test reached/v1/audio/transcriptionswith the key, the saved key came back masked, and a wrong path showed "The speech-to-text server answered 404: Not Found". It passed on desktop Chromium and mobile Chromium. On mobile WebKit, the first assertion found settings left by the parallel mobile Chromium run on the shared server; screenshots show the card rendering correctly there.Local CodeRabbit (three runs): fixed a pending autosave dropped when the card unmounts, out-of-order or failed autosaves losing the newest edit, the regression accepting any 4xx/5xx for a bad language code (it now uses the app's error handler and expects 400), a long CHANGELOG entry and two-sentence help copy. No findings were dismissed.
Security verification follow-up (
3fd12d9c8): a server URL with a user name or password reachedfetch, which rejects it with the full URL in the error, and the service logged that error at warn level. An API key with a line break failed the same way and logged the whole key. Both are now refused before any request is made, and a?,#or invalid URL gets a clear message. Danger Zone → Connections now also clears the Speech to Text settings and key, as it does for Text to Speech (docs/data/clearing-data.mdupdated).speech.transcribeno longer passes the internaltimeoutMsthrough from packages. The regression covers each change and fails without it.pnpm checkpasses.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Translation follow-up: #7355 (
docs/conversation/calls.md,docs/CONFIGURATION.md,docs/development/optional-agent-packages.md,docs/data/clearing-data.md).UI evidence (if applicable)
Screenshots were taken locally (desktop, phone width, dark theme). They are not attached.
Summary by CodeRabbit
STT_LOCAL_URLS_ENABLED=trueto allow them; a server on the same machine works without this setting.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.