Show implementation plan before generated code
Browse files- Display plan section after result table, before code
- Plan is shown for both new tasks and resume flows
- Helps users understand what was planned before seeing code
Files changed (2)
- Dockerfile+1-1
- chainlit_app.py+25-8
12345# HuggingFace Spaces Dockerfile for CodePilot# BUILD_VERSION: 17 (v3.4.0 clean-ui - clean progress display, copyable code, results table)FROM python:3.11-slim# Set working directory12345# HuggingFace Spaces Dockerfile for CodePilot# BUILD_VERSION: 18 (v3.4.1 show-plan - display implementation plan before code)FROM python:3.11-slim# Set working directory
21 unmodified lines222324252627282976 unmodified lines106107108109110111112 unmodified lines224225226227228229142 unmodified lines37237337437537637737888 unmodified lines46746846947047147247347447547647747847948021 unmodified lines# ============================================================# STARTUP VERSION CHECK - Change this to detect if rebuild worked# ============================================================APP_VERSION = "3.4.0-clean-ui"BUILD_ID = "2024-12-20-v1"print("=" * 60)print(f"[STARTUP] CodePilot Chainlit App")print(f"[STARTUP] APP_VERSION: {APP_VERSION}")76 unmodified lines'reviewer_done': False,'approved': None,'tools_called': [],}for line in logs.split('\n'):112 unmodified linesreturn "\n".join(lines)@cl.on_chat_startasync def start():"""Initialize the agent system when chat starts."""142 unmodified lines# Show final resultawait cl.Message(content=format_final_result(result, total_cost)).send()# Show code if anyif result.get('code_changes'):await cl.Message(content="## Generated Code\n\n" + format_code_output(result['code_changes'])).send()return88 unmodified lines# Show final resultawait cl.Message(content=format_final_result(result, total_cost)).send()# Show generated codeif result.get('code_changes'):await cl.Message(content="## Generated Code\n\n" + format_code_output(result['code_changes'])).send()# Show plan if availableif result.get('plan') and not result.get('code_changes'):await cl.Message(content=f"## Plan\n\n{result['plan']}").send()if __name__ == "__main__":sys.exit("Run with: chainlit run chainlit_app.py")21 unmodified lines222324252627282976 unmodified lines106107108109110111112112 unmodified lines225226227228229230231232233234235236237238239240241242142 unmodified lines38538638738838939039139239339439588 unmodified lines48448548648748848949049149249349449549649721 unmodified lines# ============================================================# STARTUP VERSION CHECK - Change this to detect if rebuild worked# ============================================================APP_VERSION = "3.4.1-show-plan"BUILD_ID = "2024-12-20-v2"print("=" * 60)print(f"[STARTUP] CodePilot Chainlit App")print(f"[STARTUP] APP_VERSION: {APP_VERSION}")76 unmodified lines'reviewer_done': False,'approved': None,'tools_called': [],'plan_preview': None,}for line in logs.split('\n'):112 unmodified linesreturn "\n".join(lines)def format_plan_display(plan: str) -> str:"""Format the implementation plan for display."""if not plan:return ""lines = ["## Implementation Plan\n"]lines.append(plan)lines.append("")return "\n".join(lines)@cl.on_chat_startasync def start():"""Initialize the agent system when chat starts."""142 unmodified lines# Show final resultawait cl.Message(content=format_final_result(result, total_cost)).send()# Show plan firstif result.get('plan'):await cl.Message(content=format_plan_display(result['plan'])).send()# Then show codeif result.get('code_changes'):await cl.Message(content="## Generated Code\n\n" + format_code_output(result['code_changes'])).send()return88 unmodified lines# Show final resultawait cl.Message(content=format_final_result(result, total_cost)).send()# Show plan firstif result.get('plan'):await cl.Message(content=format_plan_display(result['plan'])).send()# Then show generated codeif result.get('code_changes'):await cl.Message(content="## Generated Code\n\n" + format_code_output(result['code_changes'])).send()if __name__ == "__main__":sys.exit("Run with: chainlit run chainlit_app.py")
Dockerfile+1-1
chainlit_app.py+25-8