broadfield-dev commited on
Commit
511c8fb
Β·
verified Β·
1 Parent(s): dce73dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -31
app.py CHANGED
@@ -455,38 +455,37 @@ with gr.Blocks(title="AI Research Agent v5.8") as demo:
455
  sqlite_path_display = gr.Textbox(label="SQLite Path", value=f"{MEMORY_SQLITE_PATH}", interactive=False, visible=(MEMORY_STORAGE_BACKEND == "SQLITE"), scale=2) # Use visible
456
  hf_repos_display = gr.Textbox(label="HF Repos", value=f"M: {MEMORY_HF_MEM_REPO}, R: {MEMORY_HF_RULES_REPO}", interactive=False, visible=(MEMORY_STORAGE_BACKEND == "HF_DATASET"), scale=2) # Use visible
457
 
458
- with gr.Row(scale=3): # Main content area to the right of sidebar
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)
 
455
  sqlite_path_display = gr.Textbox(label="SQLite Path", value=f"{MEMORY_SQLITE_PATH}", interactive=False, visible=(MEMORY_STORAGE_BACKEND == "SQLITE"), scale=2) # Use visible
456
  hf_repos_display = gr.Textbox(label="HF Repos", value=f"M: {MEMORY_HF_MEM_REPO}, R: {MEMORY_HF_RULES_REPO}", interactive=False, visible=(MEMORY_STORAGE_BACKEND == "HF_DATASET"), scale=2) # Use visible
457
 
458
+ with gr.Tabs():
459
+ with gr.TabItem("πŸ’¬ AI Chat & Research Output"):
460
+ gr.Markdown("### AI Chat Interface") # Using H3 for section titles within tabs
461
+ 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)
462
+ with gr.Row():
463
+ user_msg_tb = gr.Textbox(show_label=False, placeholder="Ask your research question...", scale=7, lines=1, max_lines=5, autofocus=True)
464
+ send_btn = gr.Button("Send", variant="primary", scale=1, min_width=100)
465
+ with gr.Accordion("πŸ“ Full Response / Details", open=False):
466
+ fmt_report_tb = gr.Textbox(label="Full AI Response", lines=10, interactive=True, show_copy_button=True)
467
+ dl_report_btn = gr.DownloadButton("Download Report", interactive=False, visible=False)
468
+ detect_out_md = gr.Markdown()
 
469
 
470
+ with gr.TabItem("🧠 Knowledge Base Management"):
471
+ gr.Markdown("### Manage Stored Knowledge")
472
+ with gr.Row():
473
+ with gr.Column():
474
+ with gr.Group():
475
+ gr.Markdown("#### πŸ“œ Rules (Insights)")
476
+ rules_disp_ta = gr.TextArea(label="View/Edit Rules", lines=15, interactive=True, placeholder="Load rules or type new ones...")
477
+ with gr.Row(): view_rules_btn = gr.Button("πŸ”„ Load"); save_edited_rules_btn = gr.Button("πŸ’Ύ Save Edits", variant="primary")
478
+ upload_rules_fobj = gr.File(label="Upload Rules File", file_types=[".txt", ".jsonl"])
479
+ rules_stat_tb = gr.Textbox(label="Rules Status", interactive=False, lines=2)
480
+ clear_rules_btn = gr.Button("⚠️ Clear All Rules", variant="stop")
481
+ with gr.Column():
482
+ with gr.Group():
483
+ gr.Markdown("#### πŸ“š Memories")
484
+ mems_disp_json = gr.JSON(label="View Memories")
485
+ view_mems_btn = gr.Button("πŸ”„ Load Memories")
486
+ upload_mems_fobj = gr.File(label="Upload Memories File", file_types=[".jsonl"])
487
+ mems_stat_tb = gr.Textbox(label="Memories Status", interactive=False, lines=2)
488
+ clear_mems_btn = gr.Button("⚠️ Clear All Memories", variant="stop")
489
 
490
  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)
491
  prov_sel_dd.change(fn=dyn_upd_model_dd, inputs=prov_sel_dd, outputs=model_sel_dd)