Persist Atlas chat history; fix re-greeting on refresh

- GET /api/projects/[id]/atlas-chat returns stored user+assistant messages
- POST handles __atlas_init__ trigger: runs once when no history exists,
  not stored as a user turn so Atlas intro appears cleanly
- Rewrite AtlasChat.tsx: fully self-contained component with own message
  state; loads history from DB on mount, only greets on first open
- Remove assistant-ui runtime dependency for message persistence
- Add Vision & Success Metrics, Integrations & Dependencies, Open Questions
  to PRD section tracker (now 12 sections matching the PDF)

Made-with: Cursor
This commit is contained in:
2026-03-02 16:55:10 -08:00
parent 9fc643f9b6
commit 0146ae7df6
3 changed files with 313 additions and 68 deletions

View File

@@ -6,13 +6,16 @@ import { useParams } from "next/navigation";
const PRD_SECTIONS = [
{ id: "executive_summary", label: "Executive Summary" },
{ id: "problem_statement", label: "Problem Statement" },
{ id: "vision_metrics", label: "Vision & Success Metrics" },
{ id: "users_personas", label: "Users & Personas" },
{ id: "user_flows", label: "User Flows" },
{ id: "feature_requirements", label: "Feature Requirements" },
{ id: "screen_specs", label: "Screen Specs" },
{ id: "business_model", label: "Business Model" },
{ id: "integrations", label: "Integrations & Dependencies" },
{ id: "non_functional", label: "Non-Functional Reqs" },
{ id: "risks", label: "Risks" },
{ id: "risks", label: "Risks & Mitigations" },
{ id: "open_questions", label: "Open Questions" },
];
interface PRDSection {