MCPcopy Create free account
hub / github.com/GCWing/BitFun / rebuild_streaming_message

Method rebuild_streaming_message

src/apps/cli/src/chat_state.rs:893–901  ·  view source on GitHub ↗

Rebuild the last assistant message from current streaming state. Simply clones the chronologically-ordered current_flow_items into the message. Text, thinking, and tool blocks are already interleaved in the correct order.

(&mut self)

Source from the content-addressed store, hash-verified

891 /// Simply clones the chronologically-ordered current_flow_items into the message.
892 /// Text, thinking, and tool blocks are already interleaved in the correct order.
893 fn rebuild_streaming_message(&mut self) {
894 let last_msg = match self.messages.last_mut() {
895 Some(msg) if msg.role == MessageRole::Assistant && msg.is_streaming => msg,
896 _ => return,
897 };
898
899 last_msg.flow_items = self.current_flow_items.clone();
900 last_msg.version += 1;
901 }
902
903 /// Insert a new tool into current_flow_items (appended at end, preserving chronological order),
904 /// or update an existing tool in-place if it already exists.

Callers 4

handle_text_chunkMethod · 0.80
handle_thinking_chunkMethod · 0.80
handle_tool_eventMethod · 0.80
handle_subagent_eventMethod · 0.80

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected