-
- {renderMessageText(message.content)}
-
+ {messages.length === 0 && !loading && (
+
+
+
+
+
BodyMaps AI
+
+ Ask me anything about this scan or medicine in general. Try “segment
+ the liver and tell me its volume,” or attach a file and CT views.
+
- ))}
+ )}
- {loading && (
-
-
-
-
-
+ {messages.map((message) =>
+ message.role === "user" ? (
+
+ {message.attachments && message.attachments.length > 0 && (
+
+ {message.attachments.map((att) =>
+ att.kind === "image" && att.dataUrl ? (
+

setLightboxUrl(att.dataUrl ?? null)}
+ />
+ ) : (
+
+
+
+
+ {att.name}
+
+ )
+ )}
+
+ )}
+ {message.content && (
+
{renderMessageText(message.content)}
+ )}
-
- )}
+ ) : (
+
+ {message.status && !message.content && (
+
+ {message.status}
+
+
+
+
+
+
+ )}
+
+ {message.content && (
+
+ {renderMessageText(message.content)}
+ {message.streaming && }
+
+ )}
+ {!message.streaming && message.content.trim().length > 0 && (
+
+
+
+
+ )}
+
+ )
+ )}
- {messages.length === 0 && !loading && (
-
- {SUGGESTION_CHIPS.map((chip) => (
-
- ))}
-
- )}
-
+ {attachments.length > 0 && (
+
+ {attachments.map((att) =>
+ att.kind === "image" && att.dataUrl ? (
+ // Compact thumbnail so the four captured views fit on one row.
+
+
setLightboxUrl(att.dataUrl ?? null)}
+ />
+
+
+ ) : (
+
+
+
+
+ {att.name}
+
+
+ )
+ )}
+
+ )}
+
-
- {modelMenuOpen && (
-
+
+
+ {captureViewport && (
+
+ )}
+
- {models.map((model) => (
+
+
+ {modelMenuOpen && (
+
+
Local model
+ {models.length > 0 ? (
+ models.map((model) => (
selectModel(model.name)}
role="menuitemradio"
- aria-checked={
- selectedModel === model.name
- }
+ aria-checked={selectedModel === model.name}
type="button"
>
-
- {model.name}
- Installed in Ollama
-
- {selectedModel === model.name ? (
-
- ) : null}
+ {model.name}
+ {selectedModel === model.name ? : null}
- ))}
- >
- ) : (
-
- No Ollama models available
-
- )}
-
- )}
+ ))
+ ) : (
+
No Ollama models available
+ )}
+
+ )}
+
setModelMenuOpen((current) => !current)}
+ disabled={modelState === "loading"}
+ aria-haspopup="menu"
+ aria-expanded={modelMenuOpen}
+ type="button"
+ >
+
+ {modelLabel}
+
+
+
-
- setModelMenuOpen((current) => !current)
- }
- disabled={modelState === "loading"}
- aria-haspopup="menu"
- aria-expanded={modelMenuOpen}
- type="button"
- >
-
-
- {modelLabel}
-
-
-
+ {loading ? (
+
+
+
+ ) : (
+
void handleSend()}
+ disabled={!canSend}
+ aria-label="Send message"
+ type="button"
+ >
+
+
+ )}
+
+
+
+ {/* Rendered through a portal to so it fills the WHOLE screen. If it
+ lived inside .ai-sidebar, that panel's backdrop-filter would make it the
+ containing block for this position:fixed overlay and clip it to the
+ sidebar. The portal escapes that. */}
+ {lightboxUrl &&
+ typeof document !== "undefined" &&
+ createPortal(
+
setLightboxUrl(null)}
+ role="dialog"
+ aria-label="Enlarged image"
+ >
+
void handleSend()}
- disabled={loading || !input.trim()}
- aria-label="Send message"
+ className="ai-lightbox__close"
+ onClick={() => setLightboxUrl(null)}
+ aria-label="Close"
type="button"
>
-
+
-
-
-
+ ,
+ document.body
+ )}