Update app.py
Browse files
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 |
-
|
291 |
Args:
|
292 |
gemini_output (str): The raw output returned by Gemini.
|
293 |
Returns:
|
294 |
-
str: Cleaned
|
295 |
"""
|
296 |
lines = gemini_output.splitlines()
|
297 |
cleaned_output = []
|
298 |
-
|
299 |
|
300 |
for line in lines:
|
301 |
line = line.strip()
|
302 |
|
303 |
-
#
|
304 |
-
if line.startswith("
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
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 |
-
|
|
|
|
|
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 |
|