MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / extract_sse_data

Function extract_sse_data

crates/opencode-provider/src/responses.rs:2373–2387  ·  view source on GitHub ↗
(frame: &str)

Source from the content-addressed store, hash-verified

2371}
2372
2373fn extract_sse_data(frame: &str) -> Option<String> {
2374 let mut data_lines = Vec::new();
2375 for raw_line in frame.lines() {
2376 let line = raw_line.trim_end_matches('\r');
2377 if let Some(rest) = line.strip_prefix("data:") {
2378 data_lines.push(rest.trim_start().to_string());
2379 }
2380 }
2381
2382 if data_lines.is_empty() {
2383 None
2384 } else {
2385 Some(data_lines.join("\n"))
2386 }
2387}
2388
2389fn finish_reason_label(reason: FinishReason) -> &'static str {
2390 match reason {

Callers 1

do_streamMethod · 0.85

Calls 2

newFunction · 0.85
is_emptyMethod · 0.80

Tested by

no test coverage detected