Changesets · Branches · Tags · Compare
| Changeset | 10063232baf3852fd01b1926cee639eb2b945b7f899ea5a5fef3db03ee900b40 |
|---|---|
| Author | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-10 18:31 +05:30 |
| Committer | uinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-10 18:31 +05:30 |
| Parents | 8245094b4ec8 |
1 file changed
modified extensions/cli/src/ui/hooks/useChat.ts +19 −21
| @@ -484,7 +484,25 @@ | ||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | // For non-queued messages, format and add to chat history |
| 487 | - if (!isQueuedMessage) { | |
| 487 | + if (isQueuedMessage) { | |
| 488 | + // For queued messages, chat history is already updated | |
| 489 | + // Check if auto-compacting is needed with current history | |
| 490 | + const { currentChatHistory, currentCompactionIndex } = | |
| 491 | + await handleAutoCompaction({ | |
| 492 | + chatHistory, | |
| 493 | + model, | |
| 494 | + llmApi, | |
| 495 | + compactionIndex, | |
| 496 | + setChatHistory: setChatHistory, | |
| 497 | + setCompactionIndex, | |
| 498 | + }); | |
| 499 | + | |
| 500 | + // Execute the streaming response with the current history (which already includes the queued message) | |
| 501 | + await executeStreamingResponse( | |
| 502 | + currentChatHistory, | |
| 503 | + currentCompactionIndex, | |
| 504 | + ); | |
| 505 | + } else { | |
| 488 | 506 | // Format message with attached files and images |
| 489 | 507 | logger.debug("Processing message with images", { |
| 490 | 508 | hasImages: !!(imageMap && imageMap.size > 0), |
| @@ -516,28 +534,8 @@ | ||
| 516 | 534 | const newHistory = [...currentChatHistory, newUserMessage]; |
| 517 | 535 | setChatHistory(newHistory); |
| 518 | 536 | |
| 519 | - logger.debug("debug1 streaming started again"); | |
| 520 | - | |
| 521 | 537 | // Execute the streaming response |
| 522 | 538 | await executeStreamingResponse(newHistory, currentCompactionIndex); |
| 523 | - } else { | |
| 524 | - // For queued messages, chat history is already updated | |
| 525 | - // Check if auto-compacting is needed with current history | |
| 526 | - const { currentChatHistory, currentCompactionIndex } = | |
| 527 | - await handleAutoCompaction({ | |
| 528 | - chatHistory, | |
| 529 | - model, | |
| 530 | - llmApi, | |
| 531 | - compactionIndex, | |
| 532 | - setChatHistory: setChatHistory, | |
| 533 | - setCompactionIndex, | |
| 534 | - }); | |
| 535 | - | |
| 536 | - // Execute the streaming response with the current history (which already includes the queued message) | |
| 537 | - await executeStreamingResponse( | |
| 538 | - currentChatHistory, | |
| 539 | - currentCompactionIndex, | |
| 540 | - ); | |
| 541 | 539 | } |
| 542 | 540 | }; |
| 543 | 541 |