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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -287,7 +287,7 @@ def identify_required_functions(project_path, functionality_description):
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:
@@ -300,18 +300,21 @@ def extract_cleaned_gemini_output(gemini_output):
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
 
 
287
 
288
  def extract_cleaned_gemini_output(gemini_output):
289
  """
290
+ Removes the 'Functions' section and any irrelevant content from the Gemini output.
291
  Args:
292
  gemini_output (str): The raw output returned by Gemini.
293
  Returns:
 
300
  for line in lines:
301
  line = line.strip()
302
 
303
+ # Detect the start of the "Functions:" section and skip it
304
  if line.startswith("Functions:"):
305
  skip_section = True
306
+
307
+ # Detect the end of the "Functions:" section and resume processing
308
+ if skip_section and (line.startswith("Tasks:") or line.startswith("Project Summary:")):
309
  skip_section = False
310
 
311
+ # Append lines outside the skipped section
312
  if not skip_section:
313
  cleaned_output.append(line)
314
 
315
+ # Return the cleaned output with blank lines filtered out
316
+ return "\n".join(line for line in cleaned_output if line)
317
+
318
 
319
 
320