Spaces:
Sleeping
Sleeping
Update repo_explorer.py
Browse files- repo_explorer.py +5 -5
repo_explorer.py
CHANGED
|
@@ -321,10 +321,10 @@ def generate_repo_link_html(repo_id: str) -> str:
|
|
| 321 |
'''
|
| 322 |
return html_link
|
| 323 |
|
| 324 |
-
def handle_load_repository_with_vectorization(repo_id: str) -> Tuple[str, str,
|
| 325 |
"""Load repository and create both context summary and vector embeddings."""
|
| 326 |
if not repo_id.strip():
|
| 327 |
-
return "Status: Please enter a repository ID.", "", ""
|
| 328 |
|
| 329 |
try:
|
| 330 |
logger.info(f"Loading repository with vectorization: {repo_id}")
|
|
@@ -336,7 +336,7 @@ def handle_load_repository_with_vectorization(repo_id: str) -> Tuple[str, str, s
|
|
| 336 |
except Exception as e:
|
| 337 |
logger.error(f"Error downloading repository {repo_id}: {e}")
|
| 338 |
error_status = f"β Error downloading repository: {e}"
|
| 339 |
-
return error_status, "", ""
|
| 340 |
|
| 341 |
# Read the combined content
|
| 342 |
with open(combined_text_path, "r", encoding="utf-8") as f:
|
|
@@ -359,12 +359,12 @@ def handle_load_repository_with_vectorization(repo_id: str) -> Tuple[str, str, s
|
|
| 359 |
repo_link_html = generate_repo_link_html(repo_id)
|
| 360 |
|
| 361 |
logger.info(f"Repository {repo_id} loaded and processed successfully")
|
| 362 |
-
return status, context_summary, repo_link_html
|
| 363 |
|
| 364 |
except Exception as e:
|
| 365 |
logger.error(f"Error loading repository {repo_id}: {e}")
|
| 366 |
error_status = f"β Error loading repository: {e}"
|
| 367 |
-
return error_status, "", ""
|
| 368 |
|
| 369 |
def initialize_repo_chatbot(repo_status: str, repo_id: str, repo_context_summary: str) -> List[Dict[str, str]]:
|
| 370 |
"""Initialize the repository chatbot with a welcome message after successful repo loading."""
|
|
|
|
| 321 |
'''
|
| 322 |
return html_link
|
| 323 |
|
| 324 |
+
def handle_load_repository_with_vectorization(repo_id: str) -> Tuple[str, str, gr.HTML]:
|
| 325 |
"""Load repository and create both context summary and vector embeddings."""
|
| 326 |
if not repo_id.strip():
|
| 327 |
+
return "Status: Please enter a repository ID.", "", gr.HTML(value="", visible=False)
|
| 328 |
|
| 329 |
try:
|
| 330 |
logger.info(f"Loading repository with vectorization: {repo_id}")
|
|
|
|
| 336 |
except Exception as e:
|
| 337 |
logger.error(f"Error downloading repository {repo_id}: {e}")
|
| 338 |
error_status = f"β Error downloading repository: {e}"
|
| 339 |
+
return error_status, "", gr.HTML(value="", visible=False)
|
| 340 |
|
| 341 |
# Read the combined content
|
| 342 |
with open(combined_text_path, "r", encoding="utf-8") as f:
|
|
|
|
| 359 |
repo_link_html = generate_repo_link_html(repo_id)
|
| 360 |
|
| 361 |
logger.info(f"Repository {repo_id} loaded and processed successfully")
|
| 362 |
+
return status, context_summary, gr.HTML(value=repo_link_html, visible=True)
|
| 363 |
|
| 364 |
except Exception as e:
|
| 365 |
logger.error(f"Error loading repository {repo_id}: {e}")
|
| 366 |
error_status = f"β Error loading repository: {e}"
|
| 367 |
+
return error_status, "", gr.HTML(value="", visible=False)
|
| 368 |
|
| 369 |
def initialize_repo_chatbot(repo_status: str, repo_id: str, repo_context_summary: str) -> List[Dict[str, str]]:
|
| 370 |
"""Initialize the repository chatbot with a welcome message after successful repo loading."""
|