From 7704a799f847f08444d1fac2dea9a48b36c6b447 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 24 Jan 2026 22:29:31 +0800 Subject: [PATCH] fix: update canvas chat panel header to match official design --- app/canvas/[id]/page.tsx | 31 ++-------------- components/canvas/CanvasChatPanel.tsx | 52 +++++++++++++++++---------- 2 files changed, 36 insertions(+), 47 deletions(-) diff --git a/app/canvas/[id]/page.tsx b/app/canvas/[id]/page.tsx index 69d75c2..eecb9c2 100644 --- a/app/canvas/[id]/page.tsx +++ b/app/canvas/[id]/page.tsx @@ -463,34 +463,9 @@ export default function CanvasEditorPage({ params }: PageProps) { isPanelOpen ? "translate-x-0 opacity-100" : "translate-x-[120%] opacity-0" )}>
- {/* 移除 Tabs 组件,直接显示 AI 对话面板 */} -
-
-
- - AI 对话 -
- - {/* Integrated Close Button */} - - - - - 隐藏面板 - -
- - {/* AI 对话内容 */} -
- -
+ {/* AI 对话内容 */} +
+ setIsPanelOpen(false)} />
diff --git a/components/canvas/CanvasChatPanel.tsx b/components/canvas/CanvasChatPanel.tsx index ac45103..0601e1d 100644 --- a/components/canvas/CanvasChatPanel.tsx +++ b/components/canvas/CanvasChatPanel.tsx @@ -26,6 +26,7 @@ import { ImageParamsBar, type ImageGenerationParams } from "@/components/image-p interface CanvasChatPanelProps { chatId: string; initialMessages?: ChatMessage[]; + onClose?: () => void; } // 建议卡片数据 - 已移除 @@ -54,7 +55,7 @@ function extractImageUrls(text: string): string[] { return urls; } -export function CanvasChatPanel({ chatId, initialMessages = [] }: CanvasChatPanelProps) { +export function CanvasChatPanel({ chatId, initialMessages = [], onClose }: CanvasChatPanelProps) { const [input, setInput] = useState(""); const [attachments, setAttachments] = useState([]); const [selectedModelId, setSelectedModelId] = useState(""); @@ -312,28 +313,41 @@ export function CanvasChatPanel({ chatId, initialMessages = [] }: CanvasChatPane const isLoading = status === 'streaming' || status === 'submitted'; return ( -
+
{/* Header - Minimal with Icons */} -
- - - - - +
+
+ + + + + +
+ + {onClose && ( + + )}
{/* 消息列表 */} - +
{messages.length === 0 && (