|
|
@@ -1347,16 +1347,6 @@ export function Session() {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
-const MIME_BADGE: Record<string, string> = {
|
|
|
- "text/plain": "txt",
|
|
|
- "image/png": "img",
|
|
|
- "image/jpeg": "img",
|
|
|
- "image/gif": "img",
|
|
|
- "image/webp": "img",
|
|
|
- "application/pdf": "pdf",
|
|
|
- "application/x-directory": "dir",
|
|
|
-}
|
|
|
-
|
|
|
function UserMessage(props: {
|
|
|
message: UserMessage
|
|
|
parts: Part[]
|
|
|
@@ -1417,14 +1407,12 @@ function UserMessage(props: {
|
|
|
<box flexDirection="row" paddingBottom={metadataVisible() ? 1 : 0} paddingTop={1} gap={1} flexWrap="wrap">
|
|
|
<For each={files()}>
|
|
|
{(file) => {
|
|
|
- const bg = createMemo(() => {
|
|
|
- if (file.mime.startsWith("image/")) return theme.accent
|
|
|
- if (file.mime === "application/pdf") return theme.primary
|
|
|
- return theme.secondary
|
|
|
- })
|
|
|
+ const directory = file.mime === "application/x-directory"
|
|
|
return (
|
|
|
<text fg={theme.text}>
|
|
|
- <span style={{ bg: bg(), fg: theme.background }}> {MIME_BADGE[file.mime] ?? file.mime} </span>
|
|
|
+ <span style={{ bg: theme.secondary, fg: theme.background }}>
|
|
|
+ {directory ? " Directory " : " File "}
|
|
|
+ </span>
|
|
|
<span style={{ bg: theme.backgroundElement, fg: theme.textMuted }}> {file.filename} </span>
|
|
|
</text>
|
|
|
)
|