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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: show when a response was written, in its More menu (#11928)
Michael Han680a6ba01b6c
diff --git a/studio/frontend/src/components/assistant-ui/message-menu-time.tsx b/studio/frontend/src/components/assistant-ui/message-menu-time.tsxnew file mode 100644index 00000000000..3fe3f8ed953--- /dev/null+++ b/studio/frontend/src/components/assistant-ui/message-menu-time.tsx@@ -0,0 +1,61 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { ActionBarMorePrimitive, useAuiState } from "@assistant-ui/react";+import { InformationCircleIcon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+} from "@/components/ui/tooltip";+import { useLocale, useT } from "@/i18n";+import { formatMessageDate } from "@/lib/format-message-date";+import type { FC } from "react";++/** When the message was written, heading the More menu, with the details button beside it.+ * The menu renders only while open, so no timer. */+export const MessageMenuTime: FC<{ onShowDetails: () => void }> = ({+ onShowDetails,+}) => {+ const t = useT();+ const locale = useLocale();+ const createdAt = useAuiState(({ message }) => message.createdAt?.getTime());+ const date =+ createdAt !== undefined && Number.isFinite(createdAt)+ ? new Date(createdAt)+ : null;++ return (+ <div className="group/menu-time flex items-center">+ {date && (+ <time+ dateTime={date.toISOString()}+ title={date.toLocaleString(locale, { dateStyle: "full", timeStyle: "short" })}+ className="block select-none py-2 pl-3 pr-1 text-sm text-muted-foreground tabular-nums"+ >+ {formatMessageDate(date.getTime(), Date.now(), locale, {+ today: (time) => t("common.todayAt", { time }),+ yesterday: (time) => t("common.yesterdayAt", { time }),+ })}+ </time>+ )}+ {/* Right after the time. Shown while this row is hovered, or when reached by keyboard. */}+ <Tooltip>+ <TooltipTrigger asChild={true}>+ <ActionBarMorePrimitive.Item+ onSelect={onShowDetails}+ aria-label="See response details"+ className="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:opacity-100 group-hover/menu-time:opacity-100"+ >+ <HugeiconsIcon icon={InformationCircleIcon} strokeWidth={1.75} className="size-icon" />+ </ActionBarMorePrimitive.Item>+ </TooltipTrigger>+ {/* Above, so it never covers the time beside it. */}+ <TooltipContent side="top" className="tooltip-compact">+ See response details+ </TooltipContent>+ </Tooltip>+ </div>+ );+};diff --git a/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsx b/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsxindex f31d71e542c..2103940a890 100644--- a/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsx+++ b/studio/frontend/src/components/assistant-ui/message-response-details-sheet.tsx@@ -24,7 +24,7 @@ import {import { FIND_SKIP_ATTRIBUTE } from "@/features/find-in-page";import { cn } from "@/lib/utils";import { useMessage, useMessageTiming } from "@assistant-ui/react";-import { HelpCircleIcon } from "@hugeicons/core-free-icons";+import { InformationCircleIcon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import type { FC, ReactNode } from "react";@@ -388,7 +388,7 @@ export const MessageResponseDetailsSheet: FC<{<div className="relative"><SheetTitle className="flex items-center gap-2 pr-10 font-heading text-base"><HugeiconsIcon- icon={HelpCircleIcon}+ icon={InformationCircleIcon}strokeWidth={1.75}className="size-icon text-chat-icon-fg"/>diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsxindex a2738a39c67..87f2e786b38 100644--- a/studio/frontend/src/components/assistant-ui/thread.tsx+++ b/studio/frontend/src/components/assistant-ui/thread.tsx@@ -25,6 +25,7 @@ import { ComposerDraftPreview } from "@/components/assistant-ui/composer-draft-pimport { PromptQueueList } from "@/components/assistant-ui/lazy-prompt-queue-list";import { QueueResumeIcon } from "@/components/assistant-ui/queue-resume-icon";import { ProgressiveMessages } from "@/components/assistant-ui/progressive-messages";+import { MessageMenuTime } from "@/components/assistant-ui/message-menu-time";import { MessageTiming } from "@/components/assistant-ui/message-timing";import { attachThreadFastCopy } from "@/components/assistant-ui/thread-fast-copy";import { threadHasResearchMessage } from "@/components/assistant-ui/thread-research-presence";@@ -322,7 +323,6 @@ import {FolderAttachmentIcon,Folder01Icon,FolderAddIcon,- HelpCircleIcon,Image03Icon,McpServerIcon,PencilRulerIcon,@@ -8450,6 +8450,7 @@ const AssistantActionBar: FC = () => {>{/* Prevent an outside dismissal from triggering Delete. */}<MenuDismissGuard triggerRef={moreMenuTriggerRef} />+ <MessageMenuTime onShowDetails={() => setDetailsOpen(true)} />{!inlineReadAloud && ttsEnabled && (<MessagePrimitive.If speaking={false}><ActionBarPrimitive.Speak asChild={true}>@@ -8539,17 +8540,6 @@ const AssistantActionBar: FC = () => {Save to project sources</ActionBarMorePrimitive.Item>)}- <ActionBarMorePrimitive.Item- onSelect={() => setDetailsOpen(true)}- className="aui-action-bar-more-item flex cursor-pointer select-none items-center gap-2 rounded-[12px] px-3 py-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground"- >- <HugeiconsIcon- icon={HelpCircleIcon}- strokeWidth={1.75}- className="size-icon"- />- See response details- </ActionBarMorePrimitive.Item></ActionBarMorePrimitive.Content></ActionBarMorePrimitive.Root><MessageTiming side="top" className="h-8 px-2" />diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex e45f4163e2f..c1d9760af9a 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -109,6 +109,8 @@ export const ar = {error: "خطأ",export: "تصدير",help: "مساعدة",+ todayAt: "اليوم، {time}",+ yesterdayAt: "أمس، {time}",loading: "جارٍ التحميل...",new: "جديد",rename: "إعادة تسمية",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 02e1fa9963d..3ba47ec1cc2 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -112,6 +112,8 @@ export const de = {error: "Fehler",export: "Exportieren",help: "Hilfe",+ todayAt: "Heute, {time}",+ yesterdayAt: "Gestern, {time}",loading: "Wird geladen…",new: "Neu",rename: "Umbenennen",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex bbe81114acd..7a912999d4b 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -110,6 +110,8 @@ export const en = {error: "Error",export: "Export",help: "Help",+ todayAt: "Today, {time}",+ yesterdayAt: "Yesterday, {time}",loading: "Loading...",new: "New",rename: "Rename",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex 3e675e03509..9b00edd2b35 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -111,6 +111,8 @@ export const es = {error: "Error",export: "Exportar",help: "Ayuda",+ todayAt: "Hoy, {time}",+ yesterdayAt: "Ayer, {time}",loading: "Cargando...",new: "Nuevo",rename: "Renombrar",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex dfc05714755..26cd45f2ed8 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -112,6 +112,8 @@ export const fr = {error: "Erreur",export: "Exporter",help: "Aide",+ todayAt: "Aujourd’hui, {time}",+ yesterdayAt: "Hier, {time}",loading: "Chargement...",new: "Nouveau",rename: "Renommer",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 42d28b00e0a..866be5f1603 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -112,6 +112,8 @@ export const hi = {error: "त्रुटि",export: "एक्सपोर्ट करें",help: "सहायता",+ todayAt: "आज, {time}",+ yesterdayAt: "कल, {time}",loading: "लोड हो रहा है...",new: "नया",rename: "नाम बदलें",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex 8c71870d98b..949f4cd9c49 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -76,6 +76,8 @@ export const it = {error: "Errore",export: "Esporta",help: "Aiuto",+ todayAt: "Oggi, {time}",+ yesterdayAt: "Ieri, {time}",loading: "Caricamento...",new: "Nuovo",rename: "Rinomina",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex e69c08b2e88..2b6618354c0 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -111,6 +111,8 @@ export const ja = {error: "エラー",export: "エクスポート",help: "ヘルプ",+ todayAt: "今日 {time}",+ yesterdayAt: "昨日 {time}",loading: "読み込み中...",new: "新規",rename: "名前変更",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex 2585a5d32ac..de4c9d00a0f 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -109,6 +109,8 @@ export const ko = {error: "오류",export: "내보내기",help: "도움말",+ todayAt: "오늘 {time}",+ yesterdayAt: "어제 {time}",loading: "로딩 중...",new: "새로 만들기",rename: "이름 변경",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 4860aaf6daa..0c92c6036a2 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -111,6 +111,8 @@ export const ptBR = {error: "Erro",export: "Exportar",help: "Ajuda",+ todayAt: "Hoje, {time}",+ yesterdayAt: "Ontem, {time}",loading: "Carregando...",new: "Novo",rename: "Renomear",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex 05aebc3207c..49421383319 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -111,6 +111,8 @@ export const ru = {error: "Ошибка",export: "Экспорт",help: "Справка",+ todayAt: "Сегодня, {time}",+ yesterdayAt: "Вчера, {time}",loading: "Загрузка…",new: "Новое",rename: "Переименовать",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex 9d03339689e..9b12e1542e4 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -107,6 +107,8 @@ export const zhCN = {error: "错误",export: "导出",help: "帮助",+ todayAt: "今天 {time}",+ yesterdayAt: "昨天 {time}",loading: "加载中...",new: "新增",rename: "重命名",diff --git a/studio/frontend/src/lib/format-message-date.ts b/studio/frontend/src/lib/format-message-date.tsnew file mode 100644index 00000000000..a31b5c0c64e--- /dev/null+++ b/studio/frontend/src/lib/format-message-date.ts@@ -0,0 +1,33 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import type { Locale } from "@/i18n/messages";++/** "Today, 4:45 AM", "Yesterday, 9:12 PM", then the date, with the year only when it differs. */+export function formatMessageDate(+ createdAt: number,+ now: number,+ locale: Locale,+ labels: {+ today: (time: string) => string;+ yesterday: (time: string) => string;+ },+): string {+ const date = new Date(createdAt);+ const today = new Date(now);+ const time = date.toLocaleTimeString(locale, {+ hour: "numeric",+ minute: "2-digit",+ });+ const sameDay = (a: Date, b: Date) => a.toDateString() === b.toDateString();+ if (sameDay(date, today)) return labels.today(time);+ const yesterday = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1);+ if (sameDay(date, yesterday)) return labels.yesterday(time);+ return date.toLocaleString(locale, {+ month: "short",+ day: "numeric",+ ...(date.getFullYear() !== today.getFullYear() && { year: "numeric" }),+ hour: "numeric",+ minute: "2-digit",+ });+}diff --git a/studio/frontend/tests/format-message-date.test.ts b/studio/frontend/tests/format-message-date.test.tsnew file mode 100644index 00000000000..bcc504ebce0--- /dev/null+++ b/studio/frontend/tests/format-message-date.test.ts@@ -0,0 +1,36 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import { registerBundlerResolver } from "./helpers/kit.ts";++registerBundlerResolver();+const { formatMessageDate } = await import("../src/lib/format-message-date.ts");++const now = new Date(2026, 8, 25, 12, 0).getTime();+const labels = {+ today: (time: string) => `Today, ${time}`,+ yesterday: (time: string) => `Yesterday, ${time}`,+};+const at = (...parts: [number, number, number, number, number]) =>+ formatMessageDate(new Date(...parts).getTime(), now, "en", labels);++test("today and yesterday go by calendar day, not elapsed time", () => {+ assert.match(at(2026, 8, 25, 4, 45), /^Today, 4:45\s?AM$/);+ assert.match(at(2026, 8, 25, 0, 0), /^Today, 12:00\s?AM$/);+ assert.match(at(2026, 8, 24, 23, 59), /^Yesterday, 11:59\s?PM$/);+ assert.match(at(2026, 8, 24, 0, 1), /^Yesterday, 12:01\s?AM$/);+});++test("older messages show the date, with the year only when it differs", () => {+ assert.match(at(2026, 8, 23, 21, 12), /^Sep 23, 9:12\s?PM$/);+ assert.match(at(2025, 8, 13, 21, 12), /2025/);+ // Across New Year, the day before is still yesterday.+ const jan1 = new Date(2027, 0, 1, 9, 0).getTime();+ assert.match(+ formatMessageDate(new Date(2026, 11, 31, 22, 0).getTime(), jan1, "en", labels),+ /^Yesterday, 10:00\s?PM$/,+ );+});