feat(history): complete messaging core before multi-account gateways

This commit is contained in:
wmq
2026-07-28 22:36:58 +08:00
parent cd06d049fe
commit 7f09132fad
54 changed files with 4781 additions and 601 deletions
+18 -29
View File
@@ -1,8 +1,6 @@
import { Brain, Building2, ChevronRight } from 'lucide-react'
import { Brain, ChevronRight } from 'lucide-react'
import type { Conversation, Customer, CustomerStage } from '@/types'
import { Avatar } from '@/components/ui/avatar'
import { Button } from '@/components/ui/button'
import { CountryFlag } from '@/components/common/CountryFlag'
import {
CustomerStageBadge,
IntentScoreBadge,
@@ -28,30 +26,21 @@ export function ConversationInsightBar({
const summary = customer.aiProfile?.summary || conversation.summary || 'AI 正在根据会话完善客户画像'
return (
<div data-testid="conversation-insight-bar" className="border-b border-border bg-gradient-to-r from-primary-50/80 via-card to-card px-3 py-2">
<div className="flex min-w-0 items-center gap-2.5">
<Avatar name={customer.name} src={customer.avatarUrl} size="sm" />
<div className="min-w-0">
<div className="flex items-center gap-1.5">
<span className="max-w-40 truncate text-sm font-semibold">{customer.name}</span>
{customer.telegramUsername && (
<span className="max-w-32 truncate text-[11px] text-muted-foreground">
@{customer.telegramUsername}
</span>
)}
<CountryFlag code={customer.country} withName={false} />
{customer.company && (
<span className="hidden items-center gap-1 truncate text-xs text-muted-foreground md:flex">
<Building2 className="h-3 w-3" /> {customer.company}
</span>
)}
</div>
<p className="mt-0.5 max-w-[60vw] truncate text-[11px] text-muted-foreground">
<Brain className="mr-1 inline h-3 w-3 text-primary" />
{summary}
</p>
<div
data-testid="conversation-insight-bar"
className="shrink-0 border-b border-slate-100 bg-white px-3 py-2 shadow-[0_1px_0_rgba(15,23,42,.02)] sm:px-4"
>
<div className="flex min-w-0 items-center gap-2">
<span className="flex h-8 w-8 shrink-0 items-center justify-center rounded-xl border border-violet-100 bg-violet-50 text-violet-600">
<Brain className="h-4 w-4" />
</span>
<div className="flex min-w-0 flex-1 items-center gap-2">
<span className="hidden shrink-0 text-[10px] font-semibold uppercase tracking-[0.12em] text-violet-600 sm:inline">
AI 客户洞察
</span>
<p className="truncate text-xs leading-5 text-slate-600">{summary}</p>
</div>
<div className="ms-auto hidden items-center gap-2 sm:flex">
<div className="hidden shrink-0 items-center gap-2 md:flex">
<span className="flex items-center gap-1 text-xs text-muted-foreground">
意向 <IntentScoreBadge score={Number(customer.intentScore || 0)} />
</span>
@@ -59,13 +48,13 @@ export function ConversationInsightBar({
<CustomerStageBadge stage={stage as CustomerStage} />
<RiskLevelBadge level={customer.riskLevel || 'none'} />
</div>
<Button variant="ghost" size="sm" onClick={onOpenProfile}>
<Button variant="ghost" size="sm" onClick={onOpenProfile} title="打开客户画像">
<span className="hidden lg:inline">客户画像</span>
<ChevronRight className="h-4 w-4" />
</Button>
</div>
<div className="mt-1.5 flex items-center gap-3 overflow-x-auto sm:hidden">
<span className="flex shrink-0 items-center gap-1 text-xs">意向 <IntentScoreBadge score={Number(customer.intentScore || 0)} /></span>
<div className="mt-1.5 flex items-center gap-2 overflow-x-auto pb-0.5 md:hidden">
<span className="flex shrink-0 items-center gap-1 text-[11px]">意向 <IntentScoreBadge score={Number(customer.intentScore || 0)} /></span>
<SentimentBadge sentiment={customer.sentiment || 'neutral'} />
<CustomerStageBadge stage={stage as CustomerStage} />
<RiskLevelBadge level={customer.riskLevel || 'none'} />