You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,17 +36,18 @@ You can run the following examples:
36
36
-`show_line_selector` presents the user a multiple-choice question using a widget.
37
37
- Route-planning replies attach entity sources for the stations in the suggested path as annotations.
38
38
39
-
### Client tool calls that mutate UI state
39
+
### Client tool calls that mutate or fetch UI state
40
40
41
41
-**Metro Map**:
42
-
- Client tool `add_station` (sent after the server adds a stop) updates the metro map canvas; handled via `onClientTool`in [ChatKitPanel.tsx](examples/metro-map/frontend/src/components/ChatKitPanel.tsx).
42
+
- Client tool `get_selected_stations` pulls the currently selected nodes from the canvas so the agent can use client-side state in its response ([ChatKitPanel.tsx](examples/metro-map/frontend/src/components/ChatKitPanel.tsx), [metro_map_agent.py](examples/metro-map/backend/app/agents/metro_map_agent.py)).
43
43
44
44
### Fire-and-forget client effects
45
45
46
46
-**Cat Lounge**:
47
47
- Client effects `update_cat_status` and `cat_say` are invoked by server tools to sync UI state and surface speech bubbles; handled via `onEffect` in [ChatKitPanel.tsx](examples/cat-lounge/frontend/src/components/ChatKitPanel.tsx).
48
48
-**Metro Map**:
49
49
- Client effect `location_select_mode` is streamed within the server action handler ([server.py](examples/metro-map/backend/app/server.py)) after a line is chosen and updates the metro map canvas ([ChatKitPanel.tsx](examples/metro-map/frontend/src/components/ChatKitPanel.tsx)).
50
+
- Client effect `add_station` is streamed by the agent after map updates to immediately sync the canvas and focus the newly created stop ([metro_map_agent.py](examples/metro-map/backend/app/agents/metro_map_agent.py), [ChatKitPanel.tsx](examples/metro-map/frontend/src/components/ChatKitPanel.tsx)).
50
51
51
52
### Page-aware model responses
52
53
@@ -60,7 +61,12 @@ You can run the following examples:
60
61
- Retrieval tools stream `ProgressUpdateEvent` messages while searching tags, authors, keywords, exact text, or loading the current page so the UI surfaces “Searching…”/“Loading…” states ([news_agent.py](examples/news-guide/backend/app/agents/news_agent.py)).
61
62
- The event finder emits progress as it scans dates, days of week, or keywords to keep users informed during longer lookups ([event_finder_agent.py](examples/news-guide/backend/app/agents/event_finder_agent.py)).
62
63
-**Metro Map**:
63
-
- The metro agent emits a quick sync update when it loads the line data via `get_map` ([metro_map_agent.py](examples/metro-map/backend/app/agents/metro_map_agent.py)).
64
+
- The metro agent emits a progress update while retrieving map information in `get_map`; it also emits a progress update while waiting for a client tool call to complete in `get_selected_stations` ([metro_map_agent.py](examples/metro-map/backend/app/agents/metro_map_agent.py)).
65
+
66
+
### Response lifecycle UI state
67
+
68
+
-**Metro Map**:
69
+
- The client locks map interaction at response start and unlocks when the stream ends so canvas state doesn’t drift during agent updates by adding `onResponseStart` and `onResponseEnd` handlers ([ChatKitPanel.tsx](examples/metro-map/frontend/src/components/ChatKitPanel.tsx)).
Copy file name to clipboardExpand all lines: examples/metro-map/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,12 @@ Chat-driven GUI updates for a metro map using a React Flow canvas that lets the
13
13
- "Add a new station named Aurora" (line picker widget will appear)
14
14
- "Plan a route from Titan Border to Lyra Verge."
15
15
- "Tell me about @Cinderia station." (@-mention stations; need to type @ manually, copy paste won't work)
16
+
- "Tell me about the stations I've selected." (lasso some stations on the canvas first)
16
17
17
18
## Features
18
19
19
20
- Map sync + lookup tools: `get_map`, `list_lines`, `list_stations`, `get_line_route`, `get_station` keep the agent grounded in the latest network data.
21
+
- Selection-aware replies: the agent calls the `get_selected_stations` client tool to pull the user’s current canvas selection before continuing a response, handled in `onClientTool` ([ChatKitPanel.tsx](frontend/src/components/ChatKitPanel.tsx), [metro_map_agent.py](backend/app/agents/metro_map_agent.py)).
20
22
- Plan-a-route responses attach entity sources for each station in the recommended path so ChatKit can keep the canvas focused on the stops being discussed.
21
23
- Station creation flow: `show_line_selector` streams a clickable `line.select` widget, the server stashes `<LINE_SELECTED>`, and `add_station` triggers a widget update and a client tool call to refresh the canvas and focus the new stop.
22
24
- Location placement helper: after a line is chosen, a `location_select_mode` client effect flips the UI into placement mode so users pick start/end of line for insertion.
0 commit comments