Kill Reasoning, Debug, Activity variants — read status from Agent directly
Reasoning tokens: dropped for now, will land in context entries later. Debug sends: converted to dbglog! macro (writes to debug.log). Activity: now a field on Agent, set directly, read by UI via try_lock. score_memories_incremental takes agent Arc for activity writes. UiMessage down to 2 variants: TextDelta, Info. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
eafc2887a3
commit
e7914e3d58
7 changed files with 54 additions and 88 deletions
|
|
@ -86,9 +86,9 @@ pub(super) async fn stream_events(
|
|||
while let Some(event) = reader.next_event(&mut response).await? {
|
||||
if let Some(err_msg) = event["error"]["message"].as_str() {
|
||||
let raw = event["error"]["metadata"]["raw"].as_str().unwrap_or("");
|
||||
let _ = ui_tx.send(UiMessage::Debug(format!(
|
||||
dbglog!(
|
||||
"API error in stream: {}", err_msg
|
||||
)));
|
||||
);
|
||||
anyhow::bail!("API error in stream: {} {}", err_msg, raw);
|
||||
}
|
||||
|
||||
|
|
@ -96,16 +96,16 @@ pub(super) async fn stream_events(
|
|||
Ok(c) => c,
|
||||
Err(e) => {
|
||||
let preview = event.to_string();
|
||||
let _ = ui_tx.send(UiMessage::Debug(format!(
|
||||
dbglog!(
|
||||
"unparseable SSE event ({}): {}",
|
||||
e, &preview[..preview.len().min(300)]
|
||||
)));
|
||||
);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(ref u) = chunk.usage {
|
||||
let _ = tx.send(StreamEvent::Usage(u.clone()));
|
||||
let _ = tx.send(StreamEvent::Usage(u.clone();
|
||||
usage = chunk.usage;
|
||||
}
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ pub(super) async fn stream_events(
|
|||
reasoning_chars += r.len();
|
||||
has_reasoning = true;
|
||||
if !r.is_empty() {
|
||||
let _ = tx.send(StreamEvent::Reasoning(r.clone()));
|
||||
let _ = tx.send(StreamEvent::Reasoning(r.clone();
|
||||
}
|
||||
}
|
||||
if let Some(ref r) = choice.delta.reasoning_details {
|
||||
|
|
@ -143,7 +143,7 @@ pub(super) async fn stream_events(
|
|||
first_content_at = Some(reader.stream_start.elapsed());
|
||||
}
|
||||
content_len += text_delta.len();
|
||||
let _ = tx.send(StreamEvent::Content(text_delta.clone()));
|
||||
let _ = tx.send(StreamEvent::Content(text_delta.clone();
|
||||
}
|
||||
|
||||
if let Some(ref tc_deltas) = choice.delta.tool_calls {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue