AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
feat(frontend): restyle chat markdown tables (#15442)
Ubbebcaef654bc56
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CredentialMention/__tests__/CredentialMentionMarkdown.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CredentialMention/__tests__/CredentialMentionMarkdown.test.tsxindex a9dc749cf7..712a5f16a3 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/CredentialMention/__tests__/CredentialMentionMarkdown.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/CredentialMention/__tests__/CredentialMentionMarkdown.test.tsx@@ -33,8 +33,8 @@ describe("credential badges in messages", () => {expect(await screen.findByText("Work Gmail")).toBeTruthy();const table = container.querySelector("table");expect(table).not.toBeNull();- expect(table?.parentElement?.className).toBe(- "my-4 max-w-full overflow-x-auto",+ expect(table?.parentElement?.classList.contains("overflow-x-auto")).toBe(+ true,);});});diff --git a/autogpt_platform/frontend/src/components/ai-elements/message.stories.tsx b/autogpt_platform/frontend/src/components/ai-elements/message.stories.tsxindex 4fbe629623..44de85fbe5 100644--- a/autogpt_platform/frontend/src/components/ai-elements/message.stories.tsx+++ b/autogpt_platform/frontend/src/components/ai-elements/message.stories.tsx@@ -92,6 +92,31 @@ export const LinkSafetyModal: Story = {),};+export const WithTable: Story = {+ render: () => (+ <div className="flex max-w-3xl flex-col gap-4">+ <AssistantMessage>+ {[+ "Here are the **10 most recent unresolved issues** in `significant-gravitas`, ranked by impact:\n\n",+ "| # | Issue | Events | Users | Last seen |\n",+ "|---|---|---|---|---|\n",+ "| 1 | **[BUILDER-62F]** LaunchDarkly `waitForInitialization` timeout warning | 186,914 | 19,785 | 2 min ago |\n",+ "| 2 | **[AUTOGPT-SERVER-96T]** UserPaywalledError: subscription required (Scheduler) | 137,759 | 0 | now |\n",+ "| 3 | **[BUILDER-9]** ApplicationNotResponding ≥5000 ms | 15,867 | 0 | now |\n",+ "| 4 | **[BUILDER-8KQ]** Local storage is not available | 1,914 | 0 | 2 min ago |\n",+ "| 5 | **[BUILDER-3S3]** WebSocket error `[object Event]` (`/onboarding`) | 1,555 | 989 | now |\n",+ "| 6 | **[AUTOGPT-SERVER-9QY]** model_router: `claude-opus-4-8` default refused by catalog | 218 | 0 | now |\n",+ "| 7 | **[BUILDER-Q]** NetworkError fetching resource | 69 | 21 | 2 min ago |\n",+ "| 8 | **[AUTOGPT-SERVER-9R1]** copilot routing refused `claude-opus-4-8` slug | 67 | 0 | now |\n",+ "| 9 | **[BUILDER-26P]** NetworkError (dev-builder.agpt.co) | 48 | 19 | 2 min ago |\n",+ "| 10 | **[BUILDER-8TA]** Synchronous XMLHttpRequest deprecation | 20 | 1 | 2 min ago |\n\n",+ "Two stand out: **BUILDER-3S3** (WebSocket error hitting 989 real users on onboarding) and the **model_router** pair refusing `claude-opus-4-8`.",+ ].join("")}+ </AssistantMessage>+ </div>+ ),+};+export const Conversation: Story = {render: () => (<div className="flex flex-col gap-4">diff --git a/autogpt_platform/frontend/src/components/ai-elements/message.tsx b/autogpt_platform/frontend/src/components/ai-elements/message.tsxindex e6ddb6de89..8b2f21c7e1 100644--- a/autogpt_platform/frontend/src/components/ai-elements/message.tsx+++ b/autogpt_platform/frontend/src/components/ai-elements/message.tsx@@ -362,14 +362,17 @@ export const MessageResponse = memo(className={cn("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_pre]:!bg-white","[&_a]:text-blue-500 [&_a]:no-underline hover:[&_a]:underline",- // Raycast/Linear-style markdown tables — clean borders, subtle row- // separators, light header, no outer-corner artifacts.- "[&_table]:w-full [&_table]:border-separate [&_table]:border-spacing-0 [&_table]:border [&_table]:border-zinc-200 [&_table]:text-sm",- "[&_thead]:bg-zinc-50",- "[&_th]:border-b [&_th]:border-zinc-200 [&_th]:px-3 [&_th]:py-2 [&_th]:text-left [&_th]:font-medium [&_th]:text-zinc-600",- "[&_td]:border-b [&_td]:border-zinc-100 [&_td]:px-3 [&_td]:py-2 [&_td]:align-top [&_td]:text-zinc-800",+ // Raycast-style markdown tables: a rounded card with a quiet small-caps+ // header, hairline row separators and tabular figures.+ "[&_table]:w-full [&_table]:border-separate [&_table]:border-spacing-0 [&_table]:border-0 [&_table]:text-[13px] [&_table]:tabular-nums",+ "[&_tbody]:bg-transparent [&_thead]:bg-message-table-header",+ "[&_th]:h-9 [&_th]:whitespace-nowrap [&_th]:border-b [&_th]:border-zinc-200 [&_th]:px-4 [&_th]:py-0 [&_th]:text-left [&_th]:text-[11px] [&_th]:font-medium [&_th]:uppercase [&_th]:tracking-[0.06em] [&_th]:text-indigo-950/70",+ "[&_th:first-child]:text-shadow-message-table-violet [&_th:last-child]:text-shadow-message-table-blue [&_th]:text-shadow-message-table-indigo",+ "[&_td]:border-b [&_td]:border-zinc-100 [&_td]:px-4 [&_td]:py-2 [&_td]:align-top [&_td]:text-[13px] [&_td]:leading-5 [&_td]:text-zinc-700 [&_td]:transition-colors",+ "[&_td_strong]:font-medium [&_td_strong]:text-zinc-950",+ "[&_td_code]:whitespace-nowrap [&_td_code]:rounded [&_td_code]:bg-zinc-100 [&_td_code]:px-1 [&_td_code]:py-px [&_td_code]:text-[12px] [&_td_code]:text-zinc-700","[&_tbody_tr:last-child_td]:border-b-0",- "[&_tbody_tr:hover_td]:bg-zinc-50/60",+ "[&_tbody_tr:hover_td]:bg-zinc-50",className,)}components={{@@ -377,7 +380,7 @@ export const MessageResponse = memo(// Wrap in an overflow-x-auto div so the page never grows past the// chat container — the table scrolls internally instead.table: ({ children, ...tableProps }) => (- <div className="my-4 max-w-full overflow-x-auto">+ <div className="my-4 max-w-full overflow-x-auto rounded-xl border border-zinc-200 bg-white shadow-message-table"><table {...tableProps}>{children}</table></div>),diff --git a/autogpt_platform/frontend/tailwind.config.ts b/autogpt_platform/frontend/tailwind.config.tsindex b8ec0bdf34..9133742d39 100644--- a/autogpt_platform/frontend/tailwind.config.ts+++ b/autogpt_platform/frontend/tailwind.config.ts@@ -51,6 +51,15 @@ const grainTexture = plugin(function grainTexture({ addUtilities }) {});});+const textShadow = plugin(function textShadow({ matchUtilities, theme }) {+ matchUtilities(+ {+ "text-shadow": (value) => ({ textShadow: value }),+ },+ { values: theme("textShadow") },+ );+});+const config = {darkMode: ["class", ".dark-mode"], // ignore dark: prefix classes for now until we fully support dark modecontent: ["./src/**/*.{ts,tsx}", "./node_modules/streamdown/dist/**/*.js"],@@ -182,6 +191,19 @@ const config = {},boxShadow: {subtle: "0px 1px 2px 0px rgba(0,0,0,0.05)",+ "message-table": "0 1px 2px rgba(0,0,0,0.04)",+ },+ backgroundImage: {+ "message-table-header":+ "radial-gradient(35% 160% at 8% 0%, rgba(139,92,246,0.05), transparent), radial-gradient(35% 160% at 50% 0%, rgba(99,102,241,0.04), transparent), radial-gradient(35% 160% at 92% 0%, rgba(59,130,246,0.05), transparent), linear-gradient(to bottom, theme(colors.white), theme(colors.zinc.50))",+ },+ textShadow: {+ "message-table-violet":+ "0 0 6px rgba(139,92,246,0.45), 0 0 18px rgba(139,92,246,0.55)",+ "message-table-indigo":+ "0 0 6px rgba(99,102,241,0.45), 0 0 18px rgba(99,102,241,0.55)",+ "message-table-blue":+ "0 0 6px rgba(59,130,246,0.45), 0 0 18px rgba(59,130,246,0.55)",},keyframes: {"accordion-down": {@@ -327,6 +349,7 @@ const config = {scrollbar({ nocompatible: true }),smoothShadowRing,grainTexture,+ textShadow,],} satisfies Config;