|
|
@@ -78,11 +78,13 @@ export const buildCapsuleAgents = (messages: Message[], isAnswerVisible?: (index
|
|
|
for (let i = 0; i < messages.length; i++) {
|
|
|
const msg = messages[i];
|
|
|
if (msg.type !== 'ai' || !msg.thinkingSteps?.length) continue;
|
|
|
- // 该消息所属问答轮次:此前用户消息条数 + 1
|
|
|
- let round = 1;
|
|
|
- for (let j = 0; j < i; j++) {
|
|
|
+ // 该消息所属问答轮次:数到当前消息为止(含本轮提问)的用户消息条数,
|
|
|
+ // 无前置提问的 AI 消息兜底为第 1 轮
|
|
|
+ let round = 0;
|
|
|
+ for (let j = 0; j <= i; j++) {
|
|
|
if (messages[j].type === 'user') round++;
|
|
|
}
|
|
|
+ round = Math.max(1, round);
|
|
|
for (const group of groupStepsByAgent(msg.thinkingSteps)) {
|
|
|
const hasActivity = group.steps.some((s) => s.type !== 'token');
|
|
|
if (!hasActivity) continue;
|