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 // References are converted to text for the model
result.push({ text: part.text }); result.push({ text: part.text });
break; break;
default: { default:
((x: never) => { debugLogger.warn(
throw new Error(`Unhandled ContentPart type: ${JSON.stringify(x)}`); `Unhandled ContentPart type: ${JSON.stringify(part)} fallback to serialization`,
})(part); );
// Serialize unknown ContentPart variants instead of dropping them
result.push({ text: JSON.stringify(part) });
break; break;
}
} }
} }
return result; return result;