Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 0.12.1 - UNRELEASED

### Fixes

- YouTube: keep Gemini-only no-caption runs on the transcription path by forwarding the Google API key from the top-level URL flow into link-preview transcription config (#148, thanks @bytrangle).

## 0.12.0 - 2026-03-11

### Features
Expand Down
1 change: 1 addition & 0 deletions src/run/flows/url/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export async function runUrlFlow({
groqApiKey: model.apiStatus.groqApiKey,
assemblyaiApiKey: model.apiStatus.assemblyaiApiKey,
openaiApiKey: model.apiStatus.openaiTranscriptionKey,
geminiApiKey: model.apiStatus.googleApiKey,
},
scrapeWithFirecrawl,
convertHtmlToMarkdown: markdown.convertHtmlToMarkdown,
Expand Down
111 changes: 111 additions & 0 deletions tests/run.url-flow.gemini-transcription-forwarding.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { CacheState } from "../src/cache.js";
import type { ExtractedLinkContent } from "../src/content/index.js";
import type { LinkPreviewClientOptions } from "../src/content/index.js";
import { createDaemonUrlFlowContext } from "../src/daemon/flow-context.js";

const mocks = vi.hoisted(() => {
const fetchLinkContent = vi.fn<(url: string) => Promise<ExtractedLinkContent>>();
const createLinkPreviewClient = vi.fn((options?: LinkPreviewClientOptions) => ({
fetchLinkContent: async (url: string) => fetchLinkContent(url),
options,
}));
return { fetchLinkContent, createLinkPreviewClient };
});

vi.mock("../src/content/index.js", () => ({
createLinkPreviewClient: mocks.createLinkPreviewClient,
}));

import { runUrlFlow } from "../src/run/flows/url/flow.js";

afterEach(() => {
vi.clearAllMocks();
});

describe("runUrlFlow transcription wiring", () => {
it("forwards googleApiKey into link preview transcription config", async () => {
const root = mkdtempSync(join(tmpdir(), "summarize-gemini-url-flow-"));
const url = "https://www.youtube.com/watch?v=hhAbp3iQA44";
const cache: CacheState = {
mode: "bypass",
store: null,
ttlMs: 0,
maxBytes: 0,
path: null,
};

mocks.fetchLinkContent.mockResolvedValueOnce({
url,
title: "Video",
description: null,
siteName: "YouTube",
content: "Transcript text",
truncated: false,
totalCharacters: 15,
wordCount: 2,
transcriptCharacters: 15,
transcriptLines: 1,
transcriptWordCount: 2,
transcriptSource: "yt-dlp",
transcriptionProvider: "gemini-2.5-flash",
transcriptMetadata: null,
transcriptSegments: null,
transcriptTimedText: null,
mediaDurationSeconds: 120,
video: { kind: "youtube", url },
isVideoOnly: false,
diagnostics: {
strategy: "html",
firecrawl: {
attempted: false,
used: false,
cacheMode: "bypass",
cacheStatus: "bypassed",
notes: null,
},
markdown: {
requested: false,
used: false,
provider: null,
notes: null,
},
transcript: {
cacheMode: "bypass",
cacheStatus: "unknown",
textProvided: true,
provider: "yt-dlp",
attemptedProviders: ["yt-dlp"],
notes: null,
},
},
});

const ctx = createDaemonUrlFlowContext({
env: { HOME: root, OPENAI_API_KEY: "test" },
fetchImpl: vi.fn() as unknown as typeof fetch,
cache,
modelOverride: "google/gemini-3-flash",
promptOverride: null,
lengthRaw: "short",
languageRaw: "auto",
maxExtractCharacters: null,
extractOnly: true,
runStartedAtMs: Date.now(),
stdoutSink: { writeChunk: () => {} },
});

ctx.model.apiStatus.googleApiKey = "gemini-key";
ctx.model.apiStatus.googleConfigured = true;

await runUrlFlow({ ctx, url, isYoutubeUrl: true });

expect(mocks.createLinkPreviewClient).toHaveBeenCalledTimes(1);
const options = mocks.createLinkPreviewClient.mock.calls[0]?.[0];
expect(options?.transcription?.geminiApiKey).toBe("gemini-key");
expect(options?.transcription?.openaiApiKey).toBe("test");
});
});