Create a new stream processor for a given assistant message.
(session_id: String, assistant_message_id: String)
| 204 | impl StreamProcessor { |
| 205 | /// Create a new stream processor for a given assistant message. |
| 206 | pub fn new(session_id: String, assistant_message_id: String) -> Self { |
| 207 | Self { |
| 208 | reasoning_map: HashMap::new(), |
| 209 | tool_calls: HashMap::new(), |
| 210 | current_text: None, |
| 211 | snapshot: None, |
| 212 | blocked: false, |
| 213 | attempt: 0, |
| 214 | needs_compaction: false, |
| 215 | session_id, |
| 216 | _assistant_message_id: assistant_message_id, |
| 217 | cost: 0.0, |
| 218 | tokens: None, |
| 219 | finish_reason: None, |
| 220 | error: None, |
| 221 | completed_tool_parts: Vec::new(), |
| 222 | pending_patches: Vec::new(), |
| 223 | pending_events: Vec::new(), |
| 224 | compaction_engine: CompactionEngine::new(CompactionConfig::default()), |
| 225 | model_limits: None, |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | /// Get the accumulated cost. |
| 230 | pub fn cost(&self) -> f64 { |