jcccy commited on
Commit
5213a74
·
1 Parent(s): 11a0341
Files changed (1) hide show
  1. app.py +64 -0
app.py CHANGED
@@ -230,6 +230,70 @@ img[alt="robot"] {
230
  object-fit: contain !important;
231
  }
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
  /* 另外,如果class名每次构建random变化,可以更换为更通用选择器,比如:
234
  .custom-avatar img { ... }
235
  或直接用img[src^='https://jcccy-brainvlm.hf.space/gradio_api/file='] {}
 
230
  object-fit: contain !important;
231
  }
232
 
233
+ /* 解决头像被遮挡问题:
234
+ 增大对话框内边距(给左侧留空间用于显示头像),
235
+ 或直接调整 bot 消息容器的 padding-left
236
+ */
237
+ .bot.svelte-1nr59td.message,
238
+ .bot.message {
239
+ position: relative;
240
+ /* 保证可以用于定位头像,和防止头像溢出 */
241
+ }
242
+ .bot.svelte-1nr59td.message .message.svelte-1nr59td.panel-full-width,
243
+ .bot .message {
244
+ padding-left: 76px !important; /* 留出空间给头像, 必须大于头像尺寸 */
245
+ min-height: 60px !important; /* 行高大于等于头像高度 */
246
+ align-items: center;
247
+ box-sizing: border-box;
248
+ }
249
+
250
+ .bot.svelte-1nr59td.message img,
251
+ .bot.message img,
252
+ .gr-chatbot img,
253
+ .gradio-chatbot img,
254
+ img[alt="assistant"],
255
+ img[alt="robot"] {
256
+ position: absolute !important;
257
+ left: 10px !important;
258
+ top: 16px !important;
259
+ width: 60px !important;
260
+ height: 60px !important;
261
+ max-width: 60px !important;
262
+ max-height: 60px !important;
263
+ min-width: 60px !important;
264
+ min-height: 60px !important;
265
+ object-fit: contain !important;
266
+ z-index: 2;
267
+ background: #fff; /* 可选, 防止边缘被遮盖 */
268
+ border-radius: 50%; /* 可选, 更像头像 */
269
+ box-shadow: 0 2px 8px rgba(44,49,146,0.06);
270
+ }
271
+
272
+ /* 防止 .message-content 再次覆盖 padding */
273
+ .bot.svelte-1nr59td.message .message-content,
274
+ .bot .message-content {
275
+ padding-left: 0 !important;
276
+ }
277
+
278
+ @media (max-width: 600px) {
279
+ .bot.svelte-1nr59td.message .message.svelte-1nr59td.panel-full-width,
280
+ .bot .message {
281
+ padding-left: 68px !important;
282
+ }
283
+ .bot.svelte-1nr59td.message img,
284
+ .bot.message img {
285
+ left: 4px !important;
286
+ top: 8px !important;
287
+ width: 44px !important;
288
+ height: 44px !important;
289
+ min-width: 44px !important;
290
+ min-height: 44px !important;
291
+ max-width: 44px !important;
292
+ max-height: 44px !important;
293
+ }
294
+ }
295
+
296
+
297
  /* 另外,如果class名每次构建random变化,可以更换为更通用选择器,比如:
298
  .custom-avatar img { ... }
299
  或直接用img[src^='https://jcccy-brainvlm.hf.space/gradio_api/file='] {}