feat(frontend): Day 7 - frontend complete layout finished
This commit is contained in:
167
frontend/src/pages/AgentChatPage.tsx
Normal file
167
frontend/src/pages/AgentChatPage.tsx
Normal file
@@ -0,0 +1,167 @@
|
||||
import { useParams } from 'react-router-dom'
|
||||
import { Card, Typography, Input, Button, Space, Select, Upload, Tag, Alert, Divider } from 'antd'
|
||||
import {
|
||||
SendOutlined,
|
||||
PaperClipOutlined,
|
||||
RobotOutlined,
|
||||
FolderOpenOutlined,
|
||||
SyncOutlined,
|
||||
} from '@ant-design/icons'
|
||||
import { AGENTS } from '../layouts/MainLayout'
|
||||
|
||||
const { Title, Paragraph } = Typography
|
||||
const { TextArea } = Input
|
||||
|
||||
const AgentChatPage = () => {
|
||||
const { agentId } = useParams()
|
||||
const agent = AGENTS.find((a) => a.id === agentId)
|
||||
|
||||
if (!agent) {
|
||||
return (
|
||||
<Alert
|
||||
message="智能体不存在"
|
||||
description="请从首页选择一个智能体"
|
||||
type="error"
|
||||
showIcon
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
if (!agent.enabled) {
|
||||
return (
|
||||
<Alert
|
||||
message="该智能体正在开发中"
|
||||
description="敬请期待后续版本..."
|
||||
type="warning"
|
||||
showIcon
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
|
||||
{/* 标题栏 */}
|
||||
<Card style={{ marginBottom: 16 }}>
|
||||
<Space align="center">
|
||||
<span style={{ fontSize: 32 }}>{agent.icon}</span>
|
||||
<div>
|
||||
<Title level={3} style={{ marginBottom: 4 }}>
|
||||
{agent.name}
|
||||
</Title>
|
||||
<Paragraph type="secondary" style={{ marginBottom: 0 }}>
|
||||
当前模型:DeepSeek-V3
|
||||
</Paragraph>
|
||||
</div>
|
||||
</Space>
|
||||
</Card>
|
||||
|
||||
{/* 聊天区域 */}
|
||||
<Card
|
||||
style={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
bodyStyle={{
|
||||
flex: 1,
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
padding: 0,
|
||||
}}
|
||||
>
|
||||
{/* 消息列表区域(占位符) */}
|
||||
<div
|
||||
style={{
|
||||
flex: 1,
|
||||
padding: 24,
|
||||
overflowY: 'auto',
|
||||
background: '#fafafa',
|
||||
}}
|
||||
>
|
||||
<div style={{ textAlign: 'center', padding: '60px 0', color: '#999' }}>
|
||||
<RobotOutlined style={{ fontSize: 64, marginBottom: 16 }} />
|
||||
<div>开始对话,我将为您提供专业的研究建议</div>
|
||||
</div>
|
||||
|
||||
{/* 消息示例(占位符) */}
|
||||
<div style={{ maxWidth: 800, margin: '0 auto' }}>
|
||||
<div style={{ marginBottom: 24 }}>
|
||||
<Tag color="blue" style={{ marginBottom: 8 }}>
|
||||
用户
|
||||
</Tag>
|
||||
<Card size="small">
|
||||
<Paragraph style={{ marginBottom: 0 }}>
|
||||
这是一个示例消息...(开发中)
|
||||
</Paragraph>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div style={{ marginBottom: 24 }}>
|
||||
<Tag color="green" style={{ marginBottom: 8 }}>
|
||||
AI助手
|
||||
</Tag>
|
||||
<Card size="small">
|
||||
<Paragraph style={{ marginBottom: 0 }}>
|
||||
这是AI的回复示例...(开发中)
|
||||
</Paragraph>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Divider style={{ margin: 0 }} />
|
||||
|
||||
{/* 输入区域 */}
|
||||
<div style={{ padding: 16, background: '#fff' }}>
|
||||
{/* 工具栏 */}
|
||||
<Space style={{ marginBottom: 12, width: '100%', justifyContent: 'space-between' }}>
|
||||
<Space>
|
||||
<Upload showUploadList={false}>
|
||||
<Button icon={<PaperClipOutlined />}>上传文件</Button>
|
||||
</Upload>
|
||||
|
||||
<Button icon={<FolderOpenOutlined />}>
|
||||
@ 知识库
|
||||
</Button>
|
||||
|
||||
<Select
|
||||
defaultValue="deepseek-v3"
|
||||
style={{ width: 180 }}
|
||||
options={[
|
||||
{ label: 'DeepSeek-V3', value: 'deepseek-v3' },
|
||||
{ label: 'Qwen3-72B', value: 'qwen3-72b' },
|
||||
{ label: 'Gemini Pro', value: 'gemini-pro' },
|
||||
]}
|
||||
/>
|
||||
</Space>
|
||||
|
||||
<Tag color="orange" icon={<SyncOutlined spin />}>
|
||||
功能开发中...
|
||||
</Tag>
|
||||
</Space>
|
||||
|
||||
{/* 输入框 */}
|
||||
<Space.Compact style={{ width: '100%' }}>
|
||||
<TextArea
|
||||
placeholder="输入您的问题... (功能开发中)"
|
||||
autoSize={{ minRows: 2, maxRows: 6 }}
|
||||
disabled
|
||||
/>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<SendOutlined />}
|
||||
style={{ height: 'auto' }}
|
||||
disabled
|
||||
>
|
||||
发送
|
||||
</Button>
|
||||
</Space.Compact>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AgentChatPage
|
||||
|
||||
Reference in New Issue
Block a user