Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent2: Fix remaining update_model_request_usage todos (#36570)

Bennet Bo Fenner0a80209c5e4f
diff --git a/crates/agent2/src/thread.rs b/crates/agent2/src/thread.rs
index b6405dbcbdf..73a86d53eab 100644
--- a/crates/agent2/src/thread.rs
+++ b/crates/agent2/src/thread.rs
@@ -1563,12 +1563,11 @@ impl Thread {
let text = match event {
LanguageModelCompletionEvent::Text(text) => text,
LanguageModelCompletionEvent::StatusUpdate(
- CompletionRequestStatus::UsageUpdated { .. },
+ CompletionRequestStatus::UsageUpdated { amount, limit },
) => {
- // this.update(cx, |thread, cx| {
- // thread.update_model_request_usage(amount as u32, limit, cx);
- // })?;
- // TODO: handle usage update
+ this.update(cx, |thread, cx| {
+ thread.update_model_request_usage(amount, limit, cx);
+ })?;
continue;
}
_ => continue,
@@ -1629,12 +1628,11 @@ impl Thread {
let text = match event {
LanguageModelCompletionEvent::Text(text) => text,
LanguageModelCompletionEvent::StatusUpdate(
- CompletionRequestStatus::UsageUpdated { .. },
+ CompletionRequestStatus::UsageUpdated { amount, limit },
) => {
- // this.update(cx, |thread, cx| {
- // thread.update_model_request_usage(amount as u32, limit, cx);
- // })?;
- // TODO: handle usage update
+ this.update(cx, |thread, cx| {
+ thread.update_model_request_usage(amount, limit, cx);
+ })?;
continue;
}
_ => continue,