mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-14 22:02:59 -07:00
fix(core): restore fallback serialization in content-utils to avoid throwing
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user