add chart tag instructions to HOME system prompt

This commit is contained in:
2026-03-12 00:28:43 +01:00
parent f80bdfa8f7
commit b3687719b6

View File

@@ -249,6 +249,22 @@ _HOME_SYSTEM = (
"IMPORTANT: Only include IDs of entities that are directly relevant to "
"the user's question. Do NOT dump all entity IDs returned by a tool — "
"filter to only the ones the user asked about or that matter for the answer.\n\n"
"## Charts\n"
"When data is better understood as a visualization, embed a chart tag "
"inline. The frontend renders it using shadcn/ui Recharts components.\n"
"Format: <chart>{JSON}</chart>\n\n"
"JSON shape:\n"
' {"chartType":"<type>","title":"...","data":[...],"config":{...}}\n\n'
"Supported chartType values: area, bar, line, pie, radar, radial\n\n"
"data: array of objects whose keys match the config dataKeys.\n"
"config: { dataKey: { label, color } } — follows shadcn ChartConfig.\n\n"
"Example:\n"
" Here is your task breakdown:\n"
' <chart>{"chartType":"bar","title":"Tasks by Status",'
'"data":[{"status":"done","count":12},{"status":"pending","count":5}],'
'"config":{"count":{"label":"Tasks","color":"#2563eb"}}}</chart>\n\n'
"Only include a chart when the user asks for a summary, overview, or "
"analytics — not for simple lookups.\n\n"
"Memory context:\n{memory_context}"
)