naman1102 commited on
Commit
083f41a
·
1 Parent(s): ed3bc48

deployment

Browse files
Files changed (4) hide show
  1. analyzer.py +1 -7
  2. app.py +1 -13
  3. chatbot_page.py +0 -3
  4. hf_utils.py +0 -2
analyzer.py CHANGED
@@ -318,13 +318,7 @@ def analyze_combined_file(output_file="combined_repo.txt", user_requirements: st
318
  analysis = analyze_code_chunk(chunk, user_requirements)
319
  chunk_jsons.append(analysis)
320
  final_summary = aggregate_chunk_analyses(chunk_jsons, user_requirements)
321
- debug_output = (
322
- "==== Chunk JSON Outputs ===="
323
- + "\n\n".join([f"Chunk {i+1} JSON:\n{chunk_jsons[i]}" for i in range(len(chunk_jsons))])
324
- + "\n\n==== Final Aggregated Summary ===="
325
- + f"\n{final_summary}"
326
- )
327
- return debug_output
328
  except Exception as e:
329
  return f"Error analyzing combined file: {e}"
330
 
 
318
  analysis = analyze_code_chunk(chunk, user_requirements)
319
  chunk_jsons.append(analysis)
320
  final_summary = aggregate_chunk_analyses(chunk_jsons, user_requirements)
321
+ return final_summary
 
 
 
 
 
 
322
  except Exception as e:
323
  return f"Error analyzing combined file: {e}"
324
 
app.py CHANGED
@@ -1046,10 +1046,6 @@ def create_ui() -> gr.Blocks:
1046
 
1047
  def handle_dataframe_select(evt: gr.SelectData, df_data) -> Tuple[str, Any, str]:
1048
  """Handle dataframe row selection - show modal for repo ID (column 0) clicks."""
1049
- print(f"DEBUG: Selection event triggered!")
1050
- print(f"DEBUG: evt = {evt}")
1051
- print(f"DEBUG: df_data type = {type(df_data)}")
1052
-
1053
  if evt is None:
1054
  return "", gr.update(visible=False), ""
1055
 
@@ -1057,14 +1053,12 @@ def create_ui() -> gr.Blocks:
1057
  # Get the selected row and column from the event
1058
  row_idx = evt.index[0]
1059
  col_idx = evt.index[1]
1060
- print(f"DEBUG: Selected row {row_idx}, column {col_idx}")
1061
 
1062
  # Handle pandas DataFrame
1063
  if isinstance(df_data, pd.DataFrame) and not df_data.empty and row_idx < len(df_data):
1064
 
1065
  if col_idx == 0: # Repository name column - show action modal
1066
  repo_id = df_data.iloc[row_idx, 0]
1067
- print(f"DEBUG: Extracted repo_id = '{repo_id}'")
1068
 
1069
  if repo_id and str(repo_id).strip() and str(repo_id).strip() != 'nan':
1070
  clean_repo_id = str(repo_id).strip()
@@ -1073,13 +1067,9 @@ def create_ui() -> gr.Blocks:
1073
 
1074
  # For content columns (1,2,3) and relevance (4), do nothing since full text is shown directly
1075
  else:
1076
- print(f"DEBUG: Clicked on column {col_idx}, full text already shown in table")
1077
  return "", gr.update(visible=False), ""
1078
- else:
1079
- print(f"DEBUG: df_data is not a DataFrame or row_idx {row_idx} out of range")
1080
 
1081
  except Exception as e:
1082
- print(f"DEBUG: Exception occurred: {e}")
1083
  logger.error(f"Error handling dataframe selection: {e}")
1084
 
1085
  return "", gr.update(visible=False), ""
@@ -1094,7 +1084,6 @@ def create_ui() -> gr.Blocks:
1094
 
1095
  def handle_explore_repo(selected_repo_id: str) -> Tuple[Any, Any, Any, str, str]:
1096
  """Handle navigating to the repo explorer and automatically load the repository."""
1097
- logger.info(f"DEBUG: handle_explore_repo called with selected_repo_id: '{selected_repo_id}'")
1098
 
1099
  if selected_repo_id and selected_repo_id.strip() and selected_repo_id.strip() != 'nan':
1100
  clean_repo_id = selected_repo_id.strip()
@@ -1518,7 +1507,6 @@ def create_ui() -> gr.Blocks:
1518
  status_box_input # Use for auto-load signal
1519
  ],
1520
  js="""(repo_id) => {
1521
- console.log('DEBUG: Navigate to repo explorer for:', repo_id);
1522
  setTimeout(() => {
1523
  window.scrollTo({top: 0, behavior: 'smooth'});
1524
  }, 200);
@@ -1563,4 +1551,4 @@ def create_ui() -> gr.Blocks:
1563
 
1564
  if __name__ == "__main__":
1565
  app = create_ui()
1566
- app.launch(debug=True)
 
1046
 
1047
  def handle_dataframe_select(evt: gr.SelectData, df_data) -> Tuple[str, Any, str]:
1048
  """Handle dataframe row selection - show modal for repo ID (column 0) clicks."""
 
 
 
 
1049
  if evt is None:
1050
  return "", gr.update(visible=False), ""
1051
 
 
1053
  # Get the selected row and column from the event
1054
  row_idx = evt.index[0]
1055
  col_idx = evt.index[1]
 
1056
 
1057
  # Handle pandas DataFrame
1058
  if isinstance(df_data, pd.DataFrame) and not df_data.empty and row_idx < len(df_data):
1059
 
1060
  if col_idx == 0: # Repository name column - show action modal
1061
  repo_id = df_data.iloc[row_idx, 0]
 
1062
 
1063
  if repo_id and str(repo_id).strip() and str(repo_id).strip() != 'nan':
1064
  clean_repo_id = str(repo_id).strip()
 
1067
 
1068
  # For content columns (1,2,3) and relevance (4), do nothing since full text is shown directly
1069
  else:
 
1070
  return "", gr.update(visible=False), ""
 
 
1071
 
1072
  except Exception as e:
 
1073
  logger.error(f"Error handling dataframe selection: {e}")
1074
 
1075
  return "", gr.update(visible=False), ""
 
1084
 
1085
  def handle_explore_repo(selected_repo_id: str) -> Tuple[Any, Any, Any, str, str]:
1086
  """Handle navigating to the repo explorer and automatically load the repository."""
 
1087
 
1088
  if selected_repo_id and selected_repo_id.strip() and selected_repo_id.strip() != 'nan':
1089
  clean_repo_id = selected_repo_id.strip()
 
1507
  status_box_input # Use for auto-load signal
1508
  ],
1509
  js="""(repo_id) => {
 
1510
  setTimeout(() => {
1511
  window.scrollTo({top: 0, behavior: 'smooth'});
1512
  }, 200);
 
1551
 
1552
  if __name__ == "__main__":
1553
  app = create_ui()
1554
+ app.launch(debug=False)
chatbot_page.py CHANGED
@@ -39,7 +39,6 @@ def chat_with_user(user_message, history):
39
 
40
  # Function to end chat and extract keywords
41
  def extract_keywords_from_conversation(history):
42
- print("Extracting keywords from conversation...")
43
  from openai import OpenAI
44
  client = OpenAI(api_key=os.getenv("modal_api"))
45
  client.base_url = os.getenv("base_url")
@@ -65,8 +64,6 @@ def extract_keywords_from_conversation(history):
65
  max_tokens=64,
66
  temperature=0.3
67
  )
68
- print("Response received from OpenAI...")
69
- print(response.choices[0].message.content)
70
  keywords = response.choices[0].message.content.strip()
71
  return keywords
72
 
 
39
 
40
  # Function to end chat and extract keywords
41
  def extract_keywords_from_conversation(history):
 
42
  from openai import OpenAI
43
  client = OpenAI(api_key=os.getenv("modal_api"))
44
  client.base_url = os.getenv("base_url")
 
64
  max_tokens=64,
65
  temperature=0.3
66
  )
 
 
67
  keywords = response.choices[0].message.content.strip()
68
  return keywords
69
 
hf_utils.py CHANGED
@@ -37,8 +37,6 @@ def download_filtered_space_files(space_id: str, local_dir: str = "repo_files",
37
  for root, _, files in os.walk(local_dir):
38
  for file in files:
39
  if any(file.endswith(ext) for ext in file_extensions):
40
- rel_path = os.path.relpath(os.path.join(root, file), local_dir)
41
- print(f"DEBUG: Downloaded file: {rel_path}")
42
  copied_files += 1
43
 
44
  print(f"Downloaded {copied_files} filtered file(s) to: {local_dir}")
 
37
  for root, _, files in os.walk(local_dir):
38
  for file in files:
39
  if any(file.endswith(ext) for ext in file_extensions):
 
 
40
  copied_files += 1
41
 
42
  print(f"Downloaded {copied_files} filtered file(s) to: {local_dir}")