Studio: widen doc source parts past SDK SourceMessagePart type

This commit is contained in:
Roland Tannous 2026-05-26 17:58:03 +04:00
commit 9d5719a475

View file

@ -2115,7 +2115,14 @@ export function createOpenAIStreamAdapter(): ChatModelAdapter {
)
: [];
const sourceParts = [...urlSourceParts, ...documentSourceParts];
// SDK's SourceMessagePart only types `sourceType: "url"` with a
// required `url` field. SourcesGroup branches on `sourceType` at
// runtime, so cast the doc-shaped parts through `unknown` rather
// than weakening the helper's strict typing.
const sourceParts = [
...urlSourceParts,
...(documentSourceParts as unknown as typeof urlSourceParts),
];
const meta = serverMetadata;
const finalTokenCount =