Changesets · Branches · Tags · Compare
| Changeset | add90d1f38c61abc22e20d97db754b027bb9d5ca7ae7f479ac36095ea9aada46 |
|---|---|
| Author | Ting-Wai <40179554+tingwai@users.noreply.github.com> · 2025-09-05 14:58 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-05 14:58 -07:00 |
| Parents | af695458de9d, 7e921f486bfb |
1 file changed
modified core/llm/index.ts +13 −11
| @@ -370,8 +370,17 @@ | ||
| 370 | 370 | }, |
| 371 | 371 | }); |
| 372 | 372 | |
| 373 | - if (error !== undefined) { | |
| 374 | - if (error === "cancel" || error.name === "AbortError") { | |
| 373 | + if (typeof error === "undefined") { | |
| 374 | + interaction?.logItem({ | |
| 375 | + kind: "success", | |
| 376 | + promptTokens, | |
| 377 | + generatedTokens, | |
| 378 | + thinkingTokens, | |
| 379 | + usage, | |
| 380 | + }); | |
| 381 | + return "success"; | |
| 382 | + } else { | |
| 383 | + if (error === "cancel" || error?.name?.includes("AbortError")) { | |
| 375 | 384 | interaction?.logItem({ |
| 376 | 385 | kind: "cancel", |
| 377 | 386 | promptTokens, |
| @@ -393,15 +402,6 @@ | ||
| 393 | 402 | }); |
| 394 | 403 | return "error"; |
| 395 | 404 | } |
| 396 | - } else { | |
| 397 | - interaction?.logItem({ | |
| 398 | - kind: "success", | |
| 399 | - promptTokens, | |
| 400 | - generatedTokens, | |
| 401 | - thinkingTokens, | |
| 402 | - usage, | |
| 403 | - }); | |
| 404 | - return "success"; | |
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
| @@ -615,6 +615,7 @@ | ||
| 615 | 615 | kind: "chunk", |
| 616 | 616 | chunk: formattedContent, |
| 617 | 617 | }); |
| 618 | + | |
| 618 | 619 | completion += formattedContent; |
| 619 | 620 | yield content; |
| 620 | 621 | } |
| @@ -630,6 +631,7 @@ | ||
| 630 | 631 | kind: "chunk", |
| 631 | 632 | chunk, |
| 632 | 633 | }); |
| 634 | + | |
| 633 | 635 | completion += chunk; |
| 634 | 636 | yield chunk; |
| 635 | 637 | } |