Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: ai panel theme (#20944)

ecmadao5bba6979667c
diff --git a/frontend/src/modules/ai/components/ChatPanel.tsx b/frontend/src/modules/ai/components/ChatPanel.tsx
index 9d43845d5a..c77b9cd01b 100644
--- a/frontend/src/modules/ai/components/ChatPanel.tsx
+++ b/frontend/src/modules/ai/components/ChatPanel.tsx
@@ -210,7 +210,7 @@ export function ChatPanel() {
if (!aiSetting.enabled) return null;
return (
- <div className="w-full h-full flex-1 flex flex-col overflow-hidden">
+ <div className="w-full h-full flex-1 flex flex-col overflow-hidden text-control">
<ActionBar />
{ready ? (
diff --git a/frontend/src/modules/ai/components/ChatView/AIMessageView.tsx b/frontend/src/modules/ai/components/ChatView/AIMessageView.tsx
index b71eddfdc5..f8fb5cfb09 100644
--- a/frontend/src/modules/ai/components/ChatView/AIMessageView.tsx
+++ b/frontend/src/modules/ai/components/ChatView/AIMessageView.tsx
@@ -26,9 +26,9 @@ export function AIMessageView({ message }: Props) {
return (
<div
className={cn(
- "border rounded-sm shadow-sm py-1 px-1 bg-gray-50 border-gray-400",
+ "border rounded-sm shadow-sm py-1 px-1 bg-control-bg/80 border-control-border text-control",
isDone && "w-full min-w-36",
- isFailed && "max-w-[40%] min-w-36",
+ isFailed && "max-w-[80%] min-w-36 bg-warning/10 border-warning/60",
!isDone && !isFailed && "w-auto"
)}
>
@@ -36,14 +36,16 @@ export function AIMessageView({ message }: Props) {
<Markdown content={message.content} codeBlockProps={{ width: 1.0 }} />
)}
{isLoading && (
- <div className="flex items-center">
+ <div className="flex items-center text-control-light">
<Loader2 className="mx-1 size-[18px] animate-spin" />
</div>
)}
{isFailed && (
- <div className="text-warning flex items-center gap-x-1">
- <TriangleAlertIcon className="inline-block size-4 shrink-0" />
- <span className="text-sm">{message.error}</span>
+ <div className="flex items-start gap-x-1.5">
+ <TriangleAlertIcon className="mt-0.5 inline-block size-4 shrink-0 text-warning" />
+ <span className="break-words text-sm text-control">
+ {message.error}
+ </span>
</div>
)}
</div>
diff --git a/frontend/src/modules/ai/components/ChatView/Markdown/CodeBlock.tsx b/frontend/src/modules/ai/components/ChatView/Markdown/CodeBlock.tsx
index 15d443d393..7d95ab882f 100644
--- a/frontend/src/modules/ai/components/ChatView/Markdown/CodeBlock.tsx
+++ b/frontend/src/modules/ai/components/ChatView/Markdown/CodeBlock.tsx
@@ -1,9 +1,11 @@
import { PlayIcon } from "lucide-react";
-import { useEffect, useRef, useState } from "react";
+import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { MonacoEditor } from "@/components/monaco/MonacoEditor";
import { CopyButton } from "@/components/ui/copy-button";
import { Tooltip } from "@/components/ui/tooltip";
+import { monacoThemeName } from "@/modules/sql-editor/components/theme/derive";
+import { useActiveSQLEditorTheme } from "@/modules/sql-editor/components/theme/useActiveSQLEditorTheme";
import { sqlEditorEvents } from "@/modules/sql-editor/model/events";
import { findAncestor } from "@/utils";
import { useAIContext } from "../../context";
@@ -38,6 +40,11 @@ const PADDING_PX = 8;
export function CodeBlock({ code, width }: Props) {
const { t } = useTranslation();
const { events, setShowHistoryDialog } = useAIContext();
+ const activeTheme = useActiveSQLEditorTheme();
+ const monacoOptions = useMemo(
+ () => ({ theme: monacoThemeName(activeTheme) }),
+ [activeTheme]
+ );
const containerRef = useRef<HTMLDivElement | null>(null);
// The message wrapper element is mounted by `ChatView` with the
@@ -76,7 +83,7 @@ export function CodeBlock({ code, width }: Props) {
return (
<div
ref={containerRef}
- className="flex flex-col overflow-x-hidden border border-gray-500 rounded-sm bg-white"
+ className="flex flex-col overflow-x-hidden border border-control-border rounded-sm bg-background text-control"
style={{ width: `${computedWidth}px` }}
>
<div className="flex items-center justify-between px-1 pt-1">
@@ -117,6 +124,7 @@ export function CodeBlock({ code, width }: Props) {
min={20}
max={120}
options={{
+ ...monacoOptions,
fontSize: 12,
lineHeight: 14,
lineNumbers: "off",
diff --git a/frontend/src/modules/ai/components/ChatView/Markdown/Markdown.tsx b/frontend/src/modules/ai/components/ChatView/Markdown/Markdown.tsx
index 0755dcd52c..a9a77fae8e 100644
--- a/frontend/src/modules/ai/components/ChatView/Markdown/Markdown.tsx
+++ b/frontend/src/modules/ai/components/ChatView/Markdown/Markdown.tsx
@@ -35,7 +35,10 @@ export function Markdown({ content, codeBlockProps }: Props) {
inlineCode: (node) =>
createElement(
"code",
- { className: "inline-block bg-gray-200 px-0.5 mx-0.5" },
+ {
+ className:
+ "inline-block rounded-xs bg-control-bg-hover px-0.5 mx-0.5 text-control",
+ },
node.value.replace(/\r?\n|\r/g, " ")
),
image: (node) => createElement("img", { src: node.url }),
diff --git a/frontend/src/modules/ai/components/ChatView/UserMessageView.tsx b/frontend/src/modules/ai/components/ChatView/UserMessageView.tsx
index 8068b24e3b..515181c959 100644
--- a/frontend/src/modules/ai/components/ChatView/UserMessageView.tsx
+++ b/frontend/src/modules/ai/components/ChatView/UserMessageView.tsx
@@ -12,7 +12,7 @@ type Props = {
*/
export function UserMessageView({ message }: Props) {
return (
- <div className="user-message max-w-[60%] min-w-36 border rounded-sm shadow-sm py-1 px-2 bg-indigo-100 border-indigo-400">
+ <div className="user-message max-w-[60%] min-w-36 border rounded-sm shadow-sm py-1 px-2 bg-accent/15 border-accent/50 text-control">
<Markdown content={message.content} codeBlockProps={{ width: 0.6 }} />
</div>
);