broadfield-dev commited on
Commit
1c5d63e
Β·
verified Β·
1 Parent(s): 8e8739e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -39
app.py CHANGED
@@ -448,45 +448,45 @@ with gr.Blocks(title="AI Research Agent v5.8") as demo:
448
  if MEMORY_STORAGE_BACKEND == "RAM":
449
  save_faiss_sidebar_btn = gr.Button("Save FAISS Indices", variant="secondary")
450
  with gr.Column():
451
- gr.Markdown("# πŸ€– AI Research Agent")
452
- # Removed subtitle from here, can be added in description of Space if hosted on HF
453
- with gr.Row():
454
- with gr.Column(scale=3): agent_stat_tb = gr.Textbox(label="Agent Status", interactive=False, lines=1, value="Initializing systems...")
455
- with gr.Column(scale=1): memory_backend_info_tb = gr.Textbox(label="Memory Backend", value=f"{MEMORY_STORAGE_BACKEND}", interactive=False)
456
- sqlite_path_display = gr.Textbox(label="SQLite Path", value=f"{MEMORY_SQLITE_PATH}", interactive=False, scale=2) # Use visible
457
- hf_repos_display = gr.Textbox(label="HF Repos", value=f"M: {MEMORY_HF_MEM_REPO}, R: {MEMORY_HF_RULES_REPO}", interactive=False, scale=2) # Use visible
458
-
459
- with gr.Tabs():
460
- with gr.TabItem("πŸ’¬ AI Chat & Research Output"):
461
- gr.Markdown("### AI Chat Interface") # Using H3 for section titles within tabs
462
- main_chat_disp = gr.Chatbot(label="AI Research Chat", height=500, bubble_full_width=False, avatar_images=(None, "https://raw.githubusercontent.com/huggingface/brand-assets/main/hf-logo-with-title.png"), show_copy_button=True, render_markdown=True, sanitize_html=True)
463
- with gr.Row():
464
- user_msg_tb = gr.Textbox(show_label=False, placeholder="Ask your research question...", scale=7, lines=1, max_lines=5, autofocus=True)
465
- send_btn = gr.Button("Send", variant="primary", scale=1, min_width=100)
466
- with gr.Accordion("πŸ“ Full Response / Details", open=False):
467
- fmt_report_tb = gr.Textbox(label="Full AI Response", lines=10, interactive=True, show_copy_button=True)
468
- dl_report_btn = gr.DownloadButton("Download Report", interactive=False, visible=False)
469
- detect_out_md = gr.Markdown()
470
-
471
- with gr.TabItem("🧠 Knowledge Base Management"):
472
- gr.Markdown("### Manage Stored Knowledge")
473
- with gr.Row():
474
- with gr.Column():
475
- with gr.Group():
476
- gr.Markdown("#### πŸ“œ Rules (Insights)")
477
- rules_disp_ta = gr.TextArea(label="View/Edit Rules", lines=15, interactive=True, placeholder="Load rules or type new ones...")
478
- with gr.Row(): view_rules_btn = gr.Button("πŸ”„ Load"); save_edited_rules_btn = gr.Button("πŸ’Ύ Save Edits", variant="primary")
479
- upload_rules_fobj = gr.File(label="Upload Rules File", file_types=[".txt", ".jsonl"])
480
- rules_stat_tb = gr.Textbox(label="Rules Status", interactive=False, lines=2)
481
- clear_rules_btn = gr.Button("⚠️ Clear All Rules", variant="stop")
482
- with gr.Column():
483
- with gr.Group():
484
- gr.Markdown("#### πŸ“š Memories")
485
- mems_disp_json = gr.JSON(label="View Memories")
486
- view_mems_btn = gr.Button("πŸ”„ Load Memories")
487
- upload_mems_fobj = gr.File(label="Upload Memories File", file_types=[".jsonl"])
488
- mems_stat_tb = gr.Textbox(label="Memories Status", interactive=False, lines=2)
489
- clear_mems_btn = gr.Button("⚠️ Clear All Memories", variant="stop")
490
 
491
  def dyn_upd_model_dd(sel_prov_dyn:str): models_dyn, def_model_dyn = get_model_display_names_for_provider(sel_prov_dyn), get_default_model_display_name_for_provider(sel_prov_dyn); return gr.Dropdown(choices=models_dyn, value=def_model_dyn, interactive=True)
492
  prov_sel_dd.change(fn=dyn_upd_model_dd, inputs=prov_sel_dd, outputs=model_sel_dd)
 
448
  if MEMORY_STORAGE_BACKEND == "RAM":
449
  save_faiss_sidebar_btn = gr.Button("Save FAISS Indices", variant="secondary")
450
  with gr.Column():
451
+ gr.Markdown("# πŸ€– AI Research Agent")
452
+ # Removed subtitle from here, can be added in description of Space if hosted on HF
453
+ with gr.Row():
454
+ with gr.Column(scale=3): agent_stat_tb = gr.Textbox(label="Agent Status", interactive=False, lines=1, value="Initializing systems...")
455
+ with gr.Column(scale=1): memory_backend_info_tb = gr.Textbox(label="Memory Backend", value=f"{MEMORY_STORAGE_BACKEND}", interactive=False)
456
+ sqlite_path_display = gr.Textbox(label="SQLite Path", value=f"{MEMORY_SQLITE_PATH}", interactive=False, scale=2) # Use visible
457
+ hf_repos_display = gr.Textbox(label="HF Repos", value=f"M: {MEMORY_HF_MEM_REPO}, R: {MEMORY_HF_RULES_REPO}", interactive=False, scale=2) # Use visible
458
+
459
+ with gr.Tabs():
460
+ with gr.TabItem("πŸ’¬ AI Chat & Research Output"):
461
+ gr.Markdown("### AI Chat Interface") # Using H3 for section titles within tabs
462
+ main_chat_disp = gr.Chatbot(label="AI Research Chat", height=500, bubble_full_width=False, avatar_images=(None, "https://raw.githubusercontent.com/huggingface/brand-assets/main/hf-logo-with-title.png"), show_copy_button=True, render_markdown=True, sanitize_html=True)
463
+ with gr.Row():
464
+ user_msg_tb = gr.Textbox(show_label=False, placeholder="Ask your research question...", scale=7, lines=1, max_lines=5, autofocus=True)
465
+ send_btn = gr.Button("Send", variant="primary", scale=1, min_width=100)
466
+ with gr.Accordion("πŸ“ Full Response / Details", open=False):
467
+ fmt_report_tb = gr.Textbox(label="Full AI Response", lines=10, interactive=True, show_copy_button=True)
468
+ dl_report_btn = gr.DownloadButton("Download Report", interactive=False, visible=False)
469
+ detect_out_md = gr.Markdown()
470
+
471
+ with gr.TabItem("🧠 Knowledge Base Management"):
472
+ gr.Markdown("### Manage Stored Knowledge")
473
+ with gr.Row():
474
+ with gr.Column():
475
+ with gr.Group():
476
+ gr.Markdown("#### πŸ“œ Rules (Insights)")
477
+ rules_disp_ta = gr.TextArea(label="View/Edit Rules", lines=15, interactive=True, placeholder="Load rules or type new ones...")
478
+ with gr.Row(): view_rules_btn = gr.Button("πŸ”„ Load"); save_edited_rules_btn = gr.Button("πŸ’Ύ Save Edits", variant="primary")
479
+ upload_rules_fobj = gr.File(label="Upload Rules File", file_types=[".txt", ".jsonl"])
480
+ rules_stat_tb = gr.Textbox(label="Rules Status", interactive=False, lines=2)
481
+ clear_rules_btn = gr.Button("⚠️ Clear All Rules", variant="stop")
482
+ with gr.Column():
483
+ with gr.Group():
484
+ gr.Markdown("#### πŸ“š Memories")
485
+ mems_disp_json = gr.JSON(label="View Memories")
486
+ view_mems_btn = gr.Button("πŸ”„ Load Memories")
487
+ upload_mems_fobj = gr.File(label="Upload Memories File", file_types=[".jsonl"])
488
+ mems_stat_tb = gr.Textbox(label="Memories Status", interactive=False, lines=2)
489
+ clear_mems_btn = gr.Button("⚠️ Clear All Memories", variant="stop")
490
 
491
  def dyn_upd_model_dd(sel_prov_dyn:str): models_dyn, def_model_dyn = get_model_display_names_for_provider(sel_prov_dyn), get_default_model_display_name_for_provider(sel_prov_dyn); return gr.Dropdown(choices=models_dyn, value=def_model_dyn, interactive=True)
492
  prov_sel_dd.change(fn=dyn_upd_model_dd, inputs=prov_sel_dd, outputs=model_sel_dd)