( content: ContentBlock[] | string, options: ExportOptions )
| 1 | import type { Conversation, Message, ExportOptions, ContentBlock } from "../types"; |
| 2 | |
| 3 | function filterContent( |
| 4 | content: ContentBlock[] | string, |
| 5 | options: ExportOptions |
| 6 | ): ContentBlock[] | string { |
| 7 | if (typeof content === "string") return content; |
| 8 | |
| 9 | return content.filter((block) => { |
| 10 | if (block.type === "tool_use" || block.type === "tool_result") { |
| 11 | return options.includeToolUse; |
| 12 | } |
| 13 | return true; |
| 14 | }); |
| 15 | } |
| 16 | |
| 17 | function filterMessage(msg: Message, options: ExportOptions): Message { |
| 18 | return { |