fix: render opencode text parts after tools
This commit is contained in:
@@ -19,7 +19,7 @@ where
|
||||
emit_session_event(json, emit);
|
||||
}
|
||||
|
||||
match json["type"].as_str().unwrap_or_default() {
|
||||
match event_type(json) {
|
||||
"message" | "text" => emit_text(json, emit),
|
||||
"reasoning" => emit_reasoning(json, emit),
|
||||
"tool_use" | "tool" => emit_tool_start(json, emit),
|
||||
@@ -29,6 +29,15 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn event_type(json: &serde_json::Value) -> &str {
|
||||
let direct = json["type"].as_str().unwrap_or_default();
|
||||
match direct {
|
||||
"session" | "message" | "text" | "reasoning" | "tool_use" | "tool" | "tool_result"
|
||||
| "tool_done" | "error" => direct,
|
||||
_ => json["part"]["type"].as_str().unwrap_or(direct),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn session_id(json: &serde_json::Value) -> Option<&str> {
|
||||
json["sessionID"]
|
||||
.as_str()
|
||||
|
||||
Reference in New Issue
Block a user