DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
style(chat): calmer Activity home and a narrower default viewer
Bingxi Zhao (Frank)20fd7c566266
diff --git a/web/app/globals.css b/web/app/globals.cssindex a2f6ef99b..51161f9e6 100644--- a/web/app/globals.css+++ b/web/app/globals.css@@ -944,9 +944,9 @@ body[data-picker-open] .dt-breathing-text {/* Viewer panel (tabbed file/web preview, opened from message attachmentsor assistant links) is next-widest. Wins over the activity panel whenboth are open. Width is user-resizable, so the squeeze tracks the- ``--viewer-width`` var the panel writes (falls back to 620px). */+ ``--viewer-width`` var the panel writes (falls back to 520px). */.chat-preview-shell[data-preview-open="false"][data-viewer-open="true"] {- padding-right: min(var(--viewer-width, 620px), 92vw);+ padding-right: min(var(--viewer-width, 520px), 92vw);}}diff --git a/web/components/chat/home/SessionActivityPanel.tsx b/web/components/chat/home/SessionActivityPanel.tsxindex b33030bc6..7c3e4c7dc 100644--- a/web/components/chat/home/SessionActivityPanel.tsx+++ b/web/components/chat/home/SessionActivityPanel.tsx@@ -3,18 +3,9 @@import { BOOKS_HOME } from "@/lib/learning-routes";/**- * SessionActivityPanel — right-side column of *floating cards* recording- * the conversation's tools, knowledge bases, Space refs, and attachments.- *- * Design notes- * ────────────- * • The panel itself has **no background** — cards float over the page so- * the chat surface still bleeds through. Each card carries its own border- * + faint shadow so it reads as a discrete block.- * • Clicking an attachment row fires `onOpenAttachment(att)` upward; the- * parent routes it into the SessionViewerPanel as a new file tab.- * • Section content is suppressed entirely when empty — no skeleton cards- * for tools/KBs/Space/attachments that never showed up in this session.+ * The Activity home lists the conversation's tools, references, and files.+ * Clicking a file opens it as a tab in SessionViewerPanel. Empty groups are+ * omitted, so the panel remains a short index as a conversation grows.*/import { useEffect, useState, type ReactNode } from "react";@@ -23,6 +14,7 @@ import {AtSign,BookOpen,Brain,+ ChevronRight,ClipboardList,Database,ExternalLink,@@ -296,97 +288,111 @@ export function ActivityBody({if (activity.isEmpty && !configSection) {return (- <SectionCard icon={Wrench} title={t("Session activity")}>- <div className="px-3.5 py-5 text-center text-[12px] italic text-[var(--muted-foreground)]/80">- {t(- "As you chat, the tools and references you use — and the files the tutor generates — will appear here.",- )}+ <section className="overflow-hidden rounded-2xl border border-[var(--border)]/60 bg-[var(--card)] shadow-[0_2px_12px_color-mix(in_srgb,var(--foreground)_3%,transparent)]">+ <header className="border-b border-[var(--border)]/45 px-4 py-3">+ <h2 className="text-[13px] font-semibold text-[var(--foreground)]">+ {t("Session activity")}+ </h2>+ </header>+ <div className="flex items-start gap-3 px-4 py-4">+ <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[var(--muted)]/55 text-[var(--muted-foreground)]">+ <Wrench size={15} strokeWidth={1.7} aria-hidden="true" />+ </span>+ <p className="min-w-0 pt-0.5 text-[12px] leading-[1.65] text-[var(--muted-foreground)]">+ {t(+ "As you chat, the tools and references you use — and the files the tutor generates — will appear here.",+ )}+ </p></div>- </SectionCard>+ </section>);}return (- <div className="space-y-2.5">- {tools.length > 0 ? (- <SectionCard icon={Wrench} title={t("Tools used")} count={tools.length}>- <ul className="space-y-0.5 p-1.5">- {tools.map((tool) => (- <li- key={tool.name}- className="flex items-center justify-between gap-2 rounded-md px-2 py-1.5 text-[12px] text-[var(--foreground)] transition-colors hover:bg-[var(--muted)]/35"- >- <span className="truncate font-medium">{tool.name}</span>- <span className="shrink-0 rounded-full bg-[var(--muted)]/55 px-1.5 py-[1px] text-[10px] font-semibold text-[var(--muted-foreground)]">- ×{tool.count}- </span>- </li>- ))}- </ul>- </SectionCard>- ) : null}+ <div className="space-y-4">+ {!activity.isEmpty ? (+ <div className="divide-y divide-[var(--border)]/45 overflow-hidden rounded-2xl border border-[var(--border)]/60 bg-[var(--card)] shadow-[0_2px_12px_color-mix(in_srgb,var(--foreground)_3%,transparent)]">+ {tools.length > 0 ? (+ <SectionCard icon={Wrench} title={t("Tools used")} count={tools.length}>+ <ul className="px-2 pb-2">+ {tools.map((tool) => (+ <li+ key={tool.name}+ className="flex min-h-8 items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-[12px] text-[var(--foreground)]"+ >+ <span className="truncate font-medium">{tool.name}</span>+ <span className="shrink-0 text-[11px] tabular-nums text-[var(--muted-foreground)]">+ ×{tool.count}+ </span>+ </li>+ ))}+ </ul>+ </SectionCard>+ ) : null}- {knowledgeBases.length > 0 ? (- <SectionCard- icon={Database}- title={t("Knowledge bases")}- count={knowledgeBases.length}- >- <ul className="space-y-0.5 p-1.5">- {knowledgeBases.map((kb) => (- <li- key={kb}- className="truncate rounded-md px-2 py-1.5 text-[12px] font-medium text-[var(--foreground)] transition-colors hover:bg-[var(--muted)]/35"- >- {kb}- </li>- ))}- </ul>- </SectionCard>- ) : null}+ {knowledgeBases.length > 0 ? (+ <SectionCard+ icon={Database}+ title={t("Knowledge bases")}+ count={knowledgeBases.length}+ >+ <ul className="px-2 pb-2">+ {knowledgeBases.map((kb) => (+ <li+ key={kb}+ className="min-h-8 truncate rounded-lg px-2.5 py-1.5 text-[12px] font-medium text-[var(--foreground)]"+ >+ {kb}+ </li>+ ))}+ </ul>+ </SectionCard>+ ) : null}- {spaceSubsections.length > 0 ? (- <SectionCard icon={AtSign} title={t("Space")}>- <div className="space-y-1.5 p-1.5">{spaceSubsections}</div>- </SectionCard>- ) : null}+ {spaceSubsections.length > 0 ? (+ <SectionCard icon={AtSign} title={t("Space")}>+ <div className="space-y-1 px-2 pb-2">{spaceSubsections}</div>+ </SectionCard>+ ) : null}- {/* Above Attachments: what this conversation produced is what you come- back for, more often than a file you uploaded and already have. */}- {artifacts.length > 0 ? (- <SectionCard- icon={Sparkles}- title={t("Generated files")}- count={artifacts.length}- >- <ul className="space-y-0.5 p-1.5">- {artifacts.map(({ attachment, messageIndex }, i) => (- <AttachmentRow- key={`${attachment.id ?? attachment.filename ?? i}-${messageIndex}`}- attachment={attachment}- onOpen={() => onOpenAttachment(attachment)}- />- ))}- </ul>- </SectionCard>- ) : null}+ {/* Above Attachments: what this conversation produced is what you come+ back for, more often than a file you uploaded and already have. */}+ {artifacts.length > 0 ? (+ <SectionCard+ icon={Sparkles}+ title={t("Generated files")}+ count={artifacts.length}+ >+ <ul className="px-2 pb-2">+ {artifacts.map(({ attachment, messageIndex }, i) => (+ <AttachmentRow+ key={`${attachment.id ?? attachment.filename ?? i}-${messageIndex}`}+ attachment={attachment}+ onOpen={() => onOpenAttachment(attachment)}+ />+ ))}+ </ul>+ </SectionCard>+ ) : null}- {attachments.length > 0 ? (- <SectionCard- icon={Paperclip}- title={t("Attachments")}- count={attachments.length}- >- <ul className="space-y-0.5 p-1.5">- {attachments.map(({ attachment, messageIndex }, i) => (- <AttachmentRow- key={`${attachment.id ?? attachment.filename ?? i}-${messageIndex}`}- attachment={attachment}- onOpen={() => onOpenAttachment(attachment)}- />- ))}- </ul>- </SectionCard>+ {attachments.length > 0 ? (+ <SectionCard+ icon={Paperclip}+ title={t("Attachments")}+ count={attachments.length}+ >+ <ul className="px-2 pb-2">+ {attachments.map(({ attachment, messageIndex }, i) => (+ <AttachmentRow+ key={`${attachment.id ?? attachment.filename ?? i}-${messageIndex}`}+ attachment={attachment}+ onOpen={() => onOpenAttachment(attachment)}+ />+ ))}+ </ul>+ </SectionCard>+ ) : null}+ </div>) : null}{configSection}@@ -395,7 +401,7 @@ export function ActivityBody({}/* ------------------------------------------------------------------ */-/* Card primitives */+/* Compact section primitives *//* ------------------------------------------------------------------ */function SectionCard({@@ -410,18 +416,18 @@ function SectionCard({children: ReactNode;}) {return (- <section className="overflow-hidden rounded-xl border border-[var(--border)]/55 bg-[var(--card)] shadow-[0_1px_2px_color-mix(in_srgb,var(--foreground)_5%,transparent),0_4px_14px_color-mix(in_srgb,var(--foreground)_5%,transparent)]">- <header className="flex items-center gap-2 border-b border-[var(--border)]/35 px-3.5 py-2.5">+ <section>+ <header className="flex items-center gap-2.5 px-4 pb-1.5 pt-3"><Icon- size={13}+ size={14}strokeWidth={1.8}className="shrink-0 text-[var(--muted-foreground)]"/>- <span className="flex-1 text-[12px] font-semibold tracking-[0.005em] text-[var(--foreground)]">+ <h3 className="flex-1 text-[12px] font-semibold text-[var(--foreground)]">{title}- </span>+ </h3>{count !== undefined && count > 0 ? (- <span className="shrink-0 rounded-full bg-[var(--muted)]/55 px-1.5 py-[1px] text-[10px] font-semibold text-[var(--muted-foreground)]">+ <span className="shrink-0 text-[11px] tabular-nums text-[var(--muted-foreground)]">{count}</span>) : null}@@ -441,30 +447,32 @@ function SpaceSubsection({children: ReactNode;}) {const Icon = category.icon;+ const { t } = useTranslation();return (<div><Linkhref={category.href}- className="group flex items-center gap-2 rounded-md px-2 py-1 transition-colors hover:bg-[var(--muted)]/40"+ className="group flex min-h-8 items-center gap-2 rounded-lg px-2.5 py-1 transition-colors hover:bg-[var(--muted)]/55 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--ring)]"><Iconsize={12}strokeWidth={1.8}className="shrink-0 text-[var(--muted-foreground)]"/>- <span className="flex-1 truncate text-[10.5px] font-semibold uppercase tracking-[0.06em] text-[var(--muted-foreground)] transition-colors group-hover:text-[var(--primary)]">- {category.label}+ <span className="flex-1 truncate text-[11.5px] font-medium text-[var(--foreground)] transition-colors group-hover:text-[var(--primary)]">+ {t(category.label)}</span>- <span className="rounded-full bg-[var(--muted)]/55 px-1.5 py-[1px] text-[10px] font-semibold text-[var(--muted-foreground)]">+ <span className="text-[11px] tabular-nums text-[var(--muted-foreground)]">{count}</span><ExternalLinksize={10}strokeWidth={2}+ aria-hidden="true"className="shrink-0 text-[var(--muted-foreground)] opacity-0 transition-opacity group-hover:opacity-100"/></Link>- <ul className="mt-0.5 space-y-px pl-5">{children}</ul>+ <ul className="ml-[21px] border-l border-[var(--border)]/45 pl-2">{children}</ul></div>);}@@ -477,7 +485,7 @@ function SpaceItemRow({subtitle?: string;}) {return (- <li className="flex items-center gap-2 rounded-md px-2 py-1 text-[12px] transition-colors hover:bg-[var(--muted)]/35">+ <li className="flex min-h-7 items-center gap-2 rounded-md px-2 py-1 text-[11.5px]"><span className="block min-w-0 flex-1 truncate font-medium text-[var(--foreground)]">{title}</span>@@ -518,9 +526,9 @@ function AttachmentRow({type="button"onClick={onOpen}title={diskPath ?? undefined}- className="flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-[var(--muted)]/35"+ className="group flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-[var(--muted)]/55 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--ring)]">- <span className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-[var(--muted)]/55">+ <span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[var(--muted)]/65"><Iconsize={13}strokeWidth={1.6}@@ -531,10 +539,16 @@ function AttachmentRow({<span className="block truncate text-[12px] font-medium text-[var(--foreground)]">{filename}</span>- <span className="block truncate text-[10px] uppercase tracking-wide text-[var(--muted-foreground)]">+ <span className="block truncate text-[10.5px] text-[var(--muted-foreground)]">{detail}</span></span>+ <ChevronRight+ size={14}+ strokeWidth={1.7}+ aria-hidden="true"+ className="shrink-0 text-[var(--muted-foreground)]/65 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"+ /></button></li>);diff --git a/web/components/chat/home/SessionViewerPanel.tsx b/web/components/chat/home/SessionViewerPanel.tsxindex fc0615423..ccecf5abc 100644--- a/web/components/chat/home/SessionViewerPanel.tsx+++ b/web/components/chat/home/SessionViewerPanel.tsx@@ -31,6 +31,7 @@ import {Activity,AlertCircle,ArrowRight,+ ChevronRight,Compass,Download,ExternalLink,@@ -112,7 +113,7 @@ const ANIM_MS = 220;together while dragging. */const VIEWER_WIDTH_VAR = "--viewer-width";const VIEWER_WIDTH_KEY = "dt:viewer-width";-const VIEWER_WIDTH_DEFAULT = 620;+const VIEWER_WIDTH_DEFAULT = 520;const VIEWER_WIDTH_MIN = 400;const VIEWER_WIDTH_MAX = 960;@@ -766,6 +767,7 @@ function TabBar({<buttontype="button"onClick={onSelectHome}+ aria-pressed={homeActive}className={`inline-flex shrink-0 items-center gap-1.5 rounded-t-md py-1.5 pl-2.5 pr-3 text-[11.5px] font-medium transition-colors ${homeActive? "bg-[var(--card)] text-[var(--foreground)]"@@ -862,7 +864,7 @@ function ActivityHome({onOpenLocalFile: (file: File) => void;}) {return (- <div className="h-full overflow-y-auto px-3 py-3">+ <div className="h-full overflow-y-auto bg-[color-mix(in_srgb,var(--muted)_18%,var(--card))] px-4 pb-8 pt-4 sm:px-5"><ActivityBodyactivity={activity}open={open}@@ -877,7 +879,7 @@ function ActivityHome({);}-/** Compact "open a URL or local file" footer for the Activity home. */+/** Two quiet action rows for opening a URL or local file as a viewer tab. */function ActivityOpener({onOpenWebTab,onOpenLocalFile,@@ -907,46 +909,51 @@ function ActivityOpener({);return (- <div className="mt-3 space-y-2 border-t border-[var(--border)]/40 pt-3">- <div className="px-1 text-[10.5px] font-semibold uppercase tracking-[0.06em] text-[var(--muted-foreground)]/70">+ <section className="mt-4 overflow-hidden rounded-2xl border border-[var(--border)]/60 bg-[var(--card)] shadow-[0_2px_12px_color-mix(in_srgb,var(--foreground)_3%,transparent)]">+ <h2 className="px-4 pb-1.5 pt-3 text-[12px] font-semibold text-[var(--foreground)]">{t("Open")}- </div>- <form- onSubmit={(e) => {- e.preventDefault();- submitUrl();- }}- className="flex items-center gap-2 rounded-lg border border-[var(--border)]/55 bg-[var(--background)] px-2.5 py-1.5 transition-colors focus-within:border-[var(--primary)]/40"- >- <Globe- size={13}- strokeWidth={1.8}- className="shrink-0 text-[var(--muted-foreground)]"- />- <input- type="text"- value={urlInput}- onChange={(e) => setUrlInput(e.target.value)}- placeholder={t("https://example.com")}- className="min-w-0 flex-1 bg-transparent text-[12.5px] text-[var(--foreground)] outline-none placeholder:text-[var(--muted-foreground)]/60"- />+ </h2>+ <div className="px-2 pb-2">+ <form+ onSubmit={(e) => {+ e.preventDefault();+ submitUrl();+ }}+ className="flex min-h-10 items-center gap-2.5 rounded-lg px-2.5 transition-colors hover:bg-[var(--muted)]/45 focus-within:bg-[var(--muted)]/55 focus-within:outline-2 focus-within:outline-offset-[-2px] focus-within:outline-[var(--ring)]"+ >+ <Globe+ size={16}+ strokeWidth={1.7}+ aria-hidden="true"+ className="shrink-0 text-[var(--muted-foreground)]"+ />+ <input+ type="text"+ value={urlInput}+ onChange={(e) => setUrlInput(e.target.value)}+ aria-label={t("Open URL")}+ placeholder={t("https://example.com")}+ className="min-w-0 flex-1 bg-transparent text-[12px] text-[var(--foreground)] outline-none placeholder:text-[var(--muted-foreground)]/70"+ />+ <button+ type="submit"+ disabled={!urlInput.trim()}+ className="inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[var(--primary)] text-[var(--primary-foreground)] transition-opacity hover:opacity-80 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--ring)] disabled:bg-[var(--muted)] disabled:text-[var(--muted-foreground)] disabled:opacity-60"+ aria-label={t("Open URL")}+ >+ <ArrowRight size={13} strokeWidth={2} />+ </button>+ </form><button- type="submit"- disabled={!urlInput.trim()}- className="inline-flex shrink-0 items-center gap-1 rounded-md bg-[var(--primary)] px-2 py-1 text-[11px] font-medium text-[var(--primary-foreground)] transition-opacity disabled:opacity-30"- aria-label={t("Open URL")}+ type="button"+ onClick={() => fileInputRef.current?.click()}+ className="group flex min-h-10 w-full items-center gap-2.5 rounded-lg px-2.5 text-left text-[12px] font-medium text-[var(--foreground)] transition-colors hover:bg-[var(--muted)]/55 focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--ring)]">- <ArrowRight size={11} strokeWidth={2.2} />+ <FileUp size={16} strokeWidth={1.7} aria-hidden="true" className="shrink-0 text-[var(--muted-foreground)]" />+ <span className="min-w-0 flex-1 truncate">{t("Open a local file")}</span>+ <ChevronRight size={14} strokeWidth={1.7} aria-hidden="true" className="shrink-0 text-[var(--muted-foreground)] opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100" /></button>- </form>- <button- type="button"- onClick={() => fileInputRef.current?.click()}- className="inline-flex w-full items-center justify-center gap-2 rounded-lg border border-[var(--border)]/55 bg-[var(--background)] px-3 py-1.5 text-[12px] font-medium text-[var(--muted-foreground)] transition-colors hover:border-[var(--primary)]/35 hover:text-[var(--primary)]"- >- <FileUp size={13} strokeWidth={1.8} />- {t("Open a local file")}- </button>+ </div><inputref={fileInputRef}type="file"@@ -955,7 +962,7 @@ function ActivityOpener({aria-hidden="true"tabIndex={-1}/>- </div>+ </section>);}