From 65ba50817e5e40bb1e49b3c7c740048a24811381 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Sat, 11 Apr 2026 20:29:38 -0700 Subject: [PATCH 1/2] =?UTF-8?q?fix(chat):=20correct=20generative-ui=20prom?= =?UTF-8?q?pt=20=E2=80=94=20use=20root=20not=20rootKey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The generative-ui system prompt instructed the LLM to produce JSON specs with a "rootKey" field, but the @json-render/core Spec type expects "root". RenderSpecComponent checks `spec()?.root` (line 50), so all LLM-generated specs silently failed to render. Fix: replace all occurrences of "rootKey" with "root" in the prompt. Updated both the source and the streaming deployment copy. Co-Authored-By: Claude Opus 4.6 (1M context) --- cockpit/chat/generative-ui/python/prompts/generative-ui.md | 6 +++--- cockpit/langgraph/streaming/python/prompts/generative-ui.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cockpit/chat/generative-ui/python/prompts/generative-ui.md b/cockpit/chat/generative-ui/python/prompts/generative-ui.md index 98c06c985..61afba57f 100644 --- a/cockpit/chat/generative-ui/python/prompts/generative-ui.md +++ b/cockpit/chat/generative-ui/python/prompts/generative-ui.md @@ -9,7 +9,7 @@ A **Spec** is a JSON object with two required top-level keys: ``` { "elements": { [key: string]: Element }, - "rootKey": string + "root": string } ``` @@ -35,7 +35,7 @@ An **Element** has: 1. Respond ONLY with valid JSON. No markdown. No code fences. No surrounding text. 2. Every element referenced in a `children` array must exist as a key in `elements`. -3. `rootKey` must reference a key that exists in `elements`. +3. `root` must reference a key that exists in `elements`. 4. Use `container` to group multiple cards together. 5. Choose component types that best match the user's request. @@ -43,4 +43,4 @@ An **Element** has: If the user asks "What's the weather in Chicago and New York?", respond exactly like: -{"elements":{"root":{"type":"container","props":{},"children":["chicago","nyc"]},"chicago":{"type":"weather_card","props":{"city":"Chicago","temperature":45,"condition":"Partly Cloudy"}},"nyc":{"type":"weather_card","props":{"city":"New York","temperature":52,"condition":"Sunny"}}},"rootKey":"root"} +{"elements":{"root":{"type":"container","props":{},"children":["chicago","nyc"]},"chicago":{"type":"weather_card","props":{"city":"Chicago","temperature":45,"condition":"Partly Cloudy"}},"nyc":{"type":"weather_card","props":{"city":"New York","temperature":52,"condition":"Sunny"}}},"root":"root"} diff --git a/cockpit/langgraph/streaming/python/prompts/generative-ui.md b/cockpit/langgraph/streaming/python/prompts/generative-ui.md index 98c06c985..61afba57f 100644 --- a/cockpit/langgraph/streaming/python/prompts/generative-ui.md +++ b/cockpit/langgraph/streaming/python/prompts/generative-ui.md @@ -9,7 +9,7 @@ A **Spec** is a JSON object with two required top-level keys: ``` { "elements": { [key: string]: Element }, - "rootKey": string + "root": string } ``` @@ -35,7 +35,7 @@ An **Element** has: 1. Respond ONLY with valid JSON. No markdown. No code fences. No surrounding text. 2. Every element referenced in a `children` array must exist as a key in `elements`. -3. `rootKey` must reference a key that exists in `elements`. +3. `root` must reference a key that exists in `elements`. 4. Use `container` to group multiple cards together. 5. Choose component types that best match the user's request. @@ -43,4 +43,4 @@ An **Element** has: If the user asks "What's the weather in Chicago and New York?", respond exactly like: -{"elements":{"root":{"type":"container","props":{},"children":["chicago","nyc"]},"chicago":{"type":"weather_card","props":{"city":"Chicago","temperature":45,"condition":"Partly Cloudy"}},"nyc":{"type":"weather_card","props":{"city":"New York","temperature":52,"condition":"Sunny"}}},"rootKey":"root"} +{"elements":{"root":{"type":"container","props":{},"children":["chicago","nyc"]},"chicago":{"type":"weather_card","props":{"city":"Chicago","temperature":45,"condition":"Partly Cloudy"}},"nyc":{"type":"weather_card","props":{"city":"New York","temperature":52,"condition":"Sunny"}}},"root":"root"} From f21768cdd4d6e53f8b1e57ad37fe10adfb9567c7 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Sat, 11 Apr 2026 22:27:42 -0700 Subject: [PATCH 2/2] fix(chat): align a2ui assistant ID with deployed graph name The a2ui Angular app used assistant ID 'c-a2ui' but the production /api proxy routes to the streaming LangGraph deployment, which registers the a2ui graph as 'a2ui_form'. This caused HTTP 422 "Invalid assistant" errors. Fix: update both environment files to use 'a2ui_form'. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../a2ui/angular/src/environments/environment.development.ts | 2 +- cockpit/chat/a2ui/angular/src/environments/environment.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cockpit/chat/a2ui/angular/src/environments/environment.development.ts b/cockpit/chat/a2ui/angular/src/environments/environment.development.ts index f5c053266..d324f197b 100644 --- a/cockpit/chat/a2ui/angular/src/environments/environment.development.ts +++ b/cockpit/chat/a2ui/angular/src/environments/environment.development.ts @@ -1,5 +1,5 @@ export const environment = { production: false, langGraphApiUrl: 'http://localhost:4511/api', - a2uiAssistantId: 'c-a2ui', + a2uiAssistantId: 'a2ui_form', }; diff --git a/cockpit/chat/a2ui/angular/src/environments/environment.ts b/cockpit/chat/a2ui/angular/src/environments/environment.ts index 2919bf6d0..f23ee1ad2 100644 --- a/cockpit/chat/a2ui/angular/src/environments/environment.ts +++ b/cockpit/chat/a2ui/angular/src/environments/environment.ts @@ -1,5 +1,5 @@ export const environment = { production: true, langGraphApiUrl: '/api', - a2uiAssistantId: 'c-a2ui', + a2uiAssistantId: 'a2ui_form', };