Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: Doc01 icon for Word and Google Docs files (#12340)

Michael Hanbbc0b636520e
diff --git a/studio/frontend/src/components/assistant-ui/attachment-card-preview.tsx b/studio/frontend/src/components/assistant-ui/attachment-card-preview.tsx
index 5458a222586..58839255cb1 100644
--- a/studio/frontend/src/components/assistant-ui/attachment-card-preview.tsx
+++ b/studio/frontend/src/components/assistant-ui/attachment-card-preview.tsx
@@ -38,7 +38,7 @@ export function attachmentPreview(
const DOCUMENT_KINDS: Record<DocumentKind, AttachmentFileKind> = {
pdf: "pdf",
- docx: "document",
+ docx: "word",
sheet: "spreadsheet",
slides: "presentation",
};
diff --git a/studio/frontend/src/features/chat/lib/attachment-file-kind.ts b/studio/frontend/src/features/chat/lib/attachment-file-kind.ts
index e8a689bfe32..1bd2dedde1b 100644
--- a/studio/frontend/src/features/chat/lib/attachment-file-kind.ts
+++ b/studio/frontend/src/features/chat/lib/attachment-file-kind.ts
@@ -5,6 +5,7 @@
import {
AudioWave01Icon,
+ Doc01Icon,
FileEmpty02Icon,
FlimSlateIcon,
Image02Icon,
@@ -22,6 +23,7 @@ export type AttachmentFileKind =
| "pdf"
| "audio"
| "video"
+ | "word"
| "document"
| "spreadsheet"
| "presentation"
@@ -42,7 +44,8 @@ register(
"mp3 mp2 wav m4a ogg oga opus flac aac aiff aif aifc caf wma amr",
);
register("video", "mp4 m4v mov mkv avi webm 3gp 3g2 mpg mpeg wmv");
-register("document", "doc docx odt rtf pages epub");
+register("word", "doc docx docm dot dotx dotm odt ott rtf gdoc");
+register("document", "pages epub");
register("spreadsheet", "csv tsv xls xlsx xlsm ods numbers");
register("presentation", "ppt pptx odp key");
register("web", "html htm xhtml mhtml");
@@ -53,6 +56,20 @@ register(
register("text", "txt md markdown mdx rst log patch diff tex srt vtt");
register("archive", "zip tar gz tgz bz2 xz zst 7z rar");
+// Word, Google Docs and OpenDocument text, for files that arrive without an extension.
+const WORD_TYPES = new Set([
+ "application/msword",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
+ "application/vnd.ms-word.document.macroenabled.12",
+ "application/vnd.ms-word.template.macroenabled.12",
+ "application/vnd.oasis.opendocument.text",
+ "application/vnd.oasis.opendocument.text-template",
+ "application/vnd.google-apps.document",
+ "application/rtf",
+ "text/rtf",
+]);
+
const CODE_BASENAMES = new Set(["dockerfile", "makefile", "gemfile", "rakefile"]);
function extensionOf(name: string): string {
@@ -75,6 +92,7 @@ export function attachmentFileKind(
if (extension && Object.hasOwn(EXTENSION_KINDS, extension)) {
return EXTENSION_KINDS[extension];
}
+ if (WORD_TYPES.has(mime.split(";", 1)[0]!.trim())) return "word";
const base = (name ?? "").toLowerCase().split(/[\\/]/).pop() ?? "";
if (CODE_BASENAMES.has(base)) return "code";
if (mime.startsWith("text/")) return "text";
@@ -87,6 +105,7 @@ export const ATTACHMENT_KIND_ICONS = {
pdf: Pdf01Icon,
audio: AudioWave01Icon,
video: FlimSlateIcon,
+ word: Doc01Icon,
document: FileEmpty02Icon,
spreadsheet: SheetIcon,
presentation: Presentation01Icon,
@@ -102,6 +121,8 @@ export const ATTACHMENT_KIND_ICON_CLASS: Record<AttachmentFileKind, string> = {
pdf: "text-red-500",
audio: "text-violet-500",
video: "text-pink-400 scale-90",
+ // Google Docs' blue, close to Word's lighter blue.
+ word: "text-[#4285F4]",
document: "text-blue-500",
spreadsheet: "text-emerald-500",
presentation: "text-orange-500",
@@ -117,6 +138,7 @@ const KIND_LABELS: Record<Exclude<AttachmentFileKind, "file">, string> = {
pdf: "PDF",
audio: "Audio",
video: "Video",
+ word: "Document",
document: "Document",
spreadsheet: "Spreadsheet",
presentation: "Presentation",
diff --git a/studio/frontend/src/features/library/file-kind.ts b/studio/frontend/src/features/library/file-kind.ts
index 1d84cb09fae..e378ade1bdb 100644
--- a/studio/frontend/src/features/library/file-kind.ts
+++ b/studio/frontend/src/features/library/file-kind.ts
@@ -3,6 +3,7 @@
import {
AudioWave01Icon,
+ Doc01Icon,
FileEmpty02Icon,
FlimSlateIcon,
Image02Icon,
@@ -14,12 +15,14 @@ import {
import { SheetIcon, TestTubeOutlineIcon } from "@/lib/hugeicons-derived";
import type { IconSvgElement } from "@hugeicons/react";
import { documentKind } from "@/components/file-viewer/kind";
+import { attachmentFileKind } from "@/features/chat/lib/attachment-file-kind";
import type { LibraryItem } from "./api";
import { fileExtension } from "./file-name";
export type LibraryFileKind =
| "image"
| "web"
+ | "word"
| "document"
| "spreadsheet"
| "presentation"
@@ -134,6 +137,7 @@ export function fileKind(
if (type.startsWith("video/")) return "video";
if (type === "application/pdf") return "pdf";
if (type === "text/html") return "web";
+ if (attachmentFileKind(item.fileName ?? item.name, type) === "word") return "word";
const viewed = documentKind("", type);
if (viewed === "sheet") return "spreadsheet";
if (viewed === "slides") return "presentation";
@@ -157,7 +161,7 @@ export const TYPE_FILTER_KINDS: Record<LibraryTypeFilter, LibraryFileKind[]> = {
images: ["image"],
videos: ["video"],
audio: ["audio"],
- documents: ["document", "web", "code"],
+ documents: ["word", "document", "web", "code"],
spreadsheets: ["spreadsheet"],
presentations: ["presentation"],
pdfs: ["pdf"],
@@ -166,6 +170,7 @@ export const TYPE_FILTER_KINDS: Record<LibraryTypeFilter, LibraryFileKind[]> = {
export const KIND_ICONS: Record<LibraryFileKind, IconSvgElement> = {
image: Image02Icon,
web: InternetIcon,
+ word: Doc01Icon,
document: FileEmpty02Icon,
spreadsheet: SheetIcon,
presentation: Presentation01Icon,
@@ -177,6 +182,7 @@ export const KIND_ICONS: Record<LibraryFileKind, IconSvgElement> = {
};
export const KIND_ICON_CLASS: Partial<Record<LibraryFileKind, string>> = {
+ word: "text-[#4285F4]",
spreadsheet: "text-emerald-500",
pdf: "text-red-500",
presentation: "text-orange-500",
diff --git a/studio/frontend/tests/chat-attachment-display.test.ts b/studio/frontend/tests/chat-attachment-display.test.ts
index 28f9dbb4f06..5235bd34c8d 100644
--- a/studio/frontend/tests/chat-attachment-display.test.ts
+++ b/studio/frontend/tests/chat-attachment-display.test.ts
@@ -32,7 +32,11 @@ test("each file kind is read off the name, with a decisive MIME type first", ()
["Rain 2.6-1.mp3", "audio/mpeg", "audio"],
["Book.m4a", "", "audio"],
["clip.mov", "", "video"],
- ["Untitled document.docx", "", "document"],
+ ["Untitled document.docx", "", "word"],
+ ["notes.odt", "", "word"],
+ ["Draft", "application/vnd.google-apps.document", "word"],
+ ["Template", "application/vnd.oasis.opendocument.text-template", "word"],
+ ["book.epub", "", "document"],
["results.csv", "text/csv", "spreadsheet"],
["deck.pptx", "", "presentation"],
["flappy-bird(1)(1).html", "", "web"],
@@ -55,7 +59,7 @@ test("each file kind is read off the name, with a decisive MIME type first", ()
test("the common kinds carry the colors people recognize", () => {
assert.match(ATTACHMENT_KIND_ICON_CLASS.pdf, /red/);
assert.match(ATTACHMENT_KIND_ICON_CLASS.audio, /violet/);
- assert.match(ATTACHMENT_KIND_ICON_CLASS.document, /blue/);
+ assert.match(ATTACHMENT_KIND_ICON_CLASS.word, /#4285F4/);
assert.match(ATTACHMENT_KIND_ICON_CLASS.spreadsheet, /emerald/);
assert.match(ATTACHMENT_KIND_ICON_CLASS.presentation, /orange/);
});