2026-05-14 15:07:34 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
import type { ComplianceChunk } from '../../types';
|
|
|
|
|
|
|
|
|
|
interface ChatPanelProps {
|
|
|
|
|
activeChunkId: number;
|
|
|
|
|
chunks: ComplianceChunk[];
|
|
|
|
|
messages: Array<{ id: number; role: 'user' | 'assistant'; content: string }>;
|
|
|
|
|
chatInput: string;
|
|
|
|
|
setChatInput: (value: string) => void;
|
|
|
|
|
chatLoading: boolean;
|
|
|
|
|
sendChatMessage: () => void;
|
|
|
|
|
closeChat: () => void;
|
|
|
|
|
quickQuestions?: string[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const ChatPanel: React.FC<ChatPanelProps> = ({
|
|
|
|
|
activeChunkId,
|
|
|
|
|
chunks,
|
|
|
|
|
messages,
|
|
|
|
|
chatInput,
|
|
|
|
|
setChatInput,
|
|
|
|
|
chatLoading,
|
|
|
|
|
sendChatMessage,
|
|
|
|
|
closeChat,
|
|
|
|
|
quickQuestions = [
|
|
|
|
|
'这个设计是否合规?',
|
|
|
|
|
'需要修改哪些内容?',
|
|
|
|
|
'法规的具体要求是什么?',
|
|
|
|
|
],
|
|
|
|
|
}) => {
|
|
|
|
|
const activeChunk = chunks.find(c => c.id === activeChunkId);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
right: 0,
|
|
|
|
|
top: 0,
|
|
|
|
|
bottom: 0,
|
|
|
|
|
width: 420,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'var(--surface)',
|
|
|
|
|
borderLeft: '1px solid var(--border)',
|
2026-05-14 15:07:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
zIndex: 50,
|
|
|
|
|
animation: 'slideIn 0.3s ease-out forwards',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{/* Chat Header */}
|
|
|
|
|
<div style={{
|
|
|
|
|
padding: '20px 24px',
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
borderBottom: '1px solid var(--border)',
|
2026-05-14 15:07:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
}}>
|
|
|
|
|
<div>
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
<div style={{ fontSize: 14, fontWeight: 600, color: 'var(--fg)' }}>合规对话</div>
|
|
|
|
|
<div className="mono" style={{ fontSize: 11, color: 'var(--muted)' }}>
|
2026-05-14 15:07:34 +08:00
|
|
|
段落 #{activeChunk?.index} · {activeChunk?.regulations.length} 条法规
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<button
|
|
|
|
|
onClick={closeChat}
|
|
|
|
|
style={{
|
|
|
|
|
width: 32,
|
|
|
|
|
height: 32,
|
|
|
|
|
borderRadius: 8,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'var(--rail-hover)',
|
2026-05-14 15:07:34 +08:00
|
|
|
border: 'none',
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
<path d="M18 6L6 18M6 6L18 18" stroke="var(--muted)" strokeWidth="2" strokeLinecap="round"/>
|
2026-05-14 15:07:34 +08:00
|
|
|
</svg>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Current Chunk Info */}
|
|
|
|
|
<div style={{
|
|
|
|
|
padding: '16px 24px',
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'var(--rail-hover)',
|
|
|
|
|
borderBottom: '1px solid var(--border)',
|
2026-05-14 15:07:34 +08:00
|
|
|
}}>
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
<div style={{ fontSize: 13, fontWeight: 500, marginBottom: 8, color: 'var(--fg)' }}>
|
2026-05-14 15:07:34 +08:00
|
|
|
{activeChunk?.intent}
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{
|
|
|
|
|
fontSize: 12,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
color: 'var(--muted)',
|
2026-05-14 15:07:34 +08:00
|
|
|
lineHeight: 1.5,
|
|
|
|
|
maxHeight: 60,
|
|
|
|
|
overflow: 'hidden',
|
|
|
|
|
}}>
|
|
|
|
|
{activeChunk?.content.substring(0, 100)}...
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Chat Messages */}
|
|
|
|
|
<div style={{
|
|
|
|
|
flex: 1,
|
|
|
|
|
overflowY: 'auto',
|
|
|
|
|
padding: '20px 24px',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
gap: 16,
|
|
|
|
|
}}>
|
|
|
|
|
{messages.map(msg => (
|
|
|
|
|
<div key={msg.id} style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
gap: 12,
|
|
|
|
|
flexDirection: msg.role === 'user' ? 'row-reverse' : 'row',
|
|
|
|
|
}}>
|
|
|
|
|
{msg.role === 'assistant' && (
|
|
|
|
|
<div style={{
|
|
|
|
|
width: 32,
|
|
|
|
|
height: 32,
|
|
|
|
|
borderRadius: 8,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'linear-gradient(90deg, var(--accent), var(--accent-hover))',
|
2026-05-14 15:07:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
flexShrink: 0,
|
|
|
|
|
}}>
|
|
|
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
|
|
|
|
<circle cx="12" cy="12" r="6" fill="#fff"/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<div style={{
|
|
|
|
|
maxWidth: '80%',
|
|
|
|
|
padding: '12px 16px',
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: msg.role === 'user'
|
|
|
|
|
? 'linear-gradient(90deg, var(--accent), var(--accent-hover))'
|
|
|
|
|
: 'var(--surface)',
|
2026-05-14 15:07:34 +08:00
|
|
|
borderRadius: 12,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
color: msg.role === 'user' ? '#fff' : 'var(--fg)',
|
2026-05-14 15:07:34 +08:00
|
|
|
fontSize: 14,
|
|
|
|
|
lineHeight: 1.6,
|
|
|
|
|
whiteSpace: 'pre-wrap',
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
border: msg.role === 'assistant' ? '1px solid var(--border)' : 'none',
|
2026-05-14 15:07:34 +08:00
|
|
|
}}>
|
|
|
|
|
{msg.content}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
{chatLoading && (
|
|
|
|
|
<div style={{ display: 'flex', gap: 12 }}>
|
|
|
|
|
<div style={{
|
|
|
|
|
width: 32,
|
|
|
|
|
height: 32,
|
|
|
|
|
borderRadius: 8,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'linear-gradient(90deg, var(--accent), var(--accent-hover))',
|
2026-05-14 15:07:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
}}>
|
|
|
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none">
|
|
|
|
|
<circle cx="12" cy="12" r="6" fill="#fff"/>
|
|
|
|
|
</svg>
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{
|
|
|
|
|
padding: '12px 16px',
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'var(--surface)',
|
2026-05-14 15:07:34 +08:00
|
|
|
borderRadius: 12,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
border: '1px solid var(--border)',
|
2026-05-14 15:07:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
gap: 8,
|
|
|
|
|
}}>
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
<div style={{ width: 6, height: 6, borderRadius: '50%', background: 'var(--accent)', animation: 'pulse 1s infinite' }} />
|
|
|
|
|
<span style={{ fontSize: 13, color: 'var(--muted)' }}>分析中...</span>
|
2026-05-14 15:07:34 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Quick Questions */}
|
|
|
|
|
<div style={{
|
|
|
|
|
padding: '12px 24px',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
gap: 8,
|
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
|
}}>
|
|
|
|
|
{quickQuestions.map(q => (
|
|
|
|
|
<button
|
|
|
|
|
key={q}
|
|
|
|
|
onClick={() => { setChatInput(q); }}
|
|
|
|
|
style={{
|
|
|
|
|
padding: '6px 12px',
|
|
|
|
|
fontSize: 12,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'var(--rail-hover)',
|
|
|
|
|
border: '1px solid var(--border)',
|
2026-05-14 15:07:34 +08:00
|
|
|
borderRadius: 6,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
color: 'var(--muted)',
|
2026-05-14 15:07:34 +08:00
|
|
|
cursor: 'pointer',
|
|
|
|
|
}}
|
|
|
|
|
>{q}</button>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Chat Input */}
|
|
|
|
|
<div style={{
|
|
|
|
|
padding: '16px 24px',
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
borderTop: '1px solid var(--border)',
|
2026-05-14 15:07:34 +08:00
|
|
|
display: 'flex',
|
|
|
|
|
gap: 12,
|
|
|
|
|
}}>
|
|
|
|
|
<input
|
|
|
|
|
value={chatInput}
|
|
|
|
|
onChange={e => setChatInput(e.target.value)}
|
|
|
|
|
onKeyDown={e => e.key === 'Enter' && sendChatMessage()}
|
|
|
|
|
placeholder="输入问题..."
|
|
|
|
|
style={{
|
|
|
|
|
flex: 1,
|
|
|
|
|
padding: 12,
|
|
|
|
|
fontSize: 14,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: 'var(--rail-hover)',
|
|
|
|
|
border: '1px solid var(--border)',
|
2026-05-14 15:07:34 +08:00
|
|
|
borderRadius: 8,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
color: 'var(--fg)',
|
2026-05-14 15:07:34 +08:00
|
|
|
outline: 'none',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<button
|
|
|
|
|
onClick={sendChatMessage}
|
|
|
|
|
disabled={chatLoading || !chatInput.trim()}
|
|
|
|
|
style={{
|
|
|
|
|
padding: '12px 20px',
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: 600,
|
feat: complete frontend redesign — all 6 pages implemented per prototype specs
Fix UI components (Badge, Button, Card, Input, ProgressBar, ScoreBar,
ChatPanel) to use CSS variables instead of old theme object pattern.
Clean up barrel exports (common/index.ts, layout/index.ts) and remove
stale router/tabs import from shell-config.ts. Build: tsc zero errors,
Vite production build succeeds (1760 modules, 270 kB JS, 22 kB CSS).
2026-06-03 18:42:42 +08:00
|
|
|
background: chatLoading || !chatInput.trim()
|
|
|
|
|
? 'var(--rail-hover)'
|
|
|
|
|
: 'linear-gradient(90deg, var(--accent), var(--accent-hover))',
|
|
|
|
|
color: chatLoading || !chatInput.trim() ? 'var(--muted)' : '#fff',
|
2026-05-14 15:07:34 +08:00
|
|
|
border: 'none',
|
|
|
|
|
borderRadius: 8,
|
|
|
|
|
cursor: chatLoading || !chatInput.trim() ? 'not-allowed' : 'pointer',
|
|
|
|
|
}}
|
|
|
|
|
>发送</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2026-05-18 16:32:42 +08:00
|
|
|
};
|