From 730d50bc63257b931c1fbd91d1998eddee252607 Mon Sep 17 00:00:00 2001 From: iven Date: Sat, 11 Apr 2026 12:58:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E7=AE=A1=E5=AE=B6=20Tab=20?= =?UTF-8?q?=E7=A9=BA=E7=8A=B6=E6=80=81=E5=A2=9E=E5=8A=A0=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E6=96=87=E6=A1=88=20+=20=E7=AB=8B=E5=8D=B3=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 无数据时显示友好引导文案 - 分析按钮要求至少 2 条对话 - 分析中显示加载状态 --- desktop/src/components/ButlerPanel/index.tsx | 75 ++++++++++++++++---- 1 file changed, 60 insertions(+), 15 deletions(-) diff --git a/desktop/src/components/ButlerPanel/index.tsx b/desktop/src/components/ButlerPanel/index.tsx index 0052b0d..7a12932 100644 --- a/desktop/src/components/ButlerPanel/index.tsx +++ b/desktop/src/components/ButlerPanel/index.tsx @@ -1,4 +1,6 @@ +import { useState } from 'react'; import { useButlerInsights } from '../../hooks/useButlerInsights'; +import { useChatStore } from '../../store/chatStore'; import { InsightsSection } from './InsightsSection'; import { ProposalsSection } from './ProposalsSection'; import { MemorySection } from './MemorySection'; @@ -9,6 +11,21 @@ interface ButlerPanelProps { export function ButlerPanel({ agentId }: ButlerPanelProps) { const { painPoints, proposals, loading, error, refresh } = useButlerInsights(agentId); + const messageCount = useChatStore((s) => s.messages.length); + const [analyzing, setAnalyzing] = useState(false); + + const hasData = (painPoints?.length ?? 0) > 0 || (proposals?.length ?? 0) > 0; + const canAnalyze = messageCount >= 2; + + const handleAnalyze = async () => { + if (!canAnalyze || analyzing) return; + setAnalyzing(true); + try { + await refresh(); + } finally { + setAnalyzing(false); + } + }; if (!agentId) { return ( @@ -32,23 +49,51 @@ export function ButlerPanel({ agentId }: ButlerPanelProps) { )} - {/* Insights section */} -
-

- 我最近在关注 -

- -
+ {!loading && !hasData && ( +
+
+ + + +
+

+ 管家正在了解您,多轮对话后会自动发现您的需求 +

+ +
+ )} - {/* Proposals section */} -
-

- 我提出的方案 -

- -
+ {(hasData || loading) && ( + <> + {/* Insights section */} +
+

+ 我最近在关注 +

+ +
- {/* Memory section */} + {/* Proposals section */} +
+

+ 我提出的方案 +

+ +
+ + )} + + {/* Memory section (always show) */}

我记得关于您