Spaces:
Sleeping
Sleeping
Update app.py
Browse files15 unmodified lines16171819202122895 unmodified lines9189199209219229239249251 unmodified line927928929930931932933934935936937938939395 unmodified lines13351336133713381339134013411 unmodified line13431344134513461347134815 unmodified lines)from hf_utils import download_filtered_space_files, search_top_spacesfrom chatbot_page import chat_with_user, extract_keywords_from_conversationfrom repo_explorer import create_repo_explorer_tab, setup_repo_explorer_events# --- Configuration ---logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')895 unmodified linesreturn gr.update(visible=False), hf_urlreturn gr.update(visible=False), ""def handle_explore_repo(selected_repo_id: str) -> Tuple[Any, Any, Any]:"""Handle navigating to the repo explorer and populate the repo ID."""logger.info(f"DEBUG: handle_explore_repo called with selected_repo_id: '{selected_repo_id}'")if selected_repo_id and selected_repo_id.strip() and selected_repo_id.strip() != 'nan':1 unmodified linereturn (gr.update(visible=False), # close modalgr.update(selected="repo_explorer_tab"), # switch tabgr.update(value=clean_repo_id) # populate repo explorer input)else:return (gr.update(visible=False), # close modalgr.update(selected="repo_explorer_tab"), # switch tabgr.update() # don't change repo explorer input)def handle_cancel_modal() -> Any:395 unmodified linesoutputs=[repo_action_modal,tabs,repo_components["repo_explorer_input"]],js="""(repo_id) => {console.log('DEBUG: Navigate to repo explorer for:', repo_id);1 unmodified linewindow.scrollTo({top: 0, behavior: 'smooth'});}, 200);}""")cancel_modal_btn.click(fn=handle_cancel_modal,15 unmodified lines16171819202122895 unmodified lines9189199209219229239249251 unmodified line927928929930931932933934935936937938939940941942943395 unmodified lines1339134013411342134313441345134613471 unmodified line134913501351135213531354135513561357135813591360136113621363136413651366136715 unmodified lines)from hf_utils import download_filtered_space_files, search_top_spacesfrom chatbot_page import chat_with_user, extract_keywords_from_conversationfrom repo_explorer import create_repo_explorer_tab, setup_repo_explorer_events, initialize_repo_chatbot# --- Configuration ---logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')895 unmodified linesreturn gr.update(visible=False), hf_urlreturn gr.update(visible=False), ""def handle_explore_repo(selected_repo_id: str) -> Tuple[Any, Any, Any, str, str]:"""Handle navigating to the repo explorer and automatically load the repository."""logger.info(f"DEBUG: handle_explore_repo called with selected_repo_id: '{selected_repo_id}'")if selected_repo_id and selected_repo_id.strip() and selected_repo_id.strip() != 'nan':1 unmodified linereturn (gr.update(visible=False), # close modalgr.update(selected="repo_explorer_tab"), # switch tabgr.update(value=clean_repo_id), # populate repo explorer inputclean_repo_id, # trigger repository loading with the repo ID"auto_load" # signal to auto-load the repository)else:return (gr.update(visible=False), # close modalgr.update(selected="repo_explorer_tab"), # switch tabgr.update(), # don't change repo explorer input"", # no repo ID to load"" # no auto-load signal)def handle_cancel_modal() -> Any:395 unmodified linesoutputs=[repo_action_modal,tabs,repo_components["repo_explorer_input"],repo_states["current_repo_id"], # Set the current repo IDstatus_box_input # Use for auto-load signal],js="""(repo_id) => {console.log('DEBUG: Navigate to repo explorer for:', repo_id);1 unmodified linewindow.scrollTo({top: 0, behavior: 'smooth'});}, 200);}""").then(# Auto-load the repository if the signal indicates to do sofn=lambda repo_id, signal: handle_load_repository(repo_id) if signal == "auto_load" and repo_id else ("", ""),inputs=[repo_states["current_repo_id"], status_box_input],outputs=[repo_components["repo_status_display"], repo_states["repo_context_summary"]]).then(# Initialize the chatbot with welcome message after auto-loadingfn=lambda repo_status, repo_id, repo_context, signal: (initialize_repo_chatbot(repo_status, repo_id, repo_context)if signal == "auto_load" and repo_id else []),inputs=[repo_components["repo_status_display"], repo_states["current_repo_id"], repo_states["repo_context_summary"], status_box_input],outputs=[repo_components["repo_chatbot"]])cancel_modal_btn.click(fn=handle_cancel_modal,
app.py+25-6