(part: ReplayPart)
| 121 | } |
| 122 | |
| 123 | export function partToContentChunks(part: ReplayPart): ContentChunk[] { |
| 124 | switch (part.type) { |
| 125 | case "text": |
| 126 | if (!part.text) return [] |
| 127 | return [ |
| 128 | { |
| 129 | content: { |
| 130 | type: "text", |
| 131 | text: part.text, |
| 132 | ...partAudience(part), |
| 133 | }, |
| 134 | }, |
| 135 | ] |
| 136 | |
| 137 | case "file": |
| 138 | return filePartToContentChunks(part) |
| 139 | |
| 140 | case "reasoning": |
| 141 | if (!part.text) return [] |
| 142 | return [ |
| 143 | { |
| 144 | content: { |
| 145 | type: "text", |
| 146 | text: part.text, |
| 147 | }, |
| 148 | }, |
| 149 | ] |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | function resourceLinkToPart(link: ResourceLink): PromptPart { |
| 154 | const parsed = uriToFilePart(link.uri, link.mimeType ?? "text/plain", link.name) |
nothing calls this directly
no test coverage detected