if (typeof entry.text === "string") { if (!shouldIncludeContent(messagePhase)) { return undefined;
} return normalizeJoinedText(sanitizeBlockText(entry.text));
}
if (typeof entry.content === "string") { if (!shouldIncludeContent(messagePhase)) { return undefined;
} return normalizeJoinedText(sanitizeBlockText(entry.content));
}
if (!Array.isArray(entry.content)) { return undefined;
}
const hasExplicitPhasedTextBlocks = entry.content.some((block) => { if (!block || typeof block !== "object") { returnfalse;
} const record = block as { type?: unknown; textSignature?: unknown }; if (record.type !== "text") { returnfalse;
} returnBoolean(parseAssistantTextSignature(record.textSignature)?.phase);
});
// Once explicit phased blocks exist, unphased extraction should not revive // legacy text from the same message. if (!phase && hasExplicitPhasedTextBlocks) { return undefined;
}
const parts = entry.content
.map((block) => { if (!block || typeof block !== "object") { returnnull;
} const record = block as { type?: unknown; text?: unknown; textSignature?: unknown }; if (record.type !== "text" || typeof record.text !== "string") { returnnull;
} const signature = parseAssistantTextSignature(record.textSignature); const resolvedPhase =
signature?.phase ?? (hasExplicitPhasedTextBlocks ? undefined : messagePhase); if (!shouldIncludeContent(resolvedPhase)) { returnnull;
} const sanitized = sanitizeBlockText(record.text); return sanitized.trim() ? sanitized : null;
})
.filter((value): value is string => typeof value === "string");
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.