- 执行过程
-
- {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 (
+