Skip to content

Commit 15da049

Browse files
committed
fix: improve chat layout responsiveness
1 parent 8c4877b commit 15da049

File tree

2 files changed

+180
-80
lines changed

2 files changed

+180
-80
lines changed

frontend/static/css/chat-layout-fix.css

Lines changed: 99 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,31 @@
44
* 支持响应式调整
55
*/
66

7+
/* 最高优先级:覆盖所有冲突的 tab-content 样式 */
8+
.tab-content#chat-tab,
9+
#chat-tab.tab-content,
10+
.tab-content#chat-tab.active,
11+
div.tab-content#chat-tab {
12+
display: flex !important;
13+
flex-direction: column !important;
14+
height: 100vh !important;
15+
max-height: 100vh !important;
16+
overflow: hidden !important;
17+
padding: 0 !important;
18+
position: relative !important;
19+
}
20+
21+
/* 覆盖通用 tab-content 在 main-content 中的样式 */
22+
.main-content .tab-content#chat-tab,
23+
.main-content #chat-tab.tab-content {
24+
overflow-y: hidden !important;
25+
height: 100vh !important;
26+
}
27+
728
/* 聊天标签页容器 - 使用 flexbox 布局 */
829
#chat-tab {
9-
display: flex !important;
10-
flex-direction: column;
30+
display: grid !important;
31+
grid-template-rows: auto 1fr;
1132
height: 100vh !important;
1233
max-height: 100vh !important;
1334
padding: 0 !important;
@@ -17,13 +38,15 @@
1738

1839
/* 聊天容器 - 占据所有可用空间 */
1940
#chat-tab .chat-container {
41+
grid-row: 2;
2042
flex: 1 1 auto;
2143
display: flex !important;
2244
flex-direction: column !important;
2345
min-height: 0 !important; /* 重要:允许 flex 子元素缩小 */
2446
height: 100% !important;
2547
padding: 15px 20px 10px 20px;
26-
overflow: hidden !important;
48+
overflow: visible !important;
49+
position: relative;
2750
}
2851

2952
/* 消息区域 - 可滚动,会被压缩以容纳输入框 */
@@ -36,6 +59,8 @@
3659
background: white;
3760
border-radius: 16px;
3861
padding: 20px;
62+
padding-bottom: 140px;
63+
scroll-padding-bottom: 140px;
3964
margin-bottom: 12px;
4065
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
4166
}
@@ -49,7 +74,11 @@
4974
padding: 12px 16px;
5075
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
5176
margin-bottom: 10px;
52-
position: relative;
77+
margin-top: auto;
78+
position: sticky;
79+
bottom: 0;
80+
left: 0;
81+
right: 0;
5382
z-index: 10;
5483
}
5584

@@ -125,6 +154,22 @@
125154
padding: 10px 14px;
126155
margin-bottom: 8px;
127156
}
157+
158+
#chat-tab .chat-header {
159+
padding: 10px 16px !important;
160+
gap: 12px;
161+
}
162+
163+
#chat-tab .chat-header .header-controls {
164+
width: 100%;
165+
justify-content: flex-start;
166+
gap: 10px;
167+
}
168+
169+
#chat-tab .chat-header .model-selector {
170+
flex: 1 1 220px;
171+
max-width: none;
172+
}
128173
}
129174

130175
/* 响应式调整 - 小屏幕 */
@@ -165,6 +210,26 @@
165210
width: 36px;
166211
height: 36px;
167212
}
213+
214+
#chat-tab .chat-header {
215+
padding: 8px 12px !important;
216+
gap: 10px;
217+
}
218+
219+
#chat-tab .chat-header h1 {
220+
font-size: 18px !important;
221+
}
222+
223+
#chat-tab .chat-header .header-controls {
224+
flex-direction: column;
225+
align-items: stretch;
226+
gap: 8px;
227+
}
228+
229+
#chat-tab .chat-header .model-selector,
230+
#chat-tab .btn-new-conversation {
231+
width: 100%;
232+
}
168233
}
169234

170235
/* 响应式调整 - 超小屏幕 */
@@ -288,13 +353,39 @@
288353
}
289354

290355
/* 优化顶部标题和按钮区域 */
291-
#chat-tab > div:first-child {
292-
flex-shrink: 0;
293-
padding: 10px 20px !important;
356+
#chat-tab .chat-header {
357+
grid-row: 1;
358+
display: flex;
359+
flex-wrap: wrap;
360+
align-items: center;
361+
justify-content: space-between;
362+
gap: 16px;
363+
padding: 12px 20px !important;
294364
background: var(--color-bg-secondary, #ffffff);
295365
border-bottom: 1px solid var(--color-border-primary, #e0e0e0);
296366
}
297367

368+
#chat-tab .chat-header .header-left {
369+
flex: 1 1 auto;
370+
min-width: 0;
371+
}
372+
373+
#chat-tab .chat-header h1 {
374+
font-size: 22px !important;
375+
margin: 0 !important;
376+
white-space: nowrap;
377+
overflow: hidden;
378+
text-overflow: ellipsis;
379+
}
380+
381+
#chat-tab .chat-header .header-controls {
382+
display: flex;
383+
align-items: center;
384+
gap: 12px;
385+
flex-wrap: wrap;
386+
justify-content: flex-end;
387+
}
388+
298389
#chat-tab .btn-new-conversation {
299390
padding: 8px 16px !important;
300391
font-size: 14px !important;
@@ -308,7 +399,7 @@
308399
}
309400

310401
/* 针对页面顶部的 flex 容器 */
311-
#chat-tab > div:first-child > div {
402+
#chat-tab .chat-header > div {
312403
display: flex;
313404
align-items: center;
314405
justify-content: space-between;

0 commit comments

Comments
 (0)