Compact UI: condensed plan, collapsible code, minimal results
Browse filesChanges:
- Plan: Show only overview + files list (not full implementation details)
- Code: Collapsible sections with <details> tags, shows line count
- Results: Compact table with cost inline in header
New output format:
## Plan Summary
[1-2 sentence overview]
Files: file1.py, file2.md
## Generated Code
βΆ file1.py (15 lines) - Click to expand
βΆ file2.md (20 lines) - Click to expand
## β
Success | Cost: $0.08
| Step | Status |
|------|--------|
| Plan | β
|
| Code | β
2 files |
| Review | β
Approved |
Files changed (2)
- Dockerfile+1-1
- chainlit_app.py+79-34
12345# HuggingFace Spaces Dockerfile for CodePilot# BUILD_VERSION: 19 (v3.4.2 reorder - Progress β Plan β Code β Result)FROM python:3.11-slim# Set working directory12345# HuggingFace Spaces Dockerfile for CodePilot# BUILD_VERSION: 20 (v3.5.0 compact-ui - condensed plan, collapsible code, compact results)FROM python:3.11-slim# Set working directory
21 unmodified lines222324252627282946 unmodified lines767778798081822 unmodified lines85868788899091929394959687 unmodified lines18418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823921 unmodified lines# ============================================================# STARTUP VERSION CHECK - Change this to detect if rebuild worked# ============================================================APP_VERSION = "3.4.2-reorder"BUILD_ID = "2024-12-20-v3"print("=" * 60)print(f"[STARTUP] CodePilot Chainlit App")print(f"[STARTUP] APP_VERSION: {APP_VERSION}")46 unmodified linesdef format_code_output(code_changes: dict) -> str:"""Format code changes as copyable markdown code blocks."""if not code_changes:return "No code changes."2 unmodified lines# Get just the filename for displayfilename = os.path.basename(file_path)lang = get_file_extension(file_path)output.append(f"### `{filename}`")output.append(f"**Full path:** `{file_path}`")output.append(f"```{lang}")output.append(content)output.append("```")output.append("")return "\n".join(output)87 unmodified linesdef format_final_result(result: dict, total_cost: float) -> str:"""Format the final result with test table and summary."""lines = []# Status headersuccess = result.get('success', False)status_icon = "β " if success else "β"lines.append(f"## Result: {status_icon} {'Success' if success else 'Failed'}\n")# Review result tablelines.append("### Review Results\n")lines.append("| Check | Result |")lines.append("|-------|--------|")if result.get('plan'):lines.append("| Plan Created | β Pass |")else:lines.append("| Plan Created | β Fail |")if result.get('code_changes'):lines.append(f"| Code Written | β Pass ({len(result['code_changes'])} files) |")else:lines.append("| Code Written | β Fail |")if result.get('review_feedback'):if success:lines.append("| Code Review | β Approved |")else:lines.append("| Code Review | β Rejected |")else:lines.append("| Code Review | β¬ Not Run |")lines.append("")# Cost summarylines.append("### Cost Summary\n")lines.append(f"**Total Cost:** ${total_cost:.4f}")lines.append(f"**Iterations:** {result.get('iterations', 'N/A')}")return "\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)21 unmodified lines222324252627282946 unmodified lines767778798081822 unmodified lines85868788899091929394959697989910010187 unmodified lines18919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328421 unmodified lines# ============================================================# STARTUP VERSION CHECK - Change this to detect if rebuild worked# ============================================================APP_VERSION = "3.5.0-compact-ui"BUILD_ID = "2024-12-20-v4"print("=" * 60)print(f"[STARTUP] CodePilot Chainlit App")print(f"[STARTUP] APP_VERSION: {APP_VERSION}")46 unmodified linesdef format_code_output(code_changes: dict) -> str:"""Format code changes as collapsible markdown code blocks."""if not code_changes:return "No code changes."2 unmodified lines# Get just the filename for displayfilename = os.path.basename(file_path)lang = get_file_extension(file_path)line_count = len(content.split('\n'))# Use collapsible details/summaryoutput.append(f"<details>")output.append(f"<summary><strong>{filename}</strong> ({line_count} lines) - Click to expand</summary>")output.append(f"")output.append(f"**Path:** `{file_path}`")output.append(f"```{lang}")output.append(content)output.append("```")output.append(f"</details>")output.append("")return "\n".join(output)87 unmodified linesdef format_final_result(result: dict, total_cost: float) -> str:"""Format the final result with compact test table."""lines = []# Status header with cost inlinesuccess = result.get('success', False)status_icon = "β " if success else "β"lines.append(f"## {status_icon} {'Success' if success else 'Failed'} | Cost: ${total_cost:.4f}\n")# Compact results tablelines.append("| Step | Status |")lines.append("|------|--------|")# Planlines.append(f"| Plan | {'β ' if result.get('plan') else 'β'} |")# Codeif result.get('code_changes'):lines.append(f"| Code | β {len(result['code_changes'])} files |")else:lines.append("| Code | β |")# Reviewif result.get('review_feedback'):lines.append(f"| Review | {'β Approved' if success else 'β Rejected'} |")else:lines.append("| Review | β¬ |")return "\n".join(lines)def format_plan_display(plan: str) -> str:"""Format a condensed version of the implementation plan."""if not plan:return ""lines = ["## Plan Summary\n"]# Extract just the overview and files from the planplan_lines = plan.split('\n')in_overview = Falsein_files = Falseoverview_text = []files_list = []for line in plan_lines:line_lower = line.lower().strip()# Detect sectionsif 'overview' in line_lower and ('#' in line or line_lower.startswith('overview')):in_overview = Truein_files = Falsecontinueelif 'files to' in line_lower or 'files:' in line_lower:in_overview = Falsein_files = Truecontinueelif line.startswith('#') or line.startswith('==='):in_overview = Falsein_files = Falsecontinue# Collect contentif in_overview and line.strip():overview_text.append(line.strip())elif in_files and line.strip():# Extract file paths or namesif '/' in line or '.py' in line or '.md' in line or '.html' in line:# Clean up the line to get just the filenameclean_line = line.strip().lstrip('-').lstrip('*').lstrip('1234567890.').strip()if clean_line:files_list.append(clean_line)# Build condensed outputif overview_text:lines.append(' '.join(overview_text[:2])) # First 2 sentences maxlines.append("")if files_list:lines.append("**Files to create/modify:**")for f in files_list[:5]: # Max 5 files# Extract just filename from pathfilename = os.path.basename(f.split()[0]) if f else flines.append(f"- `{filename}`")if len(files_list) > 5:lines.append(f"- ... and {len(files_list) - 5} more")else:# Fallback: just show first 3 lines of planlines.append(plan_lines[0] if plan_lines else "Plan created.")lines.append("")return "\n".join(lines)
Dockerfile+1-1
chainlit_app.py+79-34