diff --git a/packages/extension/src/content/widget/panel.tsx b/packages/extension/src/content/widget/panel.tsx index c48cc04..e312ea3 100644 --- a/packages/extension/src/content/widget/panel.tsx +++ b/packages/extension/src/content/widget/panel.tsx @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from "react"; -import { X, Minus, ExternalLink } from "lucide-react"; +import { X, Minus, ExternalLink, MessageSquarePlus } from "lucide-react"; import { ChatView } from "@/sidepanel/components/chat-view"; import { EmptySuggestions } from "@/sidepanel/chat/empty-suggestions"; import { InputBox } from "@/sidepanel/input/input-box"; @@ -69,6 +69,20 @@ export function Panel({ onClose, onMinimize }: Props) { await rpc.widgetOpenSidepanel({ tabId }).catch(() => {}); } + async function handleNewChat() { + if (!tabId) return; + const hasContent = + session.messages.length > 0 || session.streamingAssistantText.length > 0; + if (hasContent && !window.confirm("新建对话会归档当前会话,确定?")) return; + try { + const { newChatForTab } = await import("@/sidepanel/chat/new-chat"); + await newChatForTab(tabId); + setInput(""); + } catch (e) { + console.warn("[atwebpilot-widget] newChat failed:", e); + } + } + const handleApprove = useCallback( ( id: string, @@ -103,6 +117,13 @@ export function Panel({ onClose, onMinimize }: Props) { {/* Header */}
⚡ AtWebPilot +