| 154 | * Format the display path for the image |
| 155 | */ |
| 156 | const formatDisplayPath = (path: string): string => { |
| 157 | // If it's already a relative path starting with ./, keep it |
| 158 | if (path.startsWith("./")) return path |
| 159 | // If it's an absolute path, extract the relative portion |
| 160 | // Look for workspace patterns - match the last segment after any directory separator |
| 161 | const workspaceMatch = path.match(/\/([^/]+)\/(.+)$/) |
| 162 | if (workspaceMatch && workspaceMatch[2]) { |
| 163 | // Return relative path from what appears to be the workspace root |
| 164 | return `./${workspaceMatch[2]}` |
| 165 | } |
| 166 | // Otherwise, just get the filename |
| 167 | const filename = path.split("/").pop() |
| 168 | return filename || path |
| 169 | } |
| 170 | |
| 171 | // Handle missing image URI |
| 172 | if (!imageUri) { |