story-kit: merge 86_story_show_live_activity_status_instead_of_static_thinking_indicator_in_chat

This commit is contained in:
Dave
2026-02-23 18:38:15 +00:00
parent da8ded460e
commit af1625a132
5 changed files with 54 additions and 4 deletions

View File

@@ -75,6 +75,10 @@ enum WsResponse {
tool_name: String,
tool_input: serde_json::Value,
},
/// The agent started assembling a tool call; shows live status in the UI.
ToolActivity {
tool_name: String,
},
}
impl From<WatcherEvent> for WsResponse {
@@ -168,6 +172,7 @@ pub async fn ws_handler(ws: WebSocket, ctx: Data<&Arc<AppContext>>) -> impl poem
Ok(WsRequest::Chat { messages, config }) => {
let tx_updates = tx.clone();
let tx_tokens = tx.clone();
let tx_activity = tx.clone();
let ctx_clone = ctx.clone();
let perm_tx = perm_req_tx.clone();
@@ -188,6 +193,11 @@ pub async fn ws_handler(ws: WebSocket, ctx: Data<&Arc<AppContext>>) -> impl poem
content: token.to_string(),
});
},
move |tool_name: &str| {
let _ = tx_activity.send(WsResponse::ToolActivity {
tool_name: tool_name.to_string(),
});
},
Some(perm_tx),
);
tokio::pin!(chat_fut);