Repository navigation
Commit 64d6e37
feat(webview): add batchNearby utility for smarter tool ask batching (#1005)
* feat(webview): add batchNearby utility for smarter tool ask batching
Replace batchConsecutive with batchNearby in ChatView.tsx to allow
merging same-type tool asks even when separated by ignorable messages
(api_req_started/finished, empty text rows, reasoning).
Semantic boundaries (user_feedback, visible text, completion_result,
checkpoint_saved, error) stop the merge, preserving correct ordering.
This fixes UX where models like qwen insert API request rows between
tool calls, causing UI to show multiple 'Zoo wants to read this file'
instead of a single batched prompt.
* fix: batchNearby restores dropped ignorable items when bridge fails
When a single target is followed by ignorable messages and then a
boundary (no second target found), the original code silently dropped
those ignorable items — contradicting the documented contract that all
items are preserved in-order.
Fix: track skipped ignorable items in pendingIgnorable, flush them after
the batch result so they're never lost. When bridge succeeds (second
target found), pending items are consumed into the synthesized batch as
expected.
* fix(chat): keep nearby batching boundaries in sync
* fix(chat): share tool batching predicates
---------
Co-authored-by: T <[email protected]>
Co-authored-by: Eason Liang <[email protected]>1 parent f589ce7 commit 64d6e37
7 files changed
Lines changed: 590 additions & 159 deletions
File tree
- webview-ui/src
- components/chat
- __tests__
- utils
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
1279 | 1280 | | |
1280 | 1281 | | |
1281 | 1282 | | |
1282 | | - | |
1283 | | - | |
1284 | | - | |
1285 | | - | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
1286 | 1304 | | |
1287 | 1305 | | |
1288 | 1306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| 115 | + | |
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| |||
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
290 | 308 | | |
291 | 309 | | |
292 | 310 | | |
| |||
308 | 326 | | |
309 | 327 | | |
310 | 328 | | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
311 | 332 | | |
312 | 333 | | |
313 | 334 | | |
| |||
349 | 370 | | |
350 | 371 | | |
351 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
352 | 422 | | |
353 | 423 | | |
354 | 424 | | |
| |||
This file was deleted.
0 commit comments