fix(chart): show correct chart type in previews
- 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>
This commit is contained in:
@@ -71,9 +71,10 @@ export async function suggestCharts(request: SuggestChartsRequest): Promise<Sugg
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a chart suggestion to markdown code block format
|
||||
* Convert a chart suggestion to raw chart format (no markdown ticks)
|
||||
* This is the content that goes inside <code class="language-chart">
|
||||
* @param suggestion - The chart suggestion to convert
|
||||
* @returns Markdown code block string
|
||||
* @returns Raw chart content string
|
||||
*/
|
||||
export function chartSuggestionToMarkdown(suggestion: ChartSuggestion): string {
|
||||
const lines = [
|
||||
@@ -81,5 +82,5 @@ export function chartSuggestionToMarkdown(suggestion: ChartSuggestion): string {
|
||||
suggestion.title,
|
||||
...suggestion.data.map(d => `${d.label}: ${d.value}`),
|
||||
]
|
||||
return `\`\`\`chart\n${lines.join('\n')}\n\`\`\``
|
||||
return lines.join('\n')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user