feat: maximize chat window size

Major layout optimizations to increase chat area:

1. MainLayout improvements:
   - Remove Content padding/margin (was 24px + 24px = 48px wasted)
   - Reduce Sider width from 280px to 240px
   - Set Content overflow:hidden and flex layout

2. AgentChatPage improvements:
   - Replace large Card header with compact toolbar (saved ~40px)
   - Remove Card wrapper (saved border/padding)
   - Direct div layout for chat area

3. Other pages:
   - Added padding:24px to HomePage/KnowledgePage/HistoryPage
   - Maintain consistent spacing for non-chat pages

Result: Chat window now occupies ~85% of screen height instead of ~33%

Verified working: AI responses, scrolling, and UI display
This commit is contained in:
AI Clinical Dev Team
2025-10-10 22:01:09 +08:00
parent fdebb44859
commit 2d51933aee
6 changed files with 103 additions and 72 deletions

View File

@@ -190,66 +190,73 @@ const AgentChatPage = () => {
return (
<div style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
{/* 标题栏 */}
<Card style={{ marginBottom: 16 }}>
<Space align="center" style={{ width: '100%', justifyContent: 'space-between' }}>
<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 }}>
{agent.description}
</Paragraph>
<Paragraph type="secondary" style={{ marginBottom: 0, fontSize: 12 }}>
{agent.category} | {currentProject?.name}
</Paragraph>
{/* 顶部工具栏 - 紧凑设计 */}
<div style={{
padding: '12px 24px',
background: '#fff',
borderBottom: '1px solid #e8e8e8',
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
flexShrink: 0,
}}>
<Space align="center" size="middle">
<span style={{ fontSize: 24 }}>{agent.icon}</span>
<div>
<div style={{ fontSize: 16, fontWeight: 600, lineHeight: '24px' }}>
{agent.name}
</div>
</Space>
{/* 模型选择器 */}
<ModelSelector
value={selectedModel}
onChange={setSelectedModel}
disabled={sending}
/>
<div style={{ fontSize: 12, color: '#8c8c8c', lineHeight: '20px' }}>
{agent.category} · {currentProject?.name}
</div>
</div>
</Space>
</Card>
{/* 聊天区域 */}
<Card
{/* 模型选择器 */}
<ModelSelector
value={selectedModel}
onChange={setSelectedModel}
disabled={sending}
/>
</div>
{/* 聊天区域 - 去掉Card直接使用div */}
<div
style={{
flex: 1,
display: 'flex',
flexDirection: 'column',
overflow: 'hidden',
}}
bodyStyle={{
flex: 1,
display: 'flex',
flexDirection: 'column',
padding: 0,
minHeight: 0,
background: '#fff',
}}
>
{/* 消息列表 */}
{messages.length === 0 && !sending ? (
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#fafafa' }}>
<div style={{ textAlign: 'center', color: '#999' }}>
<RobotOutlined style={{ fontSize: 64, marginBottom: 16 }} />
<div style={{ fontSize: 16 }}></div>
<div style={{ fontSize: 14, marginTop: 8 }}>
使@知识库功能引用文献
{/* 消息列表区域 */}
<div style={{
flex: 1,
display: 'flex',
flexDirection: 'column',
minHeight: 0, // 重要:确保可以滚动
overflow: 'hidden',
}}>
{messages.length === 0 && !sending ? (
<div style={{ flex: 1, display: 'flex', alignItems: 'center', justifyContent: 'center', background: '#fafafa' }}>
<div style={{ textAlign: 'center', color: '#999' }}>
<RobotOutlined style={{ fontSize: 64, marginBottom: 16 }} />
<div style={{ fontSize: 16 }}></div>
<div style={{ fontSize: 14, marginTop: 8 }}>
使@知识库功能引用文献
</div>
</div>
</div>
</div>
) : (
<MessageList
messages={messages}
loading={sending}
streamingContent={streamingContent}
/>
)}
) : (
<MessageList
messages={messages}
loading={sending}
streamingContent={streamingContent}
/>
)}
</div>
{/* 消息输入 */}
<MessageInput
@@ -258,7 +265,7 @@ const AgentChatPage = () => {
knowledgeBases={knowledgeBases}
placeholder={`${agent.name}提问...Shift+Enter换行Enter发送`}
/>
</Card>
</div>
</div>
)
}

View File

@@ -3,7 +3,7 @@ import { HistoryOutlined, SyncOutlined } from '@ant-design/icons'
const HistoryPage = () => {
return (
<div>
<div style={{ padding: '24px' }}>
<Alert
message="功能开发中"
description="历史记录功能正在开发中,您将能够查看和管理所有对话历史..."

View File

@@ -31,7 +31,7 @@ const HomePage = () => {
}
return (
<div>
<div style={{ padding: '24px' }}>
{/* 欢迎区域 */}
<Card style={{ marginBottom: 24, background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }}>
<div style={{ color: 'white', padding: '20px 0' }}>

View File

@@ -153,7 +153,7 @@ const KnowledgePage = () => {
]
return (
<div>
<div style={{ padding: '24px' }}>
{/* 提示信息 */}
<Alert
message="知识库功能说明"