Damn, missed the latests changes:

Fix ACP Agent mode message chunks enqueue ordering issue (ACP thought chunks were enqueued twice while answer chunks were enqueued once).
This commit is contained in:
Martín Lucas Golini
2026-08-19 01:31:51 -03:00
parent b02fc1f3a6
commit 0287e83642
2 changed files with 6 additions and 4 deletions
@@ -1965,6 +1965,9 @@ void LLMChatUI::writeToLastChat( const std::string& text ) {
void LLMChatUI::updateAgentModeUI() {
mModelBtn->setVisible( !mIsAgentMode );
mReasoningEffort->setVisible( !mIsAgentMode && mCurModel.reasoningConfiguration &&
mCurModel.reasoningConfiguration->type !=
LLMReasoningType::None );
mAgentBtn->setVisible( mIsAgentMode );
mAgentConfigBtn->setVisible( mIsAgentMode );
mChatAdd->setVisible( !mIsAgentMode );
@@ -2001,7 +2004,6 @@ void LLMChatUI::setupAgentSession() {
auto sessionUpdate = msg.value( "sessionUpdate", "" );
if ( sessionUpdate == "agent_message_chunk" ) {
if ( msg.contains( "content" ) && msg["content"].contains( "text" ) ) {
mThinkingBubble = nullptr; // Reset thinking bubble so next thought gets a new one
auto chunk = msg["content"].value( "text", "" );
if ( !chunk.empty() )
writeToLastChat( chunk );
@@ -2010,7 +2012,7 @@ void LLMChatUI::setupAgentSession() {
if ( msg.contains( "content" ) && msg["content"].contains( "text" ) ) {
auto chunk = msg["content"].value( "text", "" );
if ( !chunk.empty() )
runOnMainThread( [this, chunk] { updateThinkingBubble( chunk ); } );
updateThinkingBubble( std::move( chunk ) );
}
} else if ( sessionUpdate == "tool_call" || sessionUpdate == "tool_call_update" ) {
addToolCallUpdate( msg );
@@ -3056,7 +3058,7 @@ void LLMChatUI::addToolCallUpdate( const nlohmann::json& msg ) {
} );
}
void LLMChatUI::updateThinkingBubble( const std::string& chunk ) {
void LLMChatUI::updateThinkingBubble( std::string chunk ) {
if ( chunk.empty() )
return;
@@ -212,7 +212,7 @@ class LLMChatUI : public UILinearLayout, public WidgetCommandExecuter {
void addThinkingBubble();
void updateThinkingBubble( const std::string& chunk );
void updateThinkingBubble( std::string chunk );
void addPermissionUI( const acp::RequestPermissionRequest& req,
std::function<void( const acp::RequestPermissionResponse& )> cb );