Use editor.commands.insertContent with JSON node definition instead of
direct transaction manipulation. This is more reliable for custom nodes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Fix transaction.mapping.map usage - it returns a position, not mapping
- Add 5-minute in-memory cache for chart suggestions (max 50 entries)
- Cache key based on content hash + selection
- Significantly improves UX when re-analyzing same content
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Instead of relying on HTML parsing which can be inconsistent,
create the chartBlock node directly using TipTap's schema and transaction API.
This ensures the custom node is properly created and rendered as a visual chart.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Use NoteChart directly with props instead of NoteChartFromCode
- Remove markdown ticks from chartSuggestionToMarkdown output
- Export NoteChart component for direct use in previews
Now the 3 suggestions correctly show different chart types.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Convert chart markdown to <pre><code class="language-chart"> HTML format
- Fix parseHTML to store code content in node attrs
- Fix renderHTML to output actual code content instead of placeholder
This fixes charts rendering as raw markdown text instead of visual charts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Use getChatProvider() + provider.getModel() instead of
resolveAiRouteWithTiming which doesn't return a provider function.
Follow the pattern used in chat/insights/route.ts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The AI router only supports lanes: 'chat', 'tags', 'embedding'.
'suggest-charts' was not a valid lane causing 500 errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add step-by-step console logging in API route
- Show actual error message in dialog
- Add debug info section
- Wrap each section in try-catch to isolate failure point
- Remove conflicting tool approach, use direct JSON
- Add fallback: extract numbers from regex if AI fails
- Add debug section to show what content was analyzed
- Be more lenient: any 2+ numbers = valid chart
- Better error messages
- Add console logging for debugging
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1. Script warning in layout.tsx
- Use Next.js Script component instead of plain <script>
2. QUOTA_EXCEEDED bug for chart suggestions
- Add 'suggest_charts' to VALID_FEATURES
- Add 'suggest_charts' to TIER_LIMITS for all tiers
- Fix route to use 'suggest_charts' instead of invalid 'ai' feature
This fixes the issue where users with valid credit were getting
QUOTA_EXCEEDED errors because 'ai' was not a valid feature name.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The CookieConsentBanner uses useLanguage() hook but was rendered
outside of LanguageProvider in RootLayout. Added LanguageProvider
wrapper to fix the runtime error.
- Add quotaExceeded flag to response for better error UX
- Show dedicated quota exceeded state with upgrade button
- Improve AI prompt to better detect data patterns
- Add chart type-specific colors (blue, indigo, emerald, violet, etc.)
- Replace generic primary/10 colors with varied accent colors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Implement slash command "/suggest-charts" that analyzes note content
and suggests 3 appropriate chart types with visual previews.
Created:
- chart-suggestion.tool.ts: AI tool for data extraction and chart recommendations
- suggest-charts/route.ts: API endpoint for chart suggestions
- chart-suggestion.service.ts: Frontend service layer
- chart-suggestions-dialog.tsx: Modal with 3 chart proposals and thumbnails
- tiptap-chart-extension.tsx: TipTap Node extension for rendering chart blocks
Modified:
- rich-text-editor.tsx: Added slash command, toolbar button, and dialog integration
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Memoize ChartWrapper to prevent infinite re-renders in MarkdownContent
- Remove hardcoded French text (multilingual app)
- Return null for invalid charts instead of error messages
- Add slides.tool.ts with support for title, bullets, chart, stats, table, cards, timeline, quote, comparison, equation, image, summary slide types
- Chart types: bar, horizontal-bar, line, donut, radar
- Integrate with agent executor and canvas system
- Add multilingual support (en/fr)
- Various UI improvements and bug fixes
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Create migration for BrainstormSession, BrainstormIdea, BrainstormNoteRef,
BrainstormParticipant, BrainstormActivity, BrainstormShare, BrainstormSnapshot
- Ghost cursor: only moves toward a target element, no random wandering,
120ms interval instead of 60fps, hidden when no target
- Remove animate-ping that caused visual noise
- Add /api/admin/embeddings/dimension (GET column dim, POST test model dim)
- Add /api/admin/embeddings/migrate (alter column, clear, re-index)
- Admin form warns on dimension mismatch after save, offers migrate button
- Remove hardcoded 1536 from validate endpoint and embedding service
- Add validateDimension() utility to EmbeddingService
- Fix health route: import prisma correctly, use router instead of missing registry
- i18n keys for dimension warning (EN/FR)