Update app.py
Browse files
app.py
CHANGED
@@ -402,7 +402,7 @@ def create_ui() -> gr.Blocks:
|
|
402 |
df_output = gr.Dataframe(
|
403 |
headers=["Repository", "Strengths", "Weaknesses", "Speciality", "Relevance"],
|
404 |
wrap=True,
|
405 |
-
interactive=
|
406 |
)
|
407 |
|
408 |
# --- Chatbot Tab ---
|
@@ -587,22 +587,35 @@ def create_ui() -> gr.Blocks:
|
|
587 |
|
588 |
def handle_dataframe_select(evt: gr.SelectData, df_data) -> Tuple[str, Any]:
|
589 |
"""Handle dataframe row selection and navigate to repo explorer."""
|
590 |
-
|
|
|
|
|
|
|
|
|
|
|
591 |
return "", gr.update()
|
592 |
|
593 |
try:
|
594 |
-
# Get the selected row
|
595 |
-
|
|
|
|
|
596 |
|
597 |
-
#
|
598 |
-
|
599 |
-
|
|
|
|
|
600 |
|
601 |
-
#
|
602 |
-
|
603 |
-
|
|
|
|
|
|
|
604 |
|
605 |
except Exception as e:
|
|
|
606 |
logger.error(f"Error handling dataframe selection: {e}")
|
607 |
|
608 |
return "", gr.update()
|
|
|
402 |
df_output = gr.Dataframe(
|
403 |
headers=["Repository", "Strengths", "Weaknesses", "Speciality", "Relevance"],
|
404 |
wrap=True,
|
405 |
+
interactive=False # Prevent editing but allow selection
|
406 |
)
|
407 |
|
408 |
# --- Chatbot Tab ---
|
|
|
587 |
|
588 |
def handle_dataframe_select(evt: gr.SelectData, df_data) -> Tuple[str, Any]:
|
589 |
"""Handle dataframe row selection and navigate to repo explorer."""
|
590 |
+
print(f"DEBUG: Selection event triggered!")
|
591 |
+
print(f"DEBUG: evt = {evt}")
|
592 |
+
print(f"DEBUG: df_data type = {type(df_data)}")
|
593 |
+
print(f"DEBUG: df_data = {df_data}")
|
594 |
+
|
595 |
+
if evt is None:
|
596 |
return "", gr.update()
|
597 |
|
598 |
try:
|
599 |
+
# Get the selected row and column from the event
|
600 |
+
row_idx = evt.index[0]
|
601 |
+
col_idx = evt.index[1]
|
602 |
+
print(f"DEBUG: Selected row {row_idx}, column {col_idx}")
|
603 |
|
604 |
+
# We want to navigate regardless of which column was clicked
|
605 |
+
# Get the repository ID from the first column (index 0) of the selected row
|
606 |
+
if isinstance(df_data, list) and len(df_data) > row_idx:
|
607 |
+
repo_id = df_data[row_idx][0] if len(df_data[row_idx]) > 0 else ""
|
608 |
+
print(f"DEBUG: Extracted repo_id = '{repo_id}'")
|
609 |
|
610 |
+
# Only proceed if we actually have a repository ID
|
611 |
+
if repo_id and repo_id.strip():
|
612 |
+
logger.info(f"Navigating to repo explorer for repository: {repo_id}")
|
613 |
+
return repo_id.strip(), gr.update(selected="repo_explorer_tab")
|
614 |
+
else:
|
615 |
+
print(f"DEBUG: df_data is not a list or row_idx {row_idx} out of range")
|
616 |
|
617 |
except Exception as e:
|
618 |
+
print(f"DEBUG: Exception occurred: {e}")
|
619 |
logger.error(f"Error handling dataframe selection: {e}")
|
620 |
|
621 |
return "", gr.update()
|