arubaDev commited on
Commit
c23fcc8
·
verified ·
1 Parent(s): a08afcc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -11
app.py CHANGED
@@ -318,18 +318,33 @@ default_selected = labels[0] if labels else None
318
  with gr.Blocks(title="Backend-Focused LLaMA/Mistral CRUD Assistant", theme=gr.themes.Soft()) as demo:
319
  gr.HTML("""
320
  <style>
321
- button {
 
 
 
 
 
 
 
 
322
  background-color: #22c55e !important;
323
- color: #ffffff !important;
324
  border: none !important;
 
325
  }
326
- button:hover {
 
 
 
327
  background-color: #16a34a !important;
328
  }
329
- button:focus {
 
 
330
  outline: 2px solid #166534 !important;
331
- outline-offset: 2px;
332
  }
 
 
333
  .compact-sliders .gr-form {
334
  margin-bottom: 0.5rem !important;
335
  }
@@ -347,6 +362,7 @@ with gr.Blocks(title="Backend-Focused LLaMA/Mistral CRUD Assistant", theme=gr.th
347
  max-height: 120px !important;
348
  }
349
  </style>
 
350
  """)
351
 
352
  gr.Markdown("## 🗄️ LLaMA & Mistral Backend-Focused CRUD Automation — with Persistent History")
@@ -363,8 +379,12 @@ with gr.Blocks(title="Backend-Focused LLaMA/Mistral CRUD Assistant", theme=gr.th
363
  # -----------------------
364
  # Editable title input
365
  # -----------------------
 
 
 
366
  edit_title_box = gr.Textbox(label="✏️ Rename Chat", placeholder="Edit selected chat title...")
367
- rename_btn = gr.Button("💾 Save Title")
 
368
 
369
  def rename_session_cb(new_title, selected_label):
370
  sid = label_to_id(selected_label)
@@ -381,12 +401,14 @@ with gr.Blocks(title="Backend-Focused LLaMA/Mistral CRUD Assistant", theme=gr.th
381
  return gr.update(choices=labels, value=new_selected)
382
 
383
  # Connect button to callback
384
- rename_btn.click(rename_session_cb, inputs=[edit_title_box, session_list], outputs=session_list)
 
 
 
 
 
 
385
 
386
- with gr.Row():
387
- new_btn = gr.Button("➕ New Chat", variant="primary")
388
- del_btn = gr.Button("🗑️ Delete", variant="stop")
389
- refresh_btn = gr.Button("🔄 Refresh", variant="secondary")
390
 
391
  gr.Markdown("### 🤖 Model Selection")
392
  model_choice = gr.Dropdown(
 
318
  with gr.Blocks(title="Backend-Focused LLaMA/Mistral CRUD Assistant", theme=gr.themes.Soft()) as demo:
319
  gr.HTML("""
320
  <style>
321
+ /* General button style */
322
+ #session-action-row button,
323
+ #save-title-btn {
324
+ width: 36px !important;
325
+ height: 36px !important;
326
+ border-radius: 8px !important;
327
+ font-size: 18px !important;
328
+ padding: 0 !important;
329
+ margin: 2px !important;
330
  background-color: #22c55e !important;
331
+ color: #fff !important;
332
  border: none !important;
333
+ cursor: pointer;
334
  }
335
+
336
+ /* Hover & focus effects */
337
+ #session-action-row button:hover,
338
+ #save-title-btn:hover {
339
  background-color: #16a34a !important;
340
  }
341
+
342
+ #session-action-row button:focus,
343
+ #save-title-btn:focus {
344
  outline: 2px solid #166534 !important;
 
345
  }
346
+
347
+ /* Compact form/sliders keep */
348
  .compact-sliders .gr-form {
349
  margin-bottom: 0.5rem !important;
350
  }
 
362
  max-height: 120px !important;
363
  }
364
  </style>
365
+
366
  """)
367
 
368
  gr.Markdown("## 🗄️ LLaMA & Mistral Backend-Focused CRUD Automation — with Persistent History")
 
379
  # -----------------------
380
  # Editable title input
381
  # -----------------------
382
+ # -----------------------
383
+ # Editable title input
384
+ # -----------------------
385
  edit_title_box = gr.Textbox(label="✏️ Rename Chat", placeholder="Edit selected chat title...")
386
+ save_title_btn = gr.Button("💾", elem_id="save-title-btn", tooltip="Save Title")
387
+
388
 
389
  def rename_session_cb(new_title, selected_label):
390
  sid = label_to_id(selected_label)
 
401
  return gr.update(choices=labels, value=new_selected)
402
 
403
  # Connect button to callback
404
+ save_title_btn.click(rename_session_cb, inputs=[edit_title_box, session_list], outputs=session_list)
405
+
406
+
407
+ with gr.Row(elem_id="session-action-row"):
408
+ new_btn = gr.Button("➕", elem_id="new-chat-btn", tooltip="New Chat")
409
+ del_btn = gr.Button("🗑️", elem_id="delete-chat-btn", tooltip="Delete Chat")
410
+ refresh_btn = gr.Button("🔄", elem_id="refresh-btn", tooltip="Refresh List")
411
 
 
 
 
 
412
 
413
  gr.Markdown("### 🤖 Model Selection")
414
  model_choice = gr.Dropdown(