(content: string | any)
| 11 | } |
| 12 | |
| 13 | function formatMessageContent(content: string | any): string { |
| 14 | if (typeof content === "string") { |
| 15 | return content; |
| 16 | } else if (Array.isArray(content)) { |
| 17 | // For array content, find the first text part |
| 18 | const textPart = content.find((part: any) => part.type === "text"); |
| 19 | return textPart && "text" in textPart |
| 20 | ? textPart.text |
| 21 | : "(multimodal message)"; |
| 22 | } |
| 23 | return "(unknown content type)"; |
| 24 | } |
| 25 | |
| 26 | export function SessionPreview({ |
| 27 | chatHistory, |