| 246 | } |
| 247 | |
| 248 | export function getMessageTextContentWithoutThinking(message: RequestMessage) { |
| 249 | let content = ""; |
| 250 | |
| 251 | if (typeof message.content === "string") { |
| 252 | content = message.content; |
| 253 | } else { |
| 254 | for (const c of message.content) { |
| 255 | if (c.type === "text") { |
| 256 | content = c.text ?? ""; |
| 257 | break; |
| 258 | } |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | // Filter out thinking lines (starting with "> ") |
| 263 | return content |
| 264 | .split("\n") |
| 265 | .filter((line) => !line.startsWith("> ") && line.trim() !== "") |
| 266 | .join("\n") |
| 267 | .trim(); |
| 268 | } |
| 269 | |
| 270 | export function getMessageImages(message: RequestMessage): string[] { |
| 271 | if (typeof message.content === "string") { |