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)
| 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. |
no test coverage detected