diff --git a/app/canvas/[id]/page.tsx b/app/canvas/[id]/page.tsx index 4837d75..0bc191c 100644 --- a/app/canvas/[id]/page.tsx +++ b/app/canvas/[id]/page.tsx @@ -22,8 +22,8 @@ import { Maximize2, Move3D, Layers, - PanelLeftClose, - PanelLeft, + PanelRightClose, + PanelRight, Download, Upload, Wand2, @@ -369,7 +369,7 @@ export default function CanvasEditorPage({ params }: PageProps) { {/* 2. Floating Header (Top Left) */} -
+
{/* 3. Floating Actions (Top Right) */} -
+
{isGenerating && (
@@ -444,7 +444,7 @@ export default function CanvasEditorPage({ params }: PageProps) { onClick={() => setIsPanelOpen(!isPanelOpen)} className={cn("rounded-lg h-8 w-8", isPanelOpen && "bg-muted")} > - {isPanelOpen ? : } + {isPanelOpen ? : } {isPanelOpen ? "隐藏面板" : "显示面板"} @@ -452,10 +452,10 @@ export default function CanvasEditorPage({ params }: PageProps) {
- {/* 4. Floating Sidebar (Left) */} + {/* 4. Floating Sidebar (Right) */}
diff --git a/components/canvas/CanvasChatPanel.tsx b/components/canvas/CanvasChatPanel.tsx index f06e5a0..7fdced7 100644 --- a/components/canvas/CanvasChatPanel.tsx +++ b/components/canvas/CanvasChatPanel.tsx @@ -4,10 +4,11 @@ import { useChat } from "@ai-sdk/react"; import { DefaultChatTransport } from "ai"; import { useEffect, useRef, useState, useCallback } from "react"; import useSWR from "swr"; -import { Send, Loader2, ImagePlus, Paperclip, X, Sparkles } from "lucide-react"; +import { Send, Loader2, ImagePlus, Paperclip, X, Sparkles, User, Bot, Plus, History, Share2, LayoutGrid, Maximize2, RefreshCw, Zap, Globe, Box, ArrowUp } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Textarea } from "@/components/ui/textarea"; import { ScrollArea } from "@/components/ui/scroll-area"; +import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Select, SelectContent, @@ -26,6 +27,25 @@ interface CanvasChatPanelProps { initialMessages?: ChatMessage[]; } +// 建议卡片数据 +const SUGGESTIONS = [ + { + title: "Wine List", + desc: "Mimic this effect to genera...", + image: "https://images.unsplash.com/photo-1510812431401-41d2bd2722f3?w=300&h=200&fit=crop" + }, + { + title: "Coffee Shop Branding", + desc: "you are a brand design...", + image: "https://images.unsplash.com/photo-1509042239860-f550ce710b93?w=300&h=200&fit=crop" + }, + { + title: "Story Board", + desc: "I NEED A STORY BOARD...", + image: "https://images.unsplash.com/photo-1626785774573-4b799314346d?w=300&h=200&fit=crop" + } +]; + // 从消息中提取图片 URL function extractImageUrls(text: string): string[] { const urls: string[] = []; @@ -270,34 +290,75 @@ export function CanvasChatPanel({ chatId, initialMessages = [] }: CanvasChatPane const isLoading = status === 'streaming' || status === 'submitted'; return ( -
- {/* 模型选择 */} -
- +
+ {/* Header - Minimal with Icons */} +
+ + + + +
{/* 消息列表 */} - -
+ +
{messages.length === 0 && ( -
- -

开始对话生成图片

-

生成的图片将自动添加到画布

+
+ {/* Greeting */} +
+
+ -L° +
+

Hi, 我是你的AI设计师

+

让我们开始今天的创作吧!

+
+ + {/* Suggestions */} +
+ {SUGGESTIONS.map((item, i) => ( +
setInput(prev => prev || item.desc)} + > +
+

{item.title}

+

{item.desc}

+
+
+ {item.title} +
+
+ ))} +
+ + {/* Refresh */} +
+ + 切换 +
+ + {/* Banner */} +
+
+
+ +
+ 升级会员, Nano Banana Pro 免费365天! +
+ +
)} @@ -305,67 +366,105 @@ export function CanvasChatPanel({ chatId, initialMessages = [] }: CanvasChatPane
- {/* 附件预览 */} - {message.attachments && message.attachments.length > 0 && ( -
- {message.attachments.map((att: any, i: number) => ( - - ))} -
- )} - - {/* 消息内容 */} -
- {message.parts?.map((part: any, i: number) => { - if (part.type === 'text') { - // 提取并显示图片 - const imageUrls = extractImageUrls(part.text || ''); - const textWithoutImages = (part.text || '') - .replace(/!\[(?:thumb)?\|\|\|[^|]+\|\|\|[^\]]*\]\([^)]+\)/g, '') - .trim(); - - return ( -
- {textWithoutImages && {textWithoutImages}} - {imageUrls.length > 0 && ( -
- {imageUrls.map((url, idx) => ( - window.open(url, '_blank')} - /> - ))} + {/* 头像 */} + + {message.role === 'user' ? ( + <> + + + + + + ) : ( + <> + + + + + + )} + + + {/* 消息气泡 */} +
+
+ {/* 附件预览 */} + {message.attachments && message.attachments.length > 0 && ( +
+ {message.attachments.map((att: any, i: number) => ( + + ))} +
+ )} + + {/* 消息内容 */} +
+ {message.parts?.map((part: any, i: number) => { + if (part.type === 'text') { + // 提取并显示图片 + const imageUrls = extractImageUrls(part.text || ''); + const textWithoutImages = (part.text || '') + .replace(/!\[(?:thumb)?\|\|\|[^|]+\|\|\|[^\]]*\]\([^)]+\)/g, '') + .trim(); + + return ( +
+ {textWithoutImages && {textWithoutImages}} + {imageUrls.length > 0 && ( +
+ {imageUrls.map((url, idx) => ( +
+ window.open(url, '_blank')} + /> +
+ ))} +
+ )}
- )} -
- ); - } - return null; - })} + ); + } + return null; + })} +
+
))} {isLoading && ( -
-
- - 生成中... +
+ + + + + +
+ + 正在思考中...
)} @@ -374,75 +473,120 @@ export function CanvasChatPanel({ chatId, initialMessages = [] }: CanvasChatPane
- {/* 附件预览 */} - {attachments.length > 0 && ( -
- {attachments.map((att, index) => ( -
- - -
- ))} -
- )} - - {/* 输入区域 */} -
-
-
-