Wanswan commited on
Commit
e50a1cf
·
verified ·
1 Parent(s): d0bb10b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -34
app.py CHANGED
@@ -199,7 +199,6 @@ async def respond(user_input, history, step, language, questions, followup_mode)
199
  def init():
200
  return [{"role": "assistant", "content": WELCOME_MESSAGE_EN}], 0, "", [], False
201
 
202
-
203
  with gr.Blocks(css="""
204
  .send-btn {
205
  background-color: #25D366 !important;
@@ -212,33 +211,31 @@ with gr.Blocks(css="""
212
  width: 60px;
213
  margin-left: 8px;
214
  cursor: pointer;
 
215
  }
 
216
  #chatbox .avatar-container {
217
- width: 64px !important;
218
- height: 64px !important;
219
- min-width: 64px !important;
220
- min-height: 64px !important;
221
- background-size: 100% 100% !important;
222
- background-position: center center !important;
223
- border-radius: 50% !important;
224
- padding: 0 !important;
225
- margin: 0 !important;
226
- border: none !important;
227
- box-shadow: none !important;
228
- background-color: transparent !important;
229
  }
 
230
  #chatbox .message.user { background-color: #DCF8C6 !important; }
231
  #chatbox .message.assistant { background-color: #ffffff !important; }
232
 
233
-
234
- footer { display: none !important; }
235
- .svelte-1ipelgc { display: none !important; }
236
- .icon-button-wrapper {
237
- display: none !important;
238
- }
239
- label.svelte-1to105q {
240
  display: none !important;
241
  }
 
242
  /* ✅ 解锁 Gradio 聊天气泡在 iframe / mobile 下的最大可用宽度 */
243
  html, body, .gradio-container, #root, .main, .wrap, .prose, .gr-box {
244
  max-width: 100% !important;
@@ -249,40 +246,39 @@ html, body, .gradio-container, #root, .main, .wrap, .prose, .gr-box {
249
  overflow-x: hidden !important;
250
  }
251
 
252
- /* ✅ 聊天气泡最大宽度调整(让其撑满屏幕宽度的 96%) */
253
  #chatbox .message {
254
- font-size: 15px !important;
255
- line-height: 1.5em !important;
256
- max-width: 96vw !important; /* <-- 改成 viewport 宽度 */
257
- padding: 10px 14px !important;
258
  border-radius: 12px !important;
259
  word-break: break-word !important;
260
  white-space: normal !important;
261
  }
262
 
263
-
264
-
265
  @media screen and (max-width: 768px) {
266
  #chatbox .message {
267
- font-size: 13px !important;
268
- max-width: 94% !important;
269
  }
270
  }
271
- #chatbox .message { background-color: lightblue !important; }
272
  body {
273
- background-color: pink !important;
274
  width: 100vw !important;
275
  min-width: 100vw !important;
 
276
  }
277
- .prose, .main, .svelte-1ipelgc, .container, .max-w-4xl {
 
278
  max-width: 100vw !important;
279
  width: 100vw !important;
280
  margin: 0 !important;
281
  padding: 0 !important;
282
  }
283
-
284
-
285
  """) as demo:
 
286
  gr.HTML("""
287
  <script>
288
  const waitForChatbox = () => {
 
199
  def init():
200
  return [{"role": "assistant", "content": WELCOME_MESSAGE_EN}], 0, "", [], False
201
 
 
202
  with gr.Blocks(css="""
203
  .send-btn {
204
  background-color: #25D366 !important;
 
211
  width: 60px;
212
  margin-left: 8px;
213
  cursor: pointer;
214
+ flex-shrink: 0 !important;
215
  }
216
+
217
  #chatbox .avatar-container {
218
+ width: 64px !important;
219
+ height: 64px !important;
220
+ min-width: 64px !important;
221
+ min-height: 64px !important;
222
+ background-size: 100% 100% !important;
223
+ background-position: center center !important;
224
+ border-radius: 50% !important;
225
+ padding: 0 !important;
226
+ margin: 0 !important;
227
+ border: none !important;
228
+ box-shadow: none !important;
229
+ background-co的程度: transparent !important;
230
  }
231
+
232
  #chatbox .message.user { background-color: #DCF8C6 !important; }
233
  #chatbox .message.assistant { background-color: #ffffff !important; }
234
 
235
+ footer, .svelte-1ipelgc, .icon-button-wrapper, label.svelte-1to105q {
 
 
 
 
 
 
236
  display: none !important;
237
  }
238
+
239
  /* ✅ 解锁 Gradio 聊天气泡在 iframe / mobile 下的最大可用宽度 */
240
  html, body, .gradio-container, #root, .main, .wrap, .prose, .gr-box {
241
  max-width: 100% !important;
 
246
  overflow-x: hidden !important;
247
  }
248
 
249
+ /* ✅ 聊天气泡最大宽度和排版优化 */
250
  #chatbox .message {
251
+ font-size: 16px !important;
252
+ line-height: 1.6em !important;
253
+ max-width: 90vw !important;
254
+ padding: 6px 12px !important;
255
  border-radius: 12px !important;
256
  word-break: break-word !important;
257
  white-space: normal !important;
258
  }
259
 
 
 
260
  @media screen and (max-width: 768px) {
261
  #chatbox .message {
262
+ font-size: 15px !important;
263
+ max-width: 94vw !important;
264
  }
265
  }
266
+
267
  body {
268
+ background-color: #f9f9f9 !important;
269
  width: 100vw !important;
270
  min-width: 100vw !important;
271
+ overflow-x: hidden !important;
272
  }
273
+
274
+ .prose, .main, .container, .max-w-4xl {
275
  max-width: 100vw !important;
276
  width: 100vw !important;
277
  margin: 0 !important;
278
  padding: 0 !important;
279
  }
 
 
280
  """) as demo:
281
+
282
  gr.HTML("""
283
  <script>
284
  const waitForChatbox = () => {