Update app.py
Browse files
app.py
CHANGED
@@ -422,10 +422,10 @@ def process_gemini_output(output):
|
|
422 |
return "\n".join(processed_lines)
|
423 |
|
424 |
def generate_documentation_page():
|
425 |
-
# Sidebar with "Log Out" and "Back to
|
426 |
st.sidebar.title(f"Project: {st.session_state.current_project}")
|
427 |
-
if st.sidebar.button("Back to
|
428 |
-
st.session_state.page = "
|
429 |
st.rerun()
|
430 |
if st.sidebar.button("Log Out"):
|
431 |
st.session_state.authenticated = False
|
@@ -486,16 +486,17 @@ def generate_documentation_page():
|
|
486 |
pdf_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.pdf")
|
487 |
markdown_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.md")
|
488 |
|
489 |
-
#
|
490 |
pdf_generated = os.path.exists(pdf_path)
|
491 |
markdown_generated = os.path.exists(markdown_path)
|
492 |
|
493 |
-
#
|
494 |
if not pdf_generated:
|
495 |
if st.button("Generate PDF"):
|
496 |
try:
|
497 |
generate_pdf(documentation, pdf_path)
|
498 |
-
st.
|
|
|
499 |
except Exception as e:
|
500 |
st.error(f"Failed to generate PDF: {e}")
|
501 |
else:
|
@@ -514,7 +515,8 @@ def generate_documentation_page():
|
|
514 |
if st.button("Generate Markdown File"):
|
515 |
try:
|
516 |
generate_markdown_file(documentation, markdown_path)
|
517 |
-
st.
|
|
|
518 |
except Exception as e:
|
519 |
st.error(f"Failed to generate Markdown file: {e}")
|
520 |
else:
|
|
|
422 |
return "\n".join(processed_lines)
|
423 |
|
424 |
def generate_documentation_page():
|
425 |
+
# Sidebar with "Log Out" and "Back to Project" buttons
|
426 |
st.sidebar.title(f"Project: {st.session_state.current_project}")
|
427 |
+
if st.sidebar.button("Back to Project"):
|
428 |
+
st.session_state.page = "project_view"
|
429 |
st.rerun()
|
430 |
if st.sidebar.button("Log Out"):
|
431 |
st.session_state.authenticated = False
|
|
|
486 |
pdf_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.pdf")
|
487 |
markdown_path = os.path.join(user_folder, f"{st.session_state.current_project}_Documentation.md")
|
488 |
|
489 |
+
# Show appropriate buttons based on file generation status
|
490 |
pdf_generated = os.path.exists(pdf_path)
|
491 |
markdown_generated = os.path.exists(markdown_path)
|
492 |
|
493 |
+
# Generate and replace buttons dynamically
|
494 |
if not pdf_generated:
|
495 |
if st.button("Generate PDF"):
|
496 |
try:
|
497 |
generate_pdf(documentation, pdf_path)
|
498 |
+
st.session_state.pdf_generated = True # Set a flag for PDF generation
|
499 |
+
st.experimental_rerun() # Trigger a rerun to show the download button
|
500 |
except Exception as e:
|
501 |
st.error(f"Failed to generate PDF: {e}")
|
502 |
else:
|
|
|
515 |
if st.button("Generate Markdown File"):
|
516 |
try:
|
517 |
generate_markdown_file(documentation, markdown_path)
|
518 |
+
st.session_state.markdown_generated = True # Set a flag for Markdown generation
|
519 |
+
st.experimental_rerun() # Trigger a rerun to show the download button
|
520 |
except Exception as e:
|
521 |
st.error(f"Failed to generate Markdown file: {e}")
|
522 |
else:
|