Skip to content

Commit f201267

Browse files
committed
fix:调整聊天控件排版,防止互相遮挡
1 parent 9fb103f commit f201267

File tree

1 file changed

+67
-9
lines changed

1 file changed

+67
-9
lines changed

src/chatPanel.ts

Lines changed: 67 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,21 +216,79 @@ export class ChatPanel {
216216
.mermaid-rendered .mermaid {
217217
display: none;
218218
}
219+
220+
/* 右上角智能弹性容器 */
221+
.top-right-flex-container {
222+
position: absolute;
223+
top: 10px;
224+
right: 10px;
225+
display: flex;
226+
flex-direction: row-reverse; /* 反向排列确保New Session在最右 */
227+
align-items: center;
228+
gap: 15px;
229+
max-width: 90vw; /* 视窗宽度限制 */
230+
background: rgba(65, 54, 54, 0.9); /* 可选背景防止透叠 */
231+
padding: 5px 10px;
232+
border-radius: 4px;
233+
box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* 可选投影增强可视性 */
234+
}
235+
.bottom-controls {
236+
width: 100%;
237+
}
238+
.left-controls {
239+
display: flex;
240+
flex-wrap: nowrap;
241+
align-items: center;
242+
gap: 10px;
243+
overflow-x: auto;
244+
padding: 5px 0;
245+
}
246+
247+
.mermaid-wrapper {
248+
display: flex;
249+
align-items: center;
250+
flex-shrink: 1; /* 允许适当收缩 */
251+
min-width: 0; /* 关键:允许内容溢出检测 */
252+
}
253+
254+
.mermaid-wrapper label {
255+
white-space: nowrap;
256+
overflow: hidden;
257+
text-overflow: ellipsis; /* 文字过长时显示省略号 */
258+
max-width: 200px; /* 根据实际需要调整 */
259+
}
260+
261+
.fixed-width-btn {
262+
flex-shrink: 0; /* 禁止按钮收缩 */
263+
width: 120px; /* 固定按钮宽度 */
264+
}
219265
</style>
220266
</head>
221267
<body>
222268
<div id="chat"></div>
223269
<div id="input-container">
224-
<textarea id="input" placeholder="Type your message here... (Ctrl+Enter to send)"></textarea>
225-
<button id="send">Send</button>
226-
<button id="stop" style="display: none;">Stop</button>
227-
<button id="new-session" style="position: absolute; top: 10px; right: 10px;">New Session</button>
228-
<div id="mermaid-toggle-container">
229-
<input type="checkbox" id="mermaid-toggle">
230-
<label for="mermaid-toggle">Show Mermaid Raw Code</label>
270+
<!-- 右上角智能布局容器 -->
271+
<div class="top-right-flex-container">
272+
<button id="new-session" class="fixed-width-btn">New Session</button>
273+
<div class="mermaid-wrapper">
274+
<input type="checkbox" id="mermaid-toggle">
275+
<label for="mermaid-toggle">Show Mermaid Raw Code</label>
276+
</div>
277+
278+
</div>
279+
280+
<textarea id="input" placeholder="Type your message here..."></textarea>
281+
282+
<div class="bottom-controls">
283+
<div class="left-controls">
284+
<button id="send">Send</button>
285+
<button id="stop" style="display:none;">Stop</button>
286+
<div class="web-search">
287+
<input type="checkbox" id="web-search">
288+
<label for="web-search">联网搜索</label>
289+
</div>
290+
</div>
231291
</div>
232-
<input type="checkbox" id="web-search">
233-
<label for="web-search">联网搜索</label>
234292
</div>
235293
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
236294
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>

0 commit comments

Comments
 (0)