Update app.py
Browse files
app.py
CHANGED
@@ -295,23 +295,27 @@ def extract_cleaned_gemini_output(gemini_output):
|
|
295 |
"""
|
296 |
lines = gemini_output.splitlines()
|
297 |
cleaned_output = []
|
298 |
-
|
299 |
|
300 |
for line in lines:
|
301 |
line = line.strip()
|
|
|
|
|
302 |
if line.startswith("Project Summary:") or line.startswith("Functionality:"):
|
303 |
cleaned_output.append(line)
|
304 |
elif line.startswith("Functions:"):
|
305 |
cleaned_output.append(line)
|
306 |
-
|
307 |
-
elif
|
308 |
cleaned_output.append(line)
|
309 |
-
elif line.startswith("
|
310 |
-
|
|
|
311 |
|
312 |
return "\n".join(cleaned_output)
|
313 |
|
314 |
|
|
|
315 |
def split_into_chunks(content, chunk_size=1000):
|
316 |
"""Splits large content into smaller chunks."""
|
317 |
return [content[i:i + chunk_size] for i in range(0, len(content), chunk_size)]
|
|
|
295 |
"""
|
296 |
lines = gemini_output.splitlines()
|
297 |
cleaned_output = []
|
298 |
+
in_functions_section = False
|
299 |
|
300 |
for line in lines:
|
301 |
line = line.strip()
|
302 |
+
|
303 |
+
# Include only relevant sections
|
304 |
if line.startswith("Project Summary:") or line.startswith("Functionality:"):
|
305 |
cleaned_output.append(line)
|
306 |
elif line.startswith("Functions:"):
|
307 |
cleaned_output.append(line)
|
308 |
+
in_functions_section = True
|
309 |
+
elif in_functions_section and line.startswith("-public"):
|
310 |
cleaned_output.append(line)
|
311 |
+
elif in_functions_section and not line.startswith("-"):
|
312 |
+
# Exit functions section when encountering non-relevant lines
|
313 |
+
in_functions_section = False
|
314 |
|
315 |
return "\n".join(cleaned_output)
|
316 |
|
317 |
|
318 |
+
|
319 |
def split_into_chunks(content, chunk_size=1000):
|
320 |
"""Splits large content into smaller chunks."""
|
321 |
return [content[i:i + chunk_size] for i in range(0, len(content), chunk_size)]
|