JSenkCC commited on
Commit
147c129
·
verified ·
1 Parent(s): 1b0d970

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -20
app.py CHANGED
@@ -287,38 +287,32 @@ def identify_required_functions(project_path, functionality_description):
287
 
288
  def extract_cleaned_gemini_output(gemini_output):
289
  """
290
- Extracts and formats the cleaned output from Gemini to send to Qwen or display to the user.
291
  Args:
292
  gemini_output (str): The raw output returned by Gemini.
293
  Returns:
294
- str: Cleaned and formatted output.
295
  """
296
  lines = gemini_output.splitlines()
297
  cleaned_output = []
298
- capture = False # Flag to determine whether to capture the lines
299
 
300
  for line in lines:
301
  line = line.strip()
302
 
303
- # Start capturing from "Project Summary:" and include only relevant sections
304
- if line.startswith("Project Summary:"):
305
- capture = True
306
- cleaned_output.append(line)
307
- elif line.startswith("Functionality:") or line.startswith("Functionality Flow:"):
308
- cleaned_output.append(line)
309
- elif line.startswith("Function Documentation:"):
310
- cleaned_output.append(line)
311
- elif line.startswith("Functions:"):
312
- capture = True # Start capturing function definitions
313
  cleaned_output.append(line)
314
- elif capture:
315
- # Capture relevant content under active sections
316
- if line.startswith("-public") or line.startswith("-private"):
317
- cleaned_output.append(line)
318
- elif not line: # Stop capturing on empty lines after a valid section
319
- capture = False
320
 
321
- return "\n".join(cleaned_output)
 
 
322
 
323
 
324
 
 
287
 
288
  def extract_cleaned_gemini_output(gemini_output):
289
  """
290
+ Removes the 'Functions' section from Gemini output and cleans irrelevant content.
291
  Args:
292
  gemini_output (str): The raw output returned by Gemini.
293
  Returns:
294
+ str: Cleaned output without the 'Functions' section.
295
  """
296
  lines = gemini_output.splitlines()
297
  cleaned_output = []
298
+ skip_section = False
299
 
300
  for line in lines:
301
  line = line.strip()
302
 
303
+ # Skip the "Functions" section entirely
304
+ if line.startswith("Functions:"):
305
+ skip_section = True
306
+ elif skip_section and line.startswith("Project Summary:"):
307
+ skip_section = False
308
+
309
+ # Append lines that are not part of the skipped section
310
+ if not skip_section:
 
 
311
  cleaned_output.append(line)
 
 
 
 
 
 
312
 
313
+ # Filter out any additional blank lines for cleaner formatting
314
+ return "\n".join([line for line in cleaned_output if line])
315
+
316
 
317
 
318