From c4e2793db1c32b45fde647cced5e14ffe0d79d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 19 Sep 2026 23:10:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8A=E5=9B=9E=E5=90=88=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E8=BF=87=E7=A8=8B=E6=B8=B2=E6=9F=93=E7=9A=84=E4=B8=A4=E5=B1=82?= =?UTF-8?q?=E4=B8=89=E7=9B=AE=E6=8A=BD=E6=88=90=20renderTurnProcess?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - apps/ai-game-creator-shell/src/view/project-development/chat/components/DirectProjectConversation/DirectProjectTurn.tsx 新增 renderTurnProcess,负责空过程、运行中平铺与结束后折叠三种分支 - 组件主体不再嵌套三目,渲染结果与 data-testid="turn-process" 等 DOM 结构保持不变 --- .../DirectProjectTurn.tsx | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/ai-game-creator-shell/src/view/project-development/chat/components/DirectProjectConversation/DirectProjectTurn.tsx b/apps/ai-game-creator-shell/src/view/project-development/chat/components/DirectProjectConversation/DirectProjectTurn.tsx index 06835a6b8..807dcb409 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/chat/components/DirectProjectConversation/DirectProjectTurn.tsx +++ b/apps/ai-game-creator-shell/src/view/project-development/chat/components/DirectProjectConversation/DirectProjectTurn.tsx @@ -32,22 +32,7 @@ export function DirectProjectTurn({ turn }: { turn: DirectChatTurn }) { {turn.users.map((block) => renderBlock(turn, block, 'body', streamingKey), )} - {turn.process.length > 0 ? ( - turn.active ? ( - turn.process.map((block) => - renderBlock(turn, block, 'process', streamingKey), - ) - ) : ( -
- 执行过程 -
- {turn.process.map((block) => - renderBlock(turn, block, 'process', streamingKey), - )} -
-
- ) - ) : null} + {renderTurnProcess(turn, streamingKey)} {turn.finals.map((block) => renderBlock(turn, block, 'body', streamingKey), )} @@ -56,6 +41,21 @@ export function DirectProjectTurn({ turn }: { turn: DirectChatTurn }) { ); } +/** 运行中的回合把执行过程平铺,已结束的回合折叠进「执行过程」。 */ +function renderTurnProcess(turn: DirectChatTurn, streamingKey: string | null) { + if (turn.process.length === 0) return null; + const blocks = turn.process.map((block) => + renderBlock(turn, block, 'process', streamingKey), + ); + if (turn.active) return blocks; + return ( +
+ 执行过程 +
{blocks}
+
+ ); +} + function DirectProjectTurnUsage({ turn }: { turn: DirectChatTurn }) { if (turn.active || !turn.startedAt) return null; const endedAt = Math.max(turn.endedAt, turn.startedAt);