Update app.py
Browse files
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
|
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 |
-
#
|
304 |
if line.startswith("Functions:"):
|
305 |
skip_section = True
|
306 |
-
|
|
|
|
|
307 |
skip_section = False
|
308 |
|
309 |
-
# Append lines
|
310 |
if not skip_section:
|
311 |
cleaned_output.append(line)
|
312 |
|
313 |
-
#
|
314 |
-
return "\n".join(
|
|
|
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 |
|