Skip to content

Commit 9ba76c6

Browse files
committed
feat: pass trend signal URLs as notebook sources for research
Extracts up to 5 source URLs from the top trending topic's signals and passes them to conductResearch() as sourceUrls. These get added to the NotebookLM notebook before deep research starts, giving it real articles/blog posts to analyze.
1 parent 4c555e5 commit 9ba76c6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/api/cron/ingest/route.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const FALLBACK_TRENDS: TrendResult[] = [
100100
slug: "webassembly-web-apps",
101101
score: 60,
102102
signals: [{ source: "blog", title: "WebAssembly", url: "https://webassembly.org/", score: 60 }],
103-
whyTrending: "WASM adoption growing in production apps",
103+
whyTrending: "WASM adoption growing in [REDACTED SECRET: NEXT_PUBLIC_SANITY_DATASET] apps",
104104
suggestedAngle: "Real-world use cases where WASM outperforms JS",
105105
},
106106
];
@@ -403,7 +403,12 @@ export async function GET(request: NextRequest) {
403403
if (process.env.ENABLE_NOTEBOOKLM_RESEARCH === "true") {
404404
console.log(`[CRON/ingest] Conducting research on: "${trends[0].topic}"...`);
405405
try {
406-
research = await conductResearch(trends[0].topic);
406+
// Extract source URLs from trend signals to seed the notebook
407+
const sourceUrls = (trends[0].signals ?? [])
408+
.map((s: { url?: string }) => s.url)
409+
.filter((u): u is string => !!u && u.startsWith("http"))
410+
.slice(0, 5);
411+
research = await conductResearch(trends[0].topic, { sourceUrls });
407412
console.log(`[CRON/ingest] Research complete: ${research.sources.length} sources, ${research.sceneHints.length} scene hints`);
408413
} catch (err) {
409414
console.warn("[CRON/ingest] Research failed, continuing without:", err);

0 commit comments

Comments
 (0)