fix(core): restore fallback serialization in content-utils to avoid throwing

This commit is contained in:
Adam Weidman
2026-05-12 15:03:17 -04:00
parent 7bf9d0152f
commit e5b39b319e
+6 -5
View File
@@ -93,12 +93,13 @@ export function contentPartsToGeminiParts(content: ContentPart[]): Part[] {
// References are converted to text for the model
result.push({ text: part.text });
break;
default: {
((x: never) => {
throw new Error(`Unhandled ContentPart type: ${JSON.stringify(x)}`);
})(part);
default:
debugLogger.warn(
`Unhandled ContentPart type: ${JSON.stringify(part)} fallback to serialization`,
);
// Serialize unknown ContentPart variants instead of dropping them
result.push({ text: JSON.stringify(part) });
break;
}
}
}
return result;