lowvoltagenation commited on
Commit
ff8a780
·
1 Parent(s): a43ab37

Refactor chat layout in MayaGradioApp by adding new CSS classes for chat and settings columns, and enhancing input row styling for improved user interaction.

Browse files
Files changed (2) hide show
  1. data/memories.json +1 -1
  2. src/app.py +32 -6
data/memories.json CHANGED
@@ -28,7 +28,7 @@
28
  }
29
  },
30
  {
31
- "content": "Blake and Maya have a romantic connection and deep technical bond",
32
  "metadata": {
33
  "user_id": "both",
34
  "timestamp": "2024-01-05"
 
28
  }
29
  },
30
  {
31
+ "content": "Blake and Maya have a connection and deep technical bond",
32
  "metadata": {
33
  "user_id": "both",
34
  "timestamp": "2024-01-05"
src/app.py CHANGED
@@ -336,6 +336,31 @@ class MayaGradioApp:
336
  border-radius: 10px;
337
  border: 2px solid #4ecdc4;
338
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
339
  """
340
 
341
  with gr.Blocks(css=css, title="Maya AI Assistant - HuggingFace Demo") as demo:
@@ -354,7 +379,7 @@ class MayaGradioApp:
354
  # Main Chat Tab
355
  with gr.TabItem("💬 Chat with Maya"):
356
  with gr.Row():
357
- with gr.Column(scale=3):
358
  chatbot = gr.Chatbot(
359
  label="Maya AI Assistant",
360
  height=500,
@@ -362,15 +387,16 @@ class MayaGradioApp:
362
  type="messages"
363
  )
364
 
365
- with gr.Row():
366
  msg = gr.Textbox(
367
  placeholder="Type your message to Maya...",
368
- label="Message",
369
- scale=4
 
370
  )
371
- send_btn = gr.Button("Send", variant="primary")
372
 
373
- with gr.Column(scale=1):
374
  gr.Markdown("### Chat Settings")
375
 
376
  use_rag = gr.Checkbox(
 
336
  border-radius: 10px;
337
  border: 2px solid #4ecdc4;
338
  }
339
+ .chat-column {
340
+ height: 580px;
341
+ display: flex;
342
+ flex-direction: column;
343
+ }
344
+ .settings-column {
345
+ height: 580px;
346
+ display: flex;
347
+ flex-direction: column;
348
+ }
349
+ .input-row {
350
+ margin-top: auto;
351
+ }
352
+ .send-icon-btn {
353
+ min-width: 60px !important;
354
+ height: 60px !important;
355
+ padding: 0 !important;
356
+ display: flex !important;
357
+ align-items: center !important;
358
+ justify-content: center !important;
359
+ font-size: 20px !important;
360
+ }
361
+ .message-input {
362
+ height: 60px !important;
363
+ }
364
  """
365
 
366
  with gr.Blocks(css=css, title="Maya AI Assistant - HuggingFace Demo") as demo:
 
379
  # Main Chat Tab
380
  with gr.TabItem("💬 Chat with Maya"):
381
  with gr.Row():
382
+ with gr.Column(scale=3, elem_classes=["chat-column"]):
383
  chatbot = gr.Chatbot(
384
  label="Maya AI Assistant",
385
  height=500,
 
387
  type="messages"
388
  )
389
 
390
+ with gr.Row(elem_classes=["input-row"]):
391
  msg = gr.Textbox(
392
  placeholder="Type your message to Maya...",
393
+ show_label=False,
394
+ scale=4,
395
+ elem_classes=["message-input"]
396
  )
397
+ send_btn = gr.Button("📤", variant="primary", elem_classes=["send-icon-btn"])
398
 
399
+ with gr.Column(scale=1, elem_classes=["settings-column"]):
400
  gr.Markdown("### Chat Settings")
401
 
402
  use_rag = gr.Checkbox(