fix(ai): tolerate null Responses message content

closes #5819
This commit is contained in:
Armin Ronacher
2026-06-16 19:00:12 +02:00
parent 910508595a
commit 2d597f0212
2 changed files with 3 additions and 1 deletions

View File

@@ -456,7 +456,8 @@ export async function processResponsesStream<TApi extends Api>(
});
currentBlock = null;
} else if (item.type === "message" && currentBlock?.type === "text") {
currentBlock.text = item.content.map((c) => (c.type === "output_text" ? c.text : c.refusal)).join("");
currentBlock.text =
item.content?.map((c) => (c.type === "output_text" ? c.text : c.refusal)).join("") || "";
currentBlock.textSignature = encodeTextSignatureV1(item.id, item.phase ?? undefined);
stream.push({
type: "text_end",