Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ import time
|
|
11 |
from analyzer import combine_repo_files_for_llm, analyze_combined_file, parse_llm_json_response
|
12 |
from hf_utils import download_filtered_space_files, search_top_spaces
|
13 |
from chatbot_page import chat_with_user, extract_keywords_from_conversation
|
14 |
-
from repo_explorer import create_repo_explorer_tab, setup_repo_explorer_events
|
15 |
|
16 |
# --- Configuration ---
|
17 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
@@ -1031,12 +1031,24 @@ def create_ui() -> gr.Blocks:
|
|
1031 |
return gr.update(visible=False), hf_url
|
1032 |
return gr.update(visible=False), ""
|
1033 |
|
1034 |
-
def handle_explore_repo(repo_id: str) -> Tuple[Any, Any,
|
1035 |
-
"""Handle navigating to the repo explorer
|
1036 |
if repo_id and repo_id.strip():
|
1037 |
-
logger.info(f"User chose to explore: {repo_id.strip()}")
|
1038 |
-
|
1039 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1040 |
|
1041 |
def handle_cancel_modal() -> Any:
|
1042 |
"""Handle closing the modal."""
|
@@ -1184,7 +1196,13 @@ def create_ui() -> gr.Blocks:
|
|
1184 |
explore_repo_btn.click(
|
1185 |
fn=handle_explore_repo,
|
1186 |
inputs=[selected_repo_display],
|
1187 |
-
outputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
1188 |
js="() => { setTimeout(() => { window.scrollTo({top: 0, behavior: 'smooth'}); window.dispatchEvent(new Event('repoExplorerNavigation')); }, 150); }"
|
1189 |
)
|
1190 |
cancel_modal_btn.click(
|
|
|
11 |
from analyzer import combine_repo_files_for_llm, analyze_combined_file, parse_llm_json_response
|
12 |
from hf_utils import download_filtered_space_files, search_top_spaces
|
13 |
from chatbot_page import chat_with_user, extract_keywords_from_conversation
|
14 |
+
from repo_explorer import create_repo_explorer_tab, setup_repo_explorer_events, handle_load_repository
|
15 |
|
16 |
# --- Configuration ---
|
17 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
1031 |
return gr.update(visible=False), hf_url
|
1032 |
return gr.update(visible=False), ""
|
1033 |
|
1034 |
+
def handle_explore_repo(repo_id: str) -> Tuple[Any, Any, str, str, str]:
|
1035 |
+
"""Handle navigating to the repo explorer, populating the ID, and loading it."""
|
1036 |
if repo_id and repo_id.strip():
|
1037 |
+
logger.info(f"User chose to explore and load: {repo_id.strip()}")
|
1038 |
+
|
1039 |
+
# Call the repository loading function directly
|
1040 |
+
status, context = handle_load_repository(repo_id.strip())
|
1041 |
+
|
1042 |
+
return (
|
1043 |
+
gr.update(visible=False), # close modal
|
1044 |
+
gr.update(selected="repo_explorer_tab"), # switch tab
|
1045 |
+
gr.update(value=repo_id.strip()), # update input field
|
1046 |
+
status, # update status display in repo explorer
|
1047 |
+
context # update context summary state in repo explorer
|
1048 |
+
)
|
1049 |
+
|
1050 |
+
# Return empty/default updates if repo_id is invalid
|
1051 |
+
return gr.update(visible=False), gr.update(), gr.update(), "", ""
|
1052 |
|
1053 |
def handle_cancel_modal() -> Any:
|
1054 |
"""Handle closing the modal."""
|
|
|
1196 |
explore_repo_btn.click(
|
1197 |
fn=handle_explore_repo,
|
1198 |
inputs=[selected_repo_display],
|
1199 |
+
outputs=[
|
1200 |
+
repo_action_modal,
|
1201 |
+
tabs,
|
1202 |
+
repo_components["repo_explorer_input"],
|
1203 |
+
repo_components["repo_status_display"],
|
1204 |
+
repo_states["repo_context_summary"]
|
1205 |
+
],
|
1206 |
js="() => { setTimeout(() => { window.scrollTo({top: 0, behavior: 'smooth'}); window.dispatchEvent(new Event('repoExplorerNavigation')); }, 150); }"
|
1207 |
)
|
1208 |
cancel_modal_btn.click(
|