Files
9router/open-sse/translator/concerns/message.js
T

7 lines
352 B
JavaScript
Raw Normal View History

import { OPENAI_BLOCK } from "../schema/index.js";
// Collapse an OpenAI content-part array: a lone text part becomes a plain string,
// otherwise the array is returned as-is. Matches existing translator behavior.
export function collapseTextParts(parts) {
return parts.length === 1 && parts[0].type === OPENAI_BLOCK.TEXT ? parts[0].text : parts;
}