export interface NoteAIRequest { id: number prompt: string knowledgeRef?: string mode?: string blockId?: string instructions?: string autoSend?: boolean config?: Record } /** Context is sent to the model, but stays out of restored chat bubbles. */ export function visibleNotePrompt(content: string): string { return content .split( /\n(?:\n)?(?:||Learning block kind:|Use note_read then note_suggest|Target block:)/ )[0] .trim() } export function learningMode(kind: string): string { return ( ( { research: 'deep_research', quiz: 'deep_question', animation: 'visualize', audio: 'audio_overview', } as Record )[kind] || 'chat' ) } /** Keep animation blocks explicit even when their prompt only names a topic. */ export function learningConfig( kind: string, config?: Record ): Record | undefined { if (kind !== 'animation') return config const { output_mode, ...rest } = config || {} return { ...rest, render_mode: rest.render_mode || (output_mode === 'image' ? 'manim_image' : 'manim_video'), } }