UNPKG

@redocly/theme

Version:

Shared UI components lib

22 lines 838 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.splitContentByToolCalls = splitContentByToolCalls; function splitContentByToolCalls(content, toolCalls) { if (!toolCalls || toolCalls.length === 0) { return [{ type: 'text', text: content || '' }]; } const segments = []; let lastPos = 0; for (const toolCall of toolCalls) { if (content && toolCall.position > lastPos) { segments.push({ type: 'text', text: content.substring(lastPos, toolCall.position) }); } segments.push({ type: 'tool', toolCall }); lastPos = toolCall.position; } if (content && lastPos < content.length) { segments.push({ type: 'text', text: content.substring(lastPos) }); } return segments; } //# sourceMappingURL=content-segments.js.map