Skip to content

Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.

fix: push full transcript (words[]) to UI state so captions can render

Nika Siradze6a6508644b73
diff --git a/src/server.ts b/src/server.ts
index c20d943..1677582 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -27,6 +27,8 @@ const log = childLogger("server");
* Fire-and-forget notification to the optional Web UI.
* Never throws — the UI may not be running, which is expected.
*/
+const transcriptCache = new TranscriptCache();
+
async function uiPing(body: Record<string, unknown>): Promise<void> {
try {
await fetch("http://localhost:3847/api/ui-state", {
@@ -241,17 +243,21 @@ export function createServer(): McpServer {
try {
const result = await handleTranscribe({ file_path, model_size, language, enable_diarization, num_speakers });
- // Push transcript to Web UI state (fire-and-forget)
+ // Push FULL transcript (words[] + segments[]) to Web UI state from the
+ // on-disk cache — NOT the trimmed MCP response. Without words in UI
+ // state, downstream batch_create_clips can't burn captions.
try {
- const parsed = JSON.parse(result);
- await uiPing({
- videoPath: file_path,
- filePath: file_path,
- transcript: parsed,
- phase: "idle",
- });
+ const cached = await transcriptCache.get(file_path);
+ if (cached) {
+ await uiPing({
+ videoPath: file_path,
+ filePath: file_path,
+ transcript: cached,
+ phase: "idle",
+ });
+ }
} catch (err) {
- log.warn("Failed to parse transcript for UI push", {
+ log.warn("Failed to push full transcript to UI state", {
err: err instanceof Error ? err.message : String(err),
});
}
@@ -1003,7 +1009,6 @@ export function createServer(): McpServer {
if (include_transcript) {
// Prefer packed markdown (10x smaller, phrase-grouped, LLM-readable).
// Auto-generated during transcription — see backend/services/transcript_packer.py.
- const transcriptCache = new TranscriptCache();
let packed: string | null = null;
if (state.videoPath) {
packed = await transcriptCache.getPackedMarkdown(state.videoPath);
diff --git a/src/ui/web-server.ts b/src/ui/web-server.ts
index 6b43061..e67090c 100644
--- a/src/ui/web-server.ts
+++ b/src/ui/web-server.ts
@@ -411,6 +411,13 @@ app.post("/api/transcribe", async (req, res) => {
job.message = "Transcription complete";
job.result = result.data;
sessionTranscripts.set(file_path, result.data as unknown as ServerTranscript);
+ // Populate uiState.transcript with the FULL result so downstream
+ // batch_create_clips can resolve transcript_words for caption burn-in.
+ uiState.transcript = result.data as unknown as typeof uiState.transcript;
+ uiState.videoPath = file_path;
+ uiState.filePath = file_path;
+ uiState.lastUpdated = Date.now();
+ persistState();
// Cache it
try {
await cache.set(file_path, result.data as unknown as TranscriptResult);