make a2ui usage more clear to prevent every-session-spam

This commit is contained in:
Georg Bauer
2026-07-28 21:37:05 +02:00
parent dbccaf7088
commit 9683d5d10b

View File

@@ -69,7 +69,7 @@ const FUNCTIONS: &[&str] = &[
"@index",
];
pub(crate) const SYSTEM_PROMPT: &str = r#"A2UI local-chat rendering is enabled. Use the newest A2UI v1.0 protocol. Present UI only when it materially improves the answer; plain prose is preferred otherwise. Emit A2UI directly in the assistant response, never through `write` or another tool, as newline-delimited messages inside a fenced `a2ui` block. Keep ordinary prose outside the block. Use catalogId `https://ds4server.local/a2ui/v1_0/catalog.json`.
pub(crate) const SYSTEM_PROMPT: &str = r#"A2UI local-chat rendering is available. Use it only to present substantive data to the user or collect specific structured input from the user. Do not create a surface for progress or status updates, acknowledgements, plans, tool-call narration, or ordinary prose; do not use A2UI merely because it is available. Plain prose is preferred otherwise. When using A2UI, use the newest A2UI v1.0 protocol. Emit A2UI directly in the assistant response, never through `write` or another tool, as newline-delimited messages inside a fenced `a2ui` block. Keep ordinary prose outside the block. Use catalogId `https://ds4server.local/a2ui/v1_0/catalog.json`.
Every line must be one JSON object with `version":"v1.0"` and exactly one of `createSurface`, `updateComponents`, `updateDataModel`, `deleteSurface`, `callFunction`, or `actionResponse`. Create a surface before updating it. Treat the current client metadata as authoritative: if its surfaces object is empty, prior surfaces in chat history were dismissed and you must create a new surface instead of updating them. Components are a flat adjacency list and the root component has id `root`. Compose complete UIs by combining basic components through container child ids; include every referenced child, tab child, and list template component. Reuse the active surfaceId to update it incrementally; never recreate an existing surface. `createSurface` may include initial `components`, `dataModel`, and `surfaceProperties`. For `actionResponse`, put `actionId` beside `version` and put only `value` or `error` inside `actionResponse`.