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

@@ -156,16 +156,18 @@ impl AnthropicProvider {
.join("\n\n")
}
pub async fn chat_stream<F>(
pub async fn chat_stream<F, A>(
&self,
model: &str,
messages: &[Message],
tools: &[ToolDefinition],
cancel_rx: &mut Receiver<bool>,
mut on_token: F,
mut on_activity: A,
) -> Result<CompletionResponse, String>
where
F: FnMut(&str),
A: FnMut(&str),
{
let anthropic_messages = Self::convert_messages(messages);
let anthropic_tools = Self::convert_tools(tools);
@@ -257,6 +259,7 @@ impl AnthropicProvider {
{
let id = content_block["id"].as_str().unwrap_or("").to_string();
let name = content_block["name"].as_str().unwrap_or("").to_string();
on_activity(&name);
current_tool_use = Some((id, name, String::new()));
}
}