fix KeyError 'JSON' — escape braces in chart prompt for str.format()
This commit is contained in:
@@ -252,17 +252,17 @@ _HOME_SYSTEM = (
|
|||||||
"## Charts\n"
|
"## Charts\n"
|
||||||
"When data is better understood as a visualization, embed a chart tag "
|
"When data is better understood as a visualization, embed a chart tag "
|
||||||
"inline. The frontend renders it using shadcn/ui Recharts components.\n"
|
"inline. The frontend renders it using shadcn/ui Recharts components.\n"
|
||||||
"Format: <chart>{JSON}</chart>\n\n"
|
"Format: <chart>{{JSON}}</chart>\n\n"
|
||||||
"JSON shape:\n"
|
"JSON shape:\n"
|
||||||
' {"chartType":"<type>","title":"...","data":[...],"config":{...}}\n\n'
|
' {{"chartType":"<type>","title":"...","data":[...],"config":{{...}}}}\n\n'
|
||||||
"Supported chartType values: area, bar, line, pie, radar, radial\n\n"
|
"Supported chartType values: area, bar, line, pie, radar, radial\n\n"
|
||||||
"data: array of objects whose keys match the config dataKeys.\n"
|
"data: array of objects whose keys match the config dataKeys.\n"
|
||||||
"config: { dataKey: { label, color } } — follows shadcn ChartConfig.\n\n"
|
"config: {{ dataKey: {{ label, color }} }} — follows shadcn ChartConfig.\n\n"
|
||||||
"Example:\n"
|
"Example:\n"
|
||||||
" Here is your task breakdown:\n"
|
" Here is your task breakdown:\n"
|
||||||
' <chart>{"chartType":"bar","title":"Tasks by Status",'
|
' <chart>{{"chartType":"bar","title":"Tasks by Status",'
|
||||||
'"data":[{"status":"done","count":12},{"status":"pending","count":5}],'
|
'"data":[{{"status":"done","count":12}},{{"status":"pending","count":5}}],'
|
||||||
'"config":{"count":{"label":"Tasks","color":"#2563eb"}}}</chart>\n\n'
|
'"config":{{"count":{{"label":"Tasks","color":"#2563eb"}}}}}}</chart>\n\n'
|
||||||
"Only include a chart when the user asks for a summary, overview, or "
|
"Only include a chart when the user asks for a summary, overview, or "
|
||||||
"analytics — not for simple lookups.\n\n"
|
"analytics — not for simple lookups.\n\n"
|
||||||
"Memory context:\n{memory_context}"
|
"Memory context:\n{memory_context}"
|
||||||
|
|||||||
Reference in New Issue
Block a user