Skip to content

Support hosting the voice/signaling server on a separate host - #7

Merged
MohamedFuad16 merged 2 commits into
mainfrom
claude/signaling-server-azure-0d30j2
Jul 10, 2026
Merged

MohamedFuad16 merged 2 commits into
mainfrom
claude/signaling-server-azure-0d30j2

Conversation

@MohamedFuad16

Copy link
Copy Markdown
Owner

The voice WebSocket endpoints (/api/voice-broker, /api/voice-agent) cannot
run on Vercel serverless, so voice mode needs a long-lived host (Azure VM).

  • Client: VITE_VOICE_WS_URL overrides the voice WebSocket base URL so the
    deployed app can target a dedicated voice server instead of its own host.
  • Server: VOICE_ALLOWED_ORIGINS allowlists web app origins for the broker's
    cross-origin WebSocket handshake, keeping the same-origin default intact.
  • Document the Azure split and VM requirements in docs/azure-voice-server.md.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01G44QpwoYEKBiJAVActtSPp

claude added 2 commits July 10, 2026 00:42
The voice WebSocket endpoints (/api/voice-broker, /api/voice-agent) cannot
run on Vercel serverless, so voice mode needs a long-lived host (Azure VM).

- Client: VITE_VOICE_WS_URL overrides the voice WebSocket base URL so the
  deployed app can target a dedicated voice server instead of its own host.
- Server: VOICE_ALLOWED_ORIGINS allowlists web app origins for the broker's
  cross-origin WebSocket handshake, keeping the same-origin default intact.
- Document the Azure split and VM requirements in docs/azure-voice-server.md.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G44QpwoYEKBiJAVActtSPp
- PDF viewer: serve pdf.js cMaps + standard fonts (new vite plugin) so
  Japanese/CJK PDFs render their text instead of blank pages.
- Chat: render markdown live while streaming (no raw-syntax flash), with
  throttled ~20fps commits so parsing stays smooth on long answers.
- Language: replies now follow the language of the user's message instead
  of being forced to the app UI language.
- Mermaid: cohesive base theme (dark zinc for chat, light for revision
  books), pill edge labels, rounded nodes, wider spacing, CJK-safe fonts.
- Home: remove the intro card panel background/overlays that separated the
  navbar and settings icon; pin carousel dots to the bottom, aligned with
  the chat button; unify page background tone.
- Web images: genmoji-style materialize animation (blur condense, light
  sweep, halo) with stagger and reduced-motion support.
- Read Aloud: fall back to browser speech synthesis when server TTS keys
  are missing, and route CJK text away from English-only Deepgram voices;
  stop control cancels browser speech too.
- Chat actions: remove Add to Graph (keep Create Flashcard + Read Aloud).
- Library Context dropdown: full chat-bar-width panel with scroll instead
  of a narrow popover.
- Revision books: enforce a student-revision chapter format (TL;DR quote,
  key ideas, worked example, common mistakes, self-check) plus blockquote
  callouts and tighter heading rhythm; flashcard prompt now generates
  atomic recall cards in the source language; larger flashcard.
- Tests: drop Add to Graph cases, fix duplicate-text query in revision
  flow test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G44QpwoYEKBiJAVActtSPp
Copilot AI review requested due to automatic review settings July 10, 2026 01:24
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tutor-system-architecture Building Building Preview, Comment Jul 10, 2026 1:25am

@MohamedFuad16
MohamedFuad16 merged commit f032791 into main Jul 10, 2026
2 of 3 checks passed
@MohamedFuad16
MohamedFuad16 deleted the claude/signaling-server-azure-0d30j2 branch July 10, 2026 01:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR primarily enables running the voice/signaling WebSocket endpoints on a separate long-lived host (e.g. Azure VM) while keeping the web app on Vercel, by adding a client-side WebSocket base URL override and a server-side origin allowlist for cross-origin WS handshakes. It also includes several additional UI/UX, PDF rendering, Mermaid theming, and test updates.

Changes:

  • Add VITE_VOICE_WS_URL support in the client so voice sockets can target a dedicated voice server host.
  • Add VOICE_ALLOWED_ORIGINS allowlist on the server to permit cross-origin WebSocket handshakes for /api/voice-broker while keeping same-origin behavior by default.
  • Add pdf.js CJK asset serving/copying and various UI/mermaid/TTS behavior updates with corresponding test adjustments.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vite.config.ts Adds a Vite plugin to serve/copy pdf.js cMaps and standard fonts into the build output.
src/components/PdfViewer.tsx Configures react-pdf/pdf.js to use cMaps and standard fonts from /pdfjs-assets/....
src/components/ChatPanel.tsx Adds configurable voice WS base URL, updates Mermaid theming/styling, adjusts streamed markdown rendering, updates Read Aloud fallback behavior, and removes “Add to Graph”.
server.ts Adds VOICE_ALLOWED_ORIGINS allowlist support and updates prompt/system-instruction behavior.
docs/azure-voice-server.md Documents the Vercel (web) + Azure VM (voice WS) split and deployment requirements.
.env.example Documents and adds VITE_VOICE_WS_URL and VOICE_ALLOWED_ORIGINS example entries.
src/views/StudyView.tsx Adjusts StudyView layout/styling.
src/views/RevisionView.tsx Updates Mermaid initialization and various RevisionView UI styles/markdown component rendering.
tests/rendered-revision-flows.test.tsx Updates assertion to handle multiple “Retrieval Practice” occurrences.
tests/rendered-chatpanel-expanded.test.tsx Updates tests to reflect removal of “Add to Graph” and removes the related follow-up request test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +949 to +953
if (configured) {
return configured
.replace(/^https:/i, "wss:")
.replace(/^http:/i, "ws:")
.replace(/\/+$/, "");
Comment thread vite.config.ts
Comment on lines +15 to +18
// pdf.js needs its cMaps (CJK character maps) and standard fonts served as
// static files or Japanese/Chinese/Korean PDFs render without any text. This
// serves them from node_modules in dev and copies them into dist on build.
const pdfjsAssetsPlugin = (): Plugin => {

This branch was successfully deployed

1 active deployment
Preview — fe3a59f3 Deployed Jul 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants