Wanswan commited on
Commit
a19c844
·
verified ·
1 Parent(s): 909bcc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -26
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,44 +211,66 @@ with gr.Blocks(css="""
212
  width: 60px;
213
  margin-left: 8px;
214
  cursor: pointer;
 
215
  }
 
216
  #chatbox .avatar-container {
217
- width: 54px !important;
218
- height: 54px !important;
219
- min-width: 54px !important;
220
- min-height: 54px !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 {
232
  display: inline-block !important;
233
  font-size: 16px !important;
234
- line-height: 1.3em !important;
235
- min-width: 5ch !important;
236
- max-width: 96% !important;
237
- padding: 2px 3px !important;
238
- border-radius: 8px !important;
239
  word-break: break-word !important;
240
- word-wrap: break-word !important;
241
- white-space: normal !important;
242
  }
243
 
244
- #chatbox .message.assistant { background-color: #ffffff !important; }
245
- footer { display: none !important; }
246
- .svelte-1ipelgc { display: none !important; }
247
- .icon-button-wrapper {
248
- display: none !important;
 
249
  }
 
 
 
 
 
250
  label.svelte-1to105q {
251
  display: none !important;
252
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  """) as demo:
254
  gr.HTML("""
255
  <script>
 
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: 54px !important;
219
+ height: 54px !important;
220
+ min-width: 54px !important;
221
+ min-height: 54px !important;
222
+ background-size: cover !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
+ background-color: transparent !important;
229
+ box-shadow: none !important;
230
  }
231
+
232
+ /* ✅ 聊天气泡核心控制样式 */
233
  #chatbox .message {
234
  display: inline-block !important;
235
  font-size: 16px !important;
236
+ line-height: 1.4em !important;
237
+ min-width: 4ch !important;
238
+ max-width: 94% !important;
239
+ padding: 4px 6px !important;
240
+ border-radius: 10px !important;
241
  word-break: break-word !important;
242
+ white-space: pre-wrap !important;
 
243
  }
244
 
245
+ /* 气泡颜色样式 */
246
+ #chatbox .message.user {
247
+ background-color: #DCF8C6 !important;
248
+ }
249
+ #chatbox .message.assistant {
250
+ background-color: #FFFFFF !important;
251
  }
252
+
253
+ /* ✅ 移除 Gradio 默认残留区域 */
254
+ footer,
255
+ .svelte-1ipelgc,
256
+ .icon-button-wrapper,
257
  label.svelte-1to105q {
258
  display: none !important;
259
  }
260
+
261
+ /* ✅ 移动端优化 */
262
+ @media screen and (max-width: 768px) {
263
+ #chatbox .message {
264
+ font-size: 15px !important;
265
+ max-width: 94vw !important;
266
+ }
267
+ }
268
+
269
+ /* ✅ 防止全局横向滚动 */
270
+ html, body {
271
+ overflow-x: hidden !important;
272
+ }
273
+
274
  """) as demo:
275
  gr.HTML("""
276
  <script>