Fix: Null safety in flattenMessagesToBlocks regex match

This commit is contained in:
Gemini AI
2025-12-14 13:19:35 +04:00
Unverified
parent 1d9057812a
commit d7a6de329b

View File

@@ -1647,7 +1647,8 @@ const flattenMessagesToBlocks = (messages) => {
blockCount++; blockCount++;
} else if (part.match(/^\[AGENT:/)) { } else if (part.match(/^\[AGENT:/)) {
// AGENT TAG BLOCK (New) // AGENT TAG BLOCK (New)
const agentName = part.match(/\[AGENT:\s*([^\]]+)\]/)[1]; const agentMatch = part.match(/\[AGENT:\s*([^\]]+)\]/);
const agentName = agentMatch ? agentMatch[1] : 'Unknown';
blocks.push({ blocks.push({
role: 'assistant', role: 'assistant',
type: 'agent_tag', type: 'agent_tag',