fix(butler): useButlerInsights 使用 resolvedAgentId 查询痛点/方案
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

审计发现 useButlerInsights 仍使用原始 agentId("1")查询痛点,
而痛点按 kernel UUID 存储导致空结果。改用 effectiveAgentId
(resolvedAgentId ?? agentId)确保查询路径一致。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-16 17:29:16 +08:00
parent 1e65b56a0f
commit 7db9eb29a0

View File

@@ -13,12 +13,15 @@ interface ButlerPanelProps {
}
export function ButlerPanel({ agentId }: ButlerPanelProps) {
const { painPoints, proposals, loading, error, refresh } = useButlerInsights(agentId);
const [resolvedAgentId, setResolvedAgentId] = useState<string | null>(null);
// Use resolved kernel UUID for queries — raw agentId may be "1" from SaaS relay
// while pain points/proposals are stored under kernel UUID
const effectiveAgentId = resolvedAgentId ?? agentId;
const { painPoints, proposals, loading, error, refresh } = useButlerInsights(effectiveAgentId);
const messageCount = useChatStore((s) => s.messages.length);
const { accountIndustries, configs, lastSynced, isLoading: industryLoading, fetchIndustries } = useIndustryStore();
const [analyzing, setAnalyzing] = useState(false);
const [memoryRefreshKey, setMemoryRefreshKey] = useState(0);
const [resolvedAgentId, setResolvedAgentId] = useState<string | null>(null);
// Resolve SaaS relay agentId ("1") to kernel UUID for VikingStorage queries
useEffect(() => {