from pathlib import Path # Clean BOM for path in Path("app").rglob("*.py"): text = path.read_text(encoding="utf-8-sig") text = text.replace("\ufeff", "") path.write_text(text, encoding="utf-8") Path("app/product").mkdir(parents=True, exist_ok=True) Path("app/product/__init__.py").touch() Path("app/product/final_product_ui.py").write_text(r''' def get_home_html() -> str: return """ GraphResearcher
Document Chat + GraphRAG

Upload documents. Ask questions. Verify every answer.

GraphResearcher lets users chat with PDFs and reports using citation-grounded retrieval, graph context, source verification, graph view, and document comparison.

1. Upload
Add a document from the app sidebar. No document ID needed.
2. Chat
Ask natural questions and get source-backed answers.
3. Verify
Open sources, see page/chunk metadata, and inspect the graph.
4. Compare
Select a second document and compare them side by side.

Simple workspace

Upload, select, delete, and re-index documents from one clean UI.

Grounded answers

Answers show evidence boxes and source cards for verification.

GraphRAG inside

Graph view and graph retrieval stay available without exposing developer tools.

""" def get_product_app_html() -> str: return """ GraphResearcher App
No document selected Upload or select a document from the left sidebar.
Ready
Tip: choose a second document in the right panel to compare two documents.
""" ''', encoding="utf-8") hf_path = Path("app/deployment/hf_status.py") text = hf_path.read_text(encoding="utf-8-sig") text = text.replace("\ufeff", "") alias_block = """ # ===================================================== # Phase 38 final stable UI export # This keeps old helper functions but forces / and /app to use the clean final UI. # ===================================================== from app.product.final_product_ui import get_home_html, get_product_app_html """ if "Phase 38 final stable UI export" not in text: text += "\\n\\n" + alias_block print("Added Phase 38 final UI export alias.") else: print("Phase 38 final UI export already exists.") hf_path.write_text(text, encoding="utf-8") print("Phase 38 final UI stabilization complete.")