π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π fix(hetero-agent): skip LOADING_FLAT placeholder when restoring accumulatedContent (#15236)
LiJian0561a1d7eb51
diff --git a/src/server/services/heterogeneousAgent/HeterogeneousPersistenceHandler.ts b/src/server/services/heterogeneousAgent/HeterogeneousPersistenceHandler.tsindex b32d37be032..a5883e7c876 100644--- a/src/server/services/heterogeneousAgent/HeterogeneousPersistenceHandler.ts+++ b/src/server/services/heterogeneousAgent/HeterogeneousPersistenceHandler.ts@@ -1,4 +1,5 @@import type { AgentStreamEvent } from '@lobechat/agent-gateway-client';+import { LOADING_FLAT } from '@lobechat/const';import {AgentRuntimeErrorType,type ChatMessageError,@@ -283,7 +284,8 @@ export class HeterogeneousPersistenceHandler {// already read the message in `loadOrCreateState` β the second read is// redundant but harmless and keeps the logic uniform).const refreshed = await this.deps.messageModel.findById(state.currentAssistantMessageId);- const dbContent = (refreshed?.content ?? '') as string;+ const rawDbContent = (refreshed?.content ?? '') as string;+ const dbContent = rawDbContent === LOADING_FLAT ? '' : rawDbContent;const dbReasoning = (refreshed?.reasoning as { content?: string } | null)?.content ?? '';const dbMetadata = ((refreshed?.metadata as Record<string, any> | null) ?? {}) as Record<string,@@ -546,7 +548,10 @@ export class HeterogeneousPersistenceHandler {// persisted tool messages, and overwrites assistant.tools[] with only the// current batch's tools (losing all previous ones).const currentMsg = await this.deps.messageModel.findById(currentAssistantMessageId);- const restoredContent = (currentMsg?.content ?? '') as string;+ // Skip LOADING_FLAT placeholder β it is the initial DB value before any+ // content arrives and must not be treated as real accumulated text.+ const rawContent = (currentMsg?.content ?? '') as string;+ const restoredContent = rawContent === LOADING_FLAT ? '' : rawContent;const restoredReasoning = (currentMsg?.reasoning as { content?: string } | null)?.content ?? '';const restoredMetadata = ((currentMsg?.metadata as Record<string, any> | null) ?? {}) as Record<string,