ronylu commited on
Commit
f2cea12
·
verified ·
1 Parent(s): 7f4ab6d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -34
app.py CHANGED
@@ -153,12 +153,6 @@ CSS = """
153
  background: var(--bg-secondary);
154
  }
155
 
156
- .gradio-chatbot {
157
- min-height: 100%;
158
- background: transparent !important;
159
- border: none !important;
160
- }
161
-
162
  /* Input Area */
163
  #input-area {
164
  padding: 24px;
@@ -243,27 +237,27 @@ CSS = """
243
  }
244
 
245
  /* Chat Messages Customization */
246
- .user-message, .assistant-message {
247
- padding: 16px 20px;
248
- border-radius: 18px;
249
- margin: 8px 0;
250
- max-width: 85%;
251
- line-height: 1.5;
252
  }
253
 
254
- .user-message {
255
- background: var(--primary-color);
256
- color: white;
257
- margin-left: auto;
258
- border-bottom-right-radius: 4px;
259
  }
260
 
261
- .assistant-message {
262
- background: var(--bg-secondary);
263
- color: var(--text-primary);
264
- margin-right: auto;
265
- border-bottom-left-radius: 4px;
266
- border: 1px solid var(--border-color);
267
  }
268
 
269
  /* Model Info Badge */
@@ -299,12 +293,13 @@ CSS = """
299
  flex-wrap: wrap;
300
  }
301
  }
302
- """
303
 
304
- theme = gr.themes.Soft(
305
- primary_hue="indigo",
306
- secondary_hue="slate"
307
- )
 
 
308
 
309
  # ========= HELPERS =========
310
  def normalize_whitespace(s: str) -> str:
@@ -423,7 +418,7 @@ def on_clear():
423
  return [], "", "No files loaded"
424
 
425
  # ========= MODERN UI =========
426
- with gr.Blocks(title="iChat AI Assistant", css=CSS, theme=theme) as demo:
427
  file_context_state = gr.State("")
428
  chat_state = gr.State([])
429
 
@@ -499,10 +494,8 @@ with gr.Blocks(title="iChat AI Assistant", css=CSS, theme=theme) as demo:
499
  chatbot = gr.Chatbot(
500
  value=[],
501
  elem_id="chatbot-container",
502
- height=600,
503
- bubble_full_width=False,
504
- show_copy_button=True,
505
- avatar_images=(None, "https://api.dicebear.com/7.x/bottts-neutral/svg?seed=AI"))
506
 
507
  # Input Area
508
  with gr.Column(elem_id="input-area"):
@@ -595,4 +588,4 @@ with gr.Blocks(title="iChat AI Assistant", css=CSS, theme=theme) as demo:
595
  outputs=[file_context_state, file_info_display]
596
  )
597
 
598
- demo.launch()
 
153
  background: var(--bg-secondary);
154
  }
155
 
 
 
 
 
 
 
156
  /* Input Area */
157
  #input-area {
158
  padding: 24px;
 
237
  }
238
 
239
  /* Chat Messages Customization */
240
+ .user[data-testid="user"], .assistant[data-testid="assistant"] {
241
+ padding: 16px 20px !important;
242
+ border-radius: 18px !important;
243
+ margin: 8px 0 !important;
244
+ max-width: 85% !important;
245
+ line-height: 1.5 !important;
246
  }
247
 
248
+ .user[data-testid="user"] {
249
+ background: var(--primary-color) !important;
250
+ color: white !important;
251
+ margin-left: auto !important;
252
+ border-bottom-right-radius: 4px !important;
253
  }
254
 
255
+ .assistant[data-testid="assistant"] {
256
+ background: var(--bg-secondary) !important;
257
+ color: var(--text-primary) !important;
258
+ margin-right: auto !important;
259
+ border-bottom-left-radius: 4px !important;
260
+ border: 1px solid var(--border-color) !important;
261
  }
262
 
263
  /* Model Info Badge */
 
293
  flex-wrap: wrap;
294
  }
295
  }
 
296
 
297
+ /* Hide default Gradio borders */
298
+ .gr-chatbot {
299
+ border: none !important;
300
+ background: transparent !important;
301
+ }
302
+ """
303
 
304
  # ========= HELPERS =========
305
  def normalize_whitespace(s: str) -> str:
 
418
  return [], "", "No files loaded"
419
 
420
  # ========= MODERN UI =========
421
+ with gr.Blocks(title="iChat AI Assistant") as demo:
422
  file_context_state = gr.State("")
423
  chat_state = gr.State([])
424
 
 
494
  chatbot = gr.Chatbot(
495
  value=[],
496
  elem_id="chatbot-container",
497
+ height=600
498
+ )
 
 
499
 
500
  # Input Area
501
  with gr.Column(elem_id="input-area"):
 
588
  outputs=[file_context_state, file_info_display]
589
  )
590
 
591
+ demo.launch(css=CSS)