From 41698033e796eb89ed22d250fff8c1b03c65de55 Mon Sep 17 00:00:00 2001 From: Miriad Date: Thu, 5 Mar 2026 14:58:13 +0000 Subject: [PATCH] fix: move INFOGRAPHIC_INSTRUCTIONS to Sanity contentConfig singleton - Add infographicInstructions array field to contentConfig schema - Replace hardcoded INFOGRAPHIC_INSTRUCTIONS in check-research with getConfigValue() - Default values match the original 5 instructions Co-authored-by: pm --- app/api/cron/check-research/route.ts | 15 +++++++++++---- sanity/schemas/singletons/contentConfig.ts | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/api/cron/check-research/route.ts b/app/api/cron/check-research/route.ts index b10b4b9a..d873e473 100644 --- a/app/api/cron/check-research/route.ts +++ b/app/api/cron/check-research/route.ts @@ -109,8 +109,10 @@ async function buildStuckThresholds(): Promise> { /** Max docs to process per status per run — keeps total time well under 60s */ const MAX_DOCS_PER_STATUS = 2; -/** Infographic instructions for visual variety */ -const INFOGRAPHIC_INSTRUCTIONS = [ +import { getConfigValue } from "@/lib/config"; + +/** Default infographic instructions — used when content_config singleton doesn't exist yet */ +const DEFAULT_INFOGRAPHIC_INSTRUCTIONS = [ 'Create a high-level architecture overview diagram', 'Create a comparison chart of key features and alternatives', 'Create a step-by-step workflow diagram', @@ -261,9 +263,14 @@ async function stepResearchComplete( const sourceIds = await nbClient.getSourceIds(notebookId); console.log(`[check-research] Found ${sourceIds.length} source IDs`); - // Start all 5 infographic generations + // Start all infographic generations (instructions from Sanity config) + const infographicInstructions = await getConfigValue( + "content_config", + "infographicInstructions", + DEFAULT_INFOGRAPHIC_INSTRUCTIONS, + ); const artifactIds: string[] = []; - for (const instruction of INFOGRAPHIC_INSTRUCTIONS) { + for (const instruction of infographicInstructions) { try { const result = await nbClient.generateInfographic(notebookId, { sourceIds, diff --git a/sanity/schemas/singletons/contentConfig.ts b/sanity/schemas/singletons/contentConfig.ts index b5d42d17..6a1589e5 100644 --- a/sanity/schemas/singletons/contentConfig.ts +++ b/sanity/schemas/singletons/contentConfig.ts @@ -113,6 +113,20 @@ export default defineType({ initialValue: 90, validation: (Rule) => Rule.min(0).max(365), }), + defineField({ + name: "infographicInstructions", + title: "Infographic Instructions", + type: "array", + description: "Prompts sent to NotebookLM for infographic generation. Each instruction produces one infographic per research run. Reorder, add, or remove to control visual output.", + of: [{ type: "string" }], + initialValue: [ + "Create a high-level architecture overview diagram", + "Create a comparison chart of key features and alternatives", + "Create a step-by-step workflow diagram", + "Create a timeline of key developments and milestones", + "Create a pros and cons visual summary", + ], + }), ], preview: { prepare() {