mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-08-28 05:27:41 +00:00
Fix clippy::single_match lint in arc-llm SSE event handler
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
105bdc04de
commit
801a3936b4
1 changed files with 15 additions and 18 deletions
|
|
@ -441,27 +441,24 @@ pub async fn run_prompt_via_server(args: PromptArgs, server: &ServerConnection)
|
|||
let mut output_usage: Option<crate::types::Usage> = None;
|
||||
|
||||
parse_sse_frames(response, |event_type, data| {
|
||||
match event_type {
|
||||
"stream_event" => {
|
||||
if let Ok(event) = serde_json::from_str::<crate::types::StreamEvent>(data) {
|
||||
match event {
|
||||
crate::types::StreamEvent::TextDelta { delta, .. } => {
|
||||
print!("{delta}");
|
||||
let _ = io::stdout().flush();
|
||||
}
|
||||
crate::types::StreamEvent::Finish { usage, .. } => {
|
||||
if show_usage {
|
||||
output_usage = Some(usage);
|
||||
}
|
||||
}
|
||||
crate::types::StreamEvent::Error { error, .. } => {
|
||||
bail!("Server error: {error}");
|
||||
}
|
||||
_ => {}
|
||||
if event_type == "stream_event" {
|
||||
if let Ok(event) = serde_json::from_str::<crate::types::StreamEvent>(data) {
|
||||
match event {
|
||||
crate::types::StreamEvent::TextDelta { delta, .. } => {
|
||||
print!("{delta}");
|
||||
let _ = io::stdout().flush();
|
||||
}
|
||||
crate::types::StreamEvent::Finish { usage, .. } => {
|
||||
if show_usage {
|
||||
output_usage = Some(usage);
|
||||
}
|
||||
}
|
||||
crate::types::StreamEvent::Error { error, .. } => {
|
||||
bail!("Server error: {error}");
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
Ok(true)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue