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

Method fetch_stream

crates/opencode-provider/src/responses.rs:2444–2460  ·  view source on GitHub ↗
(
            &self,
            _request: CustomFetchRequest,
        )

Source from the content-addressed store, hash-verified

2442 }
2443
2444 async fn fetch_stream(
2445 &self,
2446 _request: CustomFetchRequest,
2447 ) -> Result<CustomFetchStreamResponse, ProviderError> {
2448 let frames = vec![
2449 "data: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_stream_1\"}}\n\n"
2450 .to_string(),
2451 "data: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_stream_1\",\"usage\":{\"input_tokens\":1,\"output_tokens\":1,\"total_tokens\":2}}}\n\n"
2452 .to_string(),
2453 "data: [DONE]\n\n".to_string(),
2454 ];
2455 Ok(CustomFetchStreamResponse {
2456 status: 200,
2457 headers: HashMap::new(),
2458 stream: Box::pin(stream::iter(frames.into_iter().map(Ok))),
2459 })
2460 }
2461 }
2462
2463 #[test]

Callers 1

do_streamMethod · 0.45

Calls 1

newFunction · 0.85

Tested by

no test coverage detected