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: add a link preview setting (#16459)
Daniel Hanb1ed65f86cb2
diff --git a/studio/frontend/src/components/assistant-ui/sources.tsx b/studio/frontend/src/components/assistant-ui/sources.tsxindex d2a0f127283..a04ad545d84 100644--- a/studio/frontend/src/components/assistant-ui/sources.tsx+++ b/studio/frontend/src/components/assistant-ui/sources.tsx@@ -13,6 +13,7 @@ import {} from "react";import { useAuiState } from "@assistant-ui/react";import { memoOnArray } from "@/components/assistant-ui/message-derived";+import { useChatPreferencesStore } from "@/features/chat/stores/chat-preferences-store";import { cn } from "@/lib/utils";import { Badge, badgeVariants, type BadgeProps } from "./badge";import {@@ -131,23 +132,31 @@ export interface SourceData {description?: string;}-const SourceBadge: FC<{ source: SourceData; allowRemoteIcons?: boolean }> = ({+const SourceBadge: FC<{+ source: SourceData;+ allowRemoteIcons?: boolean;+ showLinkPreviews: boolean;+}> = ({source,allowRemoteIcons = true,+ showLinkPreviews,}) => {const domain = extractDomain(source.url);const displayTitle = source.title || domain;+ const badge = (+ <span className="inline-block">+ <Source href={source.url}>+ <SourceIcon url={source.url} allowRemoteIcons={allowRemoteIcons} />+ <SourceTitle>{displayTitle}</SourceTitle>+ </Source>+ </span>+ );++ if (!showLinkPreviews) return badge;return (<HoverCard openDelay={0} closeDelay={0}>- <HoverCardTrigger asChild>- <span className="inline-block">- <Source href={source.url}>- <SourceIcon url={source.url} allowRemoteIcons={allowRemoteIcons} />- <SourceTitle>{displayTitle}</SourceTitle>- </Source>- </span>- </HoverCardTrigger>+ <HoverCardTrigger asChild>{badge}</HoverCardTrigger><HoverCardContentside="top"align="start"@@ -180,8 +189,7 @@ const SourceBadge: FC<{ source: SourceData; allowRemoteIcons?: boolean }> = ({const NO_SOURCES: readonly SourceData[] = [];-// The URL sources of a message as a string, so the selector result keeps its value while a-// reply streams: every token rebuilds the content array, but not its source parts.+// A string selector stays equal while streaming rebuilds the content array.const urlSourcesKey = memoOnArray((content: readonly unknown[]): string => {const sources: SourceData[] = [];for (const item of content) {@@ -237,6 +245,7 @@ const SourcesGroupView = memo<{sources: readonly SourceData[];allowRemoteIcons: boolean;}>(({ sources, allowRemoteIcons }) => {+ const showLinkPreviews = useChatPreferencesStore((s) => s.showLinkPreviews);const containerRef = useRef<HTMLDivElement>(null);const [visibleCount, setVisibleCount] = useState<number | null>(null);const [expanded, setExpanded] = useState(false);@@ -311,7 +320,12 @@ const SourcesGroupView = memo<{<div className="flex flex-wrap gap-1">{displayedSources.map((source) => (- <SourceBadge key={source.id} source={source} allowRemoteIcons={allowRemoteIcons} />+ <SourceBadge+ key={source.id}+ source={source}+ allowRemoteIcons={allowRemoteIcons}+ showLinkPreviews={showLinkPreviews}+ />))}{shouldCollapse && !expanded && (<buttondiff --git a/studio/frontend/src/features/chat/stores/chat-preferences-store.ts b/studio/frontend/src/features/chat/stores/chat-preferences-store.tsindex a999cd7be3a..57cffe5262b 100644--- a/studio/frontend/src/features/chat/stores/chat-preferences-store.ts+++ b/studio/frontend/src/features/chat/stores/chat-preferences-store.ts@@ -19,21 +19,6 @@ import {migrateVisibility,} from "../utils/display-visibility.ts";-// Client-side chat UI prefs kept in localStorage, not the chat DB. confirmDeleteChats: off skips-// the delete confirm dialog. alwaysDeleteChatFiles: on also removes the sandbox folder.-// showResponseModel: on shows-// the producing model on responses. thinkingVisibility / toolVisibility: collapsed, auto or-// expanded, see display-visibility.ts. foldToolActivityIntoThinking: on hides a round's tool calls-// until its thinking block is opened, and has no effect while toolVisibility is "expanded".-// pastedTextMinChars: paste length that becomes a .txt attachment; 0 is off.-// showInlineEditResponse: on keeps Edit response in each response's action bar instead of its-// More menu. notifyWhenReplyFinishes: on sends a system notification when a reply ends while the-// window is hidden or unfocused. showReplyTimes: on shows when each reply finished under it.-// showGenerationDetails: on shows live prefill / decode figures while a reply streams and where-// a local model's layers ended up after it loads.-// filesPanelCollapsed: on shrinks Chat with files to a header and-// a row of pills. newChatComposerAtBottom: on docks a new chat's composer at the bottom, as once-// the chat has messages, instead of under the greeting mid-page.export interface ChatPreferencesState {plainTextComposer: boolean;setPlainTextComposer: (value: boolean) => void;@@ -49,6 +34,8 @@ export interface ChatPreferencesState {setAlwaysDeleteChatFiles: (value: boolean) => void;showResponseModel: boolean;setShowResponseModel: (value: boolean) => void;+ showLinkPreviews: boolean;+ setShowLinkPreviews: (value: boolean) => void;showReplyTimes: boolean;setShowReplyTimes: (value: boolean) => void;showGenerationDetails: boolean;@@ -101,10 +88,10 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(set({ alwaysDeleteChatFiles }),showResponseModel: false,setShowResponseModel: (showResponseModel) => set({ showResponseModel }),- // Off by default: it adds text under every reply, so it stays opt in.+ showLinkPreviews: true,+ setShowLinkPreviews: (showLinkPreviews) => set({ showLinkPreviews }),showReplyTimes: false,setShowReplyTimes: (showReplyTimes) => set({ showReplyTimes }),- // Off by default: it adds a line of numbers under streaming replies, so it stays opt in.showGenerationDetails: false,setShowGenerationDetails: (showGenerationDetails) =>set({ showGenerationDetails }),@@ -125,7 +112,6 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(autoScrollWhileGenerating: true,setAutoScrollWhileGenerating: (autoScrollWhileGenerating) =>set({ autoScrollWhileGenerating }),- // Off by default: it asks for notification permission, so it stays opt in.notifyWhenReplyFinishes: false,setNotifyWhenReplyFinishes: (notifyWhenReplyFinishes) =>set({ notifyWhenReplyFinishes }),@@ -161,6 +147,7 @@ export const useChatPreferencesStore = create<ChatPreferencesState>()(confirmDeleteChats: saved?.confirmDeleteChats ?? true,alwaysDeleteChatFiles: saved?.alwaysDeleteChatFiles ?? false,showResponseModel: saved?.showResponseModel ?? false,+ showLinkPreviews: saved?.showLinkPreviews !== false,showReplyTimes: saved?.showReplyTimes === true,showGenerationDetails: saved?.showGenerationDetails === true,showInlineEditResponse: saved?.showInlineEditResponse ?? true,diff --git a/studio/frontend/src/features/settings/settings-search.ts b/studio/frontend/src/features/settings/settings-search.tsindex c02eafa5676..e3b522dbe14 100644--- a/studio/frontend/src/features/settings/settings-search.ts+++ b/studio/frontend/src/features/settings/settings-search.ts@@ -160,6 +160,7 @@ export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {"settings.chat.tools.visibility","settings.chat.tools.foldIntoThinking","settings.chat.webSearch.images",+ "settings.chat.showLinkPreviews","settings.chat.inlineEditResponse","settings.chat.showReplyTimes","settings.chat.showGenerationDetails",@@ -492,6 +493,7 @@ export const SETTINGS_SEARCH_KEYWORDS: Partial<"settings.chat.tools.foldIntoThinking": "settings.chat.visibilityKeywords","settings.chat.autoScroll": "settings.chat.autoScrollKeywords","settings.chat.replyNotification": "settings.chat.replyNotificationKeywords",+ "settings.chat.showLinkPreviews": "settings.chat.showLinkPreviewsDescription","settings.chat.showReplyTimes": "settings.chat.showReplyTimesKeywords","settings.chat.showGenerationDetails": "settings.chat.showGenerationDetailsKeywords",// match protocol and agent names omitted from the title.diff --git a/studio/frontend/src/features/settings/tabs/chat-tab.tsx b/studio/frontend/src/features/settings/tabs/chat-tab.tsxindex df05d2e16b9..1d521190f3d 100644--- a/studio/frontend/src/features/settings/tabs/chat-tab.tsx+++ b/studio/frontend/src/features/settings/tabs/chat-tab.tsx@@ -358,6 +358,12 @@ export function ChatTab() {const setShowResponseModel = useChatPreferencesStore((state) => state.setShowResponseModel,);+ const showLinkPreviews = useChatPreferencesStore(+ (state) => state.showLinkPreviews,+ );+ const setShowLinkPreviews = useChatPreferencesStore(+ (state) => state.setShowLinkPreviews,+ );const showReplyTimes = useChatPreferencesStore((state) => state.showReplyTimes,);@@ -673,6 +679,16 @@ export function ChatTab() {</LazyImportBoundary><SettingsSection title={t("settings.chat.groups.display.title")}>+ <SettingsRow+ label={t("settings.chat.showLinkPreviews")}+ description={t("settings.chat.showLinkPreviewsDescription")}+ >+ <Switch+ aria-label={t("settings.chat.showLinkPreviews")}+ checked={showLinkPreviews}+ onCheckedChange={setShowLinkPreviews}+ />+ </SettingsRow><SettingsRowlabel={t("settings.chat.webSearch.images")}description={t("settings.chat.webSearch.imagesDescription")}diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.tsindex ad9b233717b..1fd6a894e97 100644--- a/studio/frontend/src/i18n/locales/ar.ts+++ b/studio/frontend/src/i18n/locales/ar.ts@@ -2947,6 +2947,8 @@ export const ar = {"الإشعارات محظورة. اسمح بها لـ Unsloth في إعدادات المتصفح أو النظام، ثم حاول مرة أخرى.",replyNotificationKeywords:"إشعار تنبيه انتهى اكتمل جاهز رد خلفية مصغر notify notification alert done finished reply background",+ showLinkPreviews: "معاينات الروابط",+ showLinkPreviewsDescription: "عرض المعاينات عند تمرير المؤشر فوق روابط المصادر.",showResponseModel: "إظهار نموذج الاستجابة",showResponseModelDescription:"إظهار البيانات الوصفية للنموذج في ردود المساعد.",diff --git a/studio/frontend/src/i18n/locales/cs.ts b/studio/frontend/src/i18n/locales/cs.tsindex 21e608c73c9..14cde0fe964 100644--- a/studio/frontend/src/i18n/locales/cs.ts+++ b/studio/frontend/src/i18n/locales/cs.ts@@ -3211,6 +3211,8 @@ export const cs = {"Oznámení jsou blokována. Povolte je pro Unsloth v nastavení prohlížeče nebo systému a zkuste to znovu.",replyNotificationKeywords:"oznámení upozornění hotovo dokončeno připraveno odpověď pozadí minimalizováno zvuk notify notification alert done finished complete ready response reply background minimized desktop sound",+ showLinkPreviews: "Náhledy odkazů",+ showLinkPreviewsDescription: "Zobrazovat náhledy při najetí na odkazy na zdroje.",showResponseModel: "Model odpovědi",showResponseModelDescription:"Zobrazovat v odpovědích asistenta podrobnosti o modelu.",diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.tsindex 56ffdbecdb7..f6b49f4dcf2 100644--- a/studio/frontend/src/i18n/locales/de.ts+++ b/studio/frontend/src/i18n/locales/de.ts@@ -2988,6 +2988,8 @@ export const de = {"Benachrichtigungen sind blockiert. Erlaube sie für Unsloth in den Browser- oder Systemeinstellungen und versuche es erneut.",replyNotificationKeywords:"Benachrichtigung benachrichtigen Hinweis fertig abgeschlossen bereit Antwort Hintergrund minimiert notify notification alert done finished reply background",+ showLinkPreviews: "Linkvorschauen",+ showLinkPreviewsDescription: "Vorschauen beim Bewegen des Mauszeigers über Quellenlinks anzeigen.",showResponseModel: "Antwortmodell anzeigen",showResponseModelDescription:"Modellmetadaten in Antworten des Assistenten anzeigen.",diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.tsindex 3a720f2b5b7..3add17f0b39 100644--- a/studio/frontend/src/i18n/locales/en.ts+++ b/studio/frontend/src/i18n/locales/en.ts@@ -2960,6 +2960,8 @@ export const en = {"Notifications are blocked. Allow them for Unsloth in your browser or system settings, then try again.",replyNotificationKeywords:"notify notification alert done finished complete ready response reply background minimized desktop sound",+ showLinkPreviews: "Link previews",+ showLinkPreviewsDescription: "Show previews when hovering over source links.",showResponseModel: "Response model",showResponseModelDescription:"Show model details in assistant responses.",diff --git a/studio/frontend/src/i18n/locales/es-419.ts b/studio/frontend/src/i18n/locales/es-419.tsindex ecd42837ad6..80658fa7143 100644--- a/studio/frontend/src/i18n/locales/es-419.ts+++ b/studio/frontend/src/i18n/locales/es-419.ts@@ -3239,6 +3239,8 @@ export const es419 = {"Las notificaciones están bloqueadas. Permítelas para Unsloth en la configuración del navegador o del sistema y vuelve a intentarlo.",replyNotificationKeywords:"notificación avisar alerta terminado completado listo respuesta segundo plano minimizado escritorio sonido notify notification alert done finished complete ready response reply background minimized desktop sound",+ showLinkPreviews: "Vistas previas de enlaces",+ showLinkPreviewsDescription: "Mostrar vistas previas al pasar el cursor sobre los enlaces a fuentes.",showResponseModel: "Modelo de la respuesta",showResponseModelDescription:"Muestra los detalles del modelo en las respuestas del asistente.",diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.tsindex d512e666ccd..afd7dd2995e 100644--- a/studio/frontend/src/i18n/locales/es.ts+++ b/studio/frontend/src/i18n/locales/es.ts@@ -2979,6 +2979,8 @@ export const es = {"Las notificaciones están bloqueadas. Permítelas para Unsloth en la configuración del navegador o del sistema y vuelve a intentarlo.",replyNotificationKeywords:"notificación avisar alerta terminado completado listo respuesta segundo plano minimizado notify notification alert done finished reply background",+ showLinkPreviews: "Vistas previas de enlaces",+ showLinkPreviewsDescription: "Mostrar vistas previas al pasar el cursor sobre los enlaces a fuentes.",showResponseModel: "Mostrar el modelo de respuesta",showResponseModelDescription:"Muestra los metadatos del modelo en las respuestas del asistente.",diff --git a/studio/frontend/src/i18n/locales/fa.ts b/studio/frontend/src/i18n/locales/fa.tsindex 21385c5de8c..ee027757466 100644--- a/studio/frontend/src/i18n/locales/fa.ts+++ b/studio/frontend/src/i18n/locales/fa.ts@@ -3181,6 +3181,8 @@ export const fa = {"اعلانها مسدود هستند. آنها را برای Unsloth در تنظیمات مرورگر یا سیستم مجاز کنید و دوباره تلاش کنید.",replyNotificationKeywords:"اعلان هشدار تمام پایان کامل آماده پاسخ پسزمینه کوچکشده دسکتاپ صدا notification",+ showLinkPreviews: "پیشنمایش پیوندها",+ showLinkPreviewsDescription: "نمایش پیشنمایش هنگام قرار گرفتن نشانگر روی پیوندهای منابع.",showResponseModel: "مدل پاسخ",showResponseModelDescription:"جزئیات مدل در پاسخهای دستیار نمایش داده شود.",diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.tsindex 3a19215fe2e..9254d516786 100644--- a/studio/frontend/src/i18n/locales/fr.ts+++ b/studio/frontend/src/i18n/locales/fr.ts@@ -2984,6 +2984,8 @@ export const fr = {"Les notifications sont bloquées. Autorisez-les pour Unsloth dans les réglages du navigateur ou du système, puis réessayez.",replyNotificationKeywords:"notification notifier alerte terminé fini prêt réponse arrière-plan réduit notify notification alert done finished reply background",+ showLinkPreviews: "Aperçus des liens",+ showLinkPreviewsDescription: "Afficher un aperçu au survol des liens vers les sources.",showResponseModel: "Afficher le modèle de réponse",showResponseModelDescription:"Afficher les métadonnées du modèle dans les réponses de l’assistant.",diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.tsindex 5d3d46296f8..e1edfdcb1e7 100644--- a/studio/frontend/src/i18n/locales/he.ts+++ b/studio/frontend/src/i18n/locales/he.ts@@ -3028,6 +3028,8 @@ export const he = {"ההתראות חסומות. יש לאפשר אותן ל-Unsloth בהגדרות הדפדפן או המערכת ולנסות שוב.",replyNotificationKeywords:"notify notification alert done finished reply background minimized התראה הודעה הסתיים מוכן תשובה רקע ממוזער",+ showLinkPreviews: "תצוגות מקדימות של קישורים",+ showLinkPreviewsDescription: "הצגת תצוגות מקדימות במעבר העכבר מעל קישורי מקורות.",showResponseModel: "מודל המענה",showResponseModelDescription: "הצג פרטי מודל בתשובות העוזר.",showReplyTimes: "זמני תשובות",diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.tsindex 8ada02c706e..86cad297575 100644--- a/studio/frontend/src/i18n/locales/hi.ts+++ b/studio/frontend/src/i18n/locales/hi.ts@@ -2956,6 +2956,8 @@ export const hi = {"सूचनाएँ ब्लॉक हैं। ब्राउज़र या सिस्टम सेटिंग्स में Unsloth के लिए इन्हें अनुमति दें, फिर दोबारा कोशिश करें।",replyNotificationKeywords:"सूचना अलर्ट पूरा तैयार जवाब बैकग्राउंड notify notification alert done finished reply background",+ showLinkPreviews: "लिंक पूर्वावलोकन",+ showLinkPreviewsDescription: "स्रोत लिंक पर कर्सर ले जाने पर पूर्वावलोकन दिखाएं।",showResponseModel: "जवाब देने वाला मॉडल दिखाएँ",showResponseModelDescription:"असिस्टेंट के जवाबों में मॉडल का मेटाडेटा दिखाएँ।",diff --git a/studio/frontend/src/i18n/locales/id.ts b/studio/frontend/src/i18n/locales/id.tsindex 551a2410f41..df20235adfe 100644--- a/studio/frontend/src/i18n/locales/id.ts+++ b/studio/frontend/src/i18n/locales/id.ts@@ -3194,6 +3194,8 @@ export const id = {"Notifikasi diblokir. Izinkan notifikasi untuk Unsloth di pengaturan browser atau sistem Anda, lalu coba lagi.",replyNotificationKeywords:"notify notification alert done finished complete ready response reply background minimized desktop sound notifikasi pemberitahuan selesai balasan latar belakang suara",+ showLinkPreviews: "Pratinjau tautan",+ showLinkPreviewsDescription: "Tampilkan pratinjau saat mengarahkan kursor ke tautan sumber.",showResponseModel: "Model respons",showResponseModelDescription:"Tampilkan detail model di respons asisten.",diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.tsindex ca2abea82df..24d97361b47 100644--- a/studio/frontend/src/i18n/locales/it.ts+++ b/studio/frontend/src/i18n/locales/it.ts@@ -2884,6 +2884,8 @@ export const it = {"Le notifiche sono bloccate. Consentile per Unsloth nelle impostazioni del browser o del sistema, poi riprova.",replyNotificationKeywords:"notifica avvisare avviso finito completato pronto risposta background ridotto notify notification alert done finished reply background",+ showLinkPreviews: "Anteprime dei link",+ showLinkPreviewsDescription: "Mostra le anteprime passando il puntatore sui link alle fonti.",showResponseModel: "Mostra il modello della risposta",showResponseModelDescription:"Mostra i metadati del modello nelle risposte dell'assistente.",diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.tsindex 554f2318b7e..c1405e40044 100644--- a/studio/frontend/src/i18n/locales/ja.ts+++ b/studio/frontend/src/i18n/locales/ja.ts@@ -2933,6 +2933,8 @@ export const ja = {"通知がブロックされています。ブラウザーまたはシステムの設定で Unsloth の通知を許可してから、もう一度お試しください。",replyNotificationKeywords:"通知 アラート 完了 終了 準備完了 応答 バックグラウンド 最小化 notify notification alert done finished reply background",+ showLinkPreviews: "リンクのプレビュー",+ showLinkPreviewsDescription: "ソースのリンクにカーソルを合わせるとプレビューを表示します。",showResponseModel: "応答モデルを表示",showResponseModelDescription:"アシスタントの応答にモデルのメタデータを表示します。",diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.tsindex a5368d31cf8..5da416570b7 100644--- a/studio/frontend/src/i18n/locales/ko.ts+++ b/studio/frontend/src/i18n/locales/ko.ts@@ -2940,6 +2940,8 @@ export const ko = {"알림이 차단되어 있습니다. 브라우저 또는 시스템 설정에서 Unsloth의 알림을 허용한 후 다시 시도하세요.",replyNotificationKeywords:"알림 통지 완료 끝 준비 응답 백그라운드 최소화 notify notification alert done finished reply background",+ showLinkPreviews: "링크 미리보기",+ showLinkPreviewsDescription: "출처 링크 위에 마우스를 올리면 미리보기를 표시합니다.",showResponseModel: "응답 모델 표시",showResponseModelDescription:"어시스턴트 응답에 모델 메타데이터를 표시합니다.",diff --git a/studio/frontend/src/i18n/locales/nl.ts b/studio/frontend/src/i18n/locales/nl.tsindex 754d7423b5a..237af5748c0 100644--- a/studio/frontend/src/i18n/locales/nl.ts+++ b/studio/frontend/src/i18n/locales/nl.ts@@ -3235,6 +3235,8 @@ export const nl = {"Meldingen zijn geblokkeerd. Sta ze toe voor Unsloth in je browser- of systeeminstellingen en probeer het opnieuw.",replyNotificationKeywords:"melden melding waarschuwing klaar voltooid gereed antwoord reactie achtergrond geminimaliseerd bureaublad geluid notify notification alert done reply",+ showLinkPreviews: "Linkvoorbeelden",+ showLinkPreviewsDescription: "Toon voorbeelden wanneer je de muisaanwijzer boven bronlinks houdt.",showResponseModel: "Antwoordmodel",showResponseModelDescription:"Modelgegevens tonen in antwoorden van de assistent.",diff --git a/studio/frontend/src/i18n/locales/pl.ts b/studio/frontend/src/i18n/locales/pl.tsindex 369a1b9997e..f9beace1c89 100644--- a/studio/frontend/src/i18n/locales/pl.ts+++ b/studio/frontend/src/i18n/locales/pl.ts@@ -3230,6 +3230,8 @@ export const pl = {"Powiadomienia są zablokowane. Zezwól na nie dla Unsloth w ustawieniach przeglądarki lub systemu i spróbuj ponownie.",replyNotificationKeywords:"notify notification alert done finished complete ready response reply background minimized desktop sound powiadomienie alert gotowe zakończone odpowiedź tło zminimalizowany dźwięk",+ showLinkPreviews: "Podglądy linków",+ showLinkPreviewsDescription: "Pokazuj podglądy po najechaniu kursorem na linki do źródeł.",showResponseModel: "Model odpowiedzi",showResponseModelDescription:"Pokazuj szczegóły modelu w odpowiedziach asystenta.",diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.tsindex 28869b668ee..5d0e40da0b9 100644--- a/studio/frontend/src/i18n/locales/pt-br.ts+++ b/studio/frontend/src/i18n/locales/pt-br.ts@@ -2961,6 +2961,8 @@ export const ptBR = {"As notificações estão bloqueadas. Permita-as para o Unsloth nas configurações do navegador ou do sistema e tente novamente.",replyNotificationKeywords:"notificação avisar alerta terminou concluído pronto resposta segundo plano minimizado notify notification alert done finished reply background",+ showLinkPreviews: "Prévias de links",+ showLinkPreviewsDescription: "Mostrar prévias ao passar o cursor sobre os links das fontes.",showResponseModel: "Mostrar o modelo da resposta",showResponseModelDescription:"Mostra os metadados do modelo nas respostas do assistente.",diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.tsindex 89d69e20f31..764f7863c6f 100644--- a/studio/frontend/src/i18n/locales/ru.ts+++ b/studio/frontend/src/i18n/locales/ru.ts@@ -2960,6 +2960,8 @@ export const ru = {"Уведомления заблокированы. Разрешите их для Unsloth в настройках браузера или системы и попробуйте снова.",replyNotificationKeywords:"уведомление оповещение готово завершено ответ фон свернут notify notification alert done finished reply background",+ showLinkPreviews: "Предпросмотр ссылок",+ showLinkPreviewsDescription: "Показывать предпросмотр при наведении на ссылки на источники.",showResponseModel: "Показывать модель в ответах",showResponseModelDescription:"Показывать метаданные модели в ответах ассистента.",diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.tsindex a288847cbeb..8c585013291 100644--- a/studio/frontend/src/i18n/locales/sv.ts+++ b/studio/frontend/src/i18n/locales/sv.ts@@ -3109,6 +3109,8 @@ export const sv = {"Aviseringar är blockerade. Tillåt dem för Unsloth i webbläsarens eller systemets inställningar och försök igen.",replyNotificationKeywords:"avisering notis meddelande klar färdig svar bakgrund minimerad notify notification alert done finished reply background",+ showLinkPreviews: "Länkförhandsvisningar",+ showLinkPreviewsDescription: "Visa förhandsvisningar när du håller muspekaren över källänkar.",showResponseModel: "Svarsmodell",showResponseModelDescription:"Visa modellinformation i assistentens svar.",diff --git a/studio/frontend/src/i18n/locales/th.ts b/studio/frontend/src/i18n/locales/th.tsindex c20e4bb60ee..1f8e8f60af6 100644--- a/studio/frontend/src/i18n/locales/th.ts+++ b/studio/frontend/src/i18n/locales/th.ts@@ -3061,6 +3061,8 @@ export const th = {"การแจ้งเตือนถูกบล็อก อนุญาตการแจ้งเตือนสำหรับ Unsloth ในการตั้งค่าเบราว์เซอร์หรือระบบ แล้วลองอีกครั้ง",replyNotificationKeywords:"แจ้งเตือน การแจ้งเตือน เตือน เสร็จ เสร็จสิ้น พร้อม การตอบกลับ ตอบกลับ เบื้องหลัง ย่อ เดสก์ท็อป เสียง notify notification alert done reply background desktop sound",+ showLinkPreviews: "ตัวอย่างลิงก์",+ showLinkPreviewsDescription: "แสดงตัวอย่างเมื่อวางตัวชี้เมาส์เหนือลิงก์แหล่งข้อมูล",showResponseModel: "โมเดลที่ตอบ",showResponseModelDescription: "แสดงรายละเอียดโมเดลในคำตอบของผู้ช่วย",showReplyTimes: "เวลาตอบกลับ",diff --git a/studio/frontend/src/i18n/locales/tr.ts b/studio/frontend/src/i18n/locales/tr.tsindex 74bdf62799e..1888a8bdebe 100644--- a/studio/frontend/src/i18n/locales/tr.ts+++ b/studio/frontend/src/i18n/locales/tr.ts@@ -3192,6 +3192,8 @@ export const tr = {"Bildirimler engellenmiş. Tarayıcınızın veya sisteminizin ayarlarından Unsloth için bildirimlere izin verin, ardından yeniden deneyin.",replyNotificationKeywords:"bildir bildirim uyarı bitti tamamlandı hazır yanıt cevap arka plan simge durumu masaüstü ses notification",+ showLinkPreviews: "Bağlantı önizlemeleri",+ showLinkPreviewsDescription: "Kaynak bağlantılarının üzerine gelindiğinde önizlemeleri göster.",showResponseModel: "Yanıt modeli",showResponseModelDescription:"Asistan yanıtlarında model ayrıntılarını gösterin.",diff --git a/studio/frontend/src/i18n/locales/uk.ts b/studio/frontend/src/i18n/locales/uk.tsindex 0db36668d53..cfd1d6a9976 100644--- a/studio/frontend/src/i18n/locales/uk.ts+++ b/studio/frontend/src/i18n/locales/uk.ts@@ -3220,6 +3220,8 @@ export const uk = {"Сповіщення заблоковано. Дозвольте їх для Unsloth у налаштуваннях браузера або системи, а потім повторіть спробу.",replyNotificationKeywords:"сповіщення сповістити оповіщення готово завершено виконано відповідь фон згорнуто робочий стіл звук notification",+ showLinkPreviews: "Попередній перегляд посилань",+ showLinkPreviewsDescription: "Показувати попередній перегляд під час наведення на посилання на джерела.",showResponseModel: "Модель відповіді",showResponseModelDescription:"Показувати відомості про модель у відповідях асистента.",diff --git a/studio/frontend/src/i18n/locales/vi.ts b/studio/frontend/src/i18n/locales/vi.tsindex d39be0785fe..16e650949c7 100644--- a/studio/frontend/src/i18n/locales/vi.ts+++ b/studio/frontend/src/i18n/locales/vi.ts@@ -3194,6 +3194,8 @@ export const vi = {"Thông báo đang bị chặn. Hãy cho phép thông báo của Unsloth trong cài đặt trình duyệt hoặc hệ thống, rồi thử lại.",replyNotificationKeywords:"notify notification alert done finished complete ready response reply background minimized desktop sound thông báo cảnh báo xong hoàn tất sẵn sàng trả lời chạy nền thu nhỏ âm thanh",+ showLinkPreviews: "Xem trước liên kết",+ showLinkPreviewsDescription: "Hiển thị bản xem trước khi di chuột qua liên kết nguồn.",showResponseModel: "Mô hình trả lời",showResponseModelDescription:"Hiển thị thông tin mô hình trong câu trả lời của trợ lý.",diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.tsindex c06d7f1163a..099f481676c 100644--- a/studio/frontend/src/i18n/locales/zh-CN.ts+++ b/studio/frontend/src/i18n/locales/zh-CN.ts@@ -2905,6 +2905,8 @@ export const zhCN = {"通知已被阻止。请在浏览器或系统设置中允许 Unsloth 发送通知,然后重试。",replyNotificationKeywords:"通知 提醒 完成 结束 就绪 回复 后台 最小化 notify notification alert done finished reply background",+ showLinkPreviews: "链接预览",+ showLinkPreviewsDescription: "将鼠标悬停在来源链接上时显示预览。",showResponseModel: "显示回复模型",showResponseModelDescription: "在助手回复中显示模型元数据。",showReplyTimes: "回复时间",diff --git a/studio/frontend/src/i18n/locales/zh-TW.ts b/studio/frontend/src/i18n/locales/zh-TW.tsindex cee2eae9e98..37d3bd07ef8 100644--- a/studio/frontend/src/i18n/locales/zh-TW.ts+++ b/studio/frontend/src/i18n/locales/zh-TW.ts@@ -3043,6 +3043,8 @@ export const zhTW = {"通知已遭封鎖。請在瀏覽器或系統設定中允許 Unsloth 傳送通知,然後再試一次。",replyNotificationKeywords:"通知 提醒 完成 就緒 回應 回覆 背景 最小化 桌面 音效 notify notification alert done finished complete ready response reply background minimized desktop sound",+ showLinkPreviews: "連結預覽",+ showLinkPreviewsDescription: "將滑鼠游標停留在來源連結上時顯示預覽。",showResponseModel: "回應模型",showResponseModelDescription: "在助理回應中顯示模型詳細資料。",showReplyTimes: "回覆時間",diff --git a/studio/frontend/tests/link-previews.test.ts b/studio/frontend/tests/link-previews.test.tsnew file mode 100644index 00000000000..6f0c601f741--- /dev/null+++ b/studio/frontend/tests/link-previews.test.ts@@ -0,0 +1,138 @@+// 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 { beforeEach, test } from "node:test";+import * as React from "react";+import * as jsxRuntime from "react/jsx-runtime";+import { renderToStaticMarkup } from "react-dom/server";++import type * as SourcesModule from "../src/components/assistant-ui/sources.tsx";+import { installLocalStorageFake, registerBundlerResolver } from "./helpers/kit.ts";+import { loadWithStubs } from "./helpers/module-stubs.ts";++const { store: storage } = installLocalStorageFake();+registerBundlerResolver();+const { useChatPreferencesStore: preferences } = await import(+ "../src/features/chat/stores/chat-preferences-store.ts"+);+const STORAGE_KEY = "unsloth_chat_preferences";++beforeEach(() => {+ preferences.setState(preferences.getInitialState(), true);+ storage.clear();+});++test("link previews remain enabled for new users", () => {+ assert.equal(preferences.getInitialState().showLinkPreviews, true);+});++test("older preferences gain enabled previews without resetting saved choices", async () => {+ storage.set(+ STORAGE_KEY,+ JSON.stringify({+ version: 1,+ state: {+ showResponseModel: true,+ autoScrollWhileGenerating: false,+ sendShortcut: "mod-enter",+ },+ }),+ );+ await preferences.persist.rehydrate();+ const state = preferences.getState();+ assert.equal(state.showLinkPreviews, true);+ assert.equal(state.showResponseModel, true);+ assert.equal(state.autoScrollWhileGenerating, false);+ assert.equal(state.sendShortcut, "mod-enter");+});++test("both preview choices survive reloading the persisted preferences", async () => {+ for (const enabled of [false, true]) {+ preferences.getState().setShowLinkPreviews(enabled);+ const saved = storage.get(STORAGE_KEY)!;+ assert.equal(JSON.parse(saved).state.showLinkPreviews, enabled);+ preferences.setState(preferences.getInitialState(), true);+ storage.set(STORAGE_KEY, saved);+ await preferences.persist.rehydrate();+ assert.equal(preferences.getState().showLinkPreviews, enabled);+ }+});++test("setting the same preview choice repeatedly preserves the stored state", () => {+ for (const enabled of [false, true]) {+ preferences.getState().setShowLinkPreviews(enabled);+ const saved = storage.get(STORAGE_KEY);+ preferences.getState().setShowLinkPreviews(enabled);+ assert.equal(storage.get(STORAGE_KEY), saved);+ assert.equal(preferences.getState().showLinkPreviews, enabled);+ }+});++const passthrough = ({ children }: { children?: React.ReactNode }) =>+ React.createElement(React.Fragment, null, children);+let showLinkPreviews = true;+const { SourcesGroup } = loadWithStubs<typeof SourcesModule>(+ new URL("../src/components/assistant-ui/sources.tsx", import.meta.url),+ {+ react: React,+ "react/jsx-runtime": jsxRuntime,+ "@/lib/open-link": { openLink: () => false },+ "@assistant-ui/react": {+ useAuiState: (select: (state: unknown) => unknown) =>+ select({ message: { content: [] } }),+ },+ "@/components/assistant-ui/message-derived": {+ memoOnArray: (select: unknown) => select,+ },+ "@/features/chat/stores/chat-preferences-store": {+ useChatPreferencesStore: (+ select: (state: { showLinkPreviews: boolean }) => unknown,+ ) => select({ showLinkPreviews }),+ },+ "@/lib/utils": {+ cn: (...classes: unknown[]) => classes.filter(Boolean).join(" "),+ },+ "./badge": { Badge: passthrough, badgeVariants: () => "" },+ "@/components/ui/hover-card": {+ HoverCard: ({ children }: { children?: React.ReactNode }) =>+ React.createElement("div", { "data-preview-root": true }, children),+ HoverCardTrigger: passthrough,+ HoverCardContent: ({ children }: { children?: React.ReactNode }) =>+ React.createElement("aside", { "data-preview-content": true }, children),+ },+ },+);++const SOURCE = {+ id: "source-1",+ url: "https://example.com/reference",+ title: "Reference article",+ description: "Details shown in the hover preview.",+};++function renderSources(enabled: boolean): string {+ showLinkPreviews = enabled;+ return renderToStaticMarkup(+ React.createElement(SourcesGroup, {+ sources: [SOURCE],+ allowRemoteIcons: false,+ }),+ );+}++test("disabling previews keeps the source link without mounting a hover card", () => {+ const html = renderSources(false);+ assert.match(html, /href="https:\/\/example\.com\/reference"/);+ assert.match(html, /Reference article/);+ assert.doesNotMatch(html, /data-preview-root|data-preview-content/);+ assert.doesNotMatch(html, /Details shown in the hover preview/);+});++test("enabling previews restores the card around the same source link", () => {+ const html = renderSources(true);+ assert.match(html, /href="https:\/\/example\.com\/reference"/);+ assert.match(html, /data-preview-root="true"/);+ assert.match(html, /data-preview-content="true"/);+ assert.match(html, /Details shown in the hover preview/);+});