ข้ามไปยังเนื้อหา

Developer Overview

เอกสารนี้สรุปโครงสร้าง kobi-ai ในมุมที่ทีมพัฒนาต้องใช้จริง: route/state orchestration, scope contracts, mode runtime, BFF validation และ HITL lifecycle

flowchart LR
  subgraph UI[Next.js UI Layer]
    R[chat routes]
    UCV[UnifiedChatView]
    CP[ChatPane]
    DCL[DynamicCanvasLoader]
  end

  subgraph ORCH[Client Orchestration]
    CTX[React Contexts]
    ZS[Zustand Stores]
    HK[useUnifiedChat* / useChat*]
  end

  subgraph SVC[Client Services]
    UCS[unifiedChatService]
    CVS[canvasService / mapService]
    DBS[dashboardService]
  end

  subgraph BFF[Next.js API]
    AI["/api/ai/(all)"]
    CHAT["/api/chat/(all)"]
    CANVAS["/api/canvas/(all)"]
    MAPS["/api/maps/(all)"]
    DASH["/api/dashboard/(all)"]
    INT["/api/internal/(all)"]
  end

  R --> UCV
  UCV --> CP
  UCV --> DCL
  CP --> CTX
  DCL --> CTX
  CTX --> ZS
  ZS --> HK
  HK --> UCS
  HK --> CVS
  HK --> DBS
  UCS --> AI
  UCS --> CHAT
  CVS --> CANVAS
  CVS --> MAPS
  DBS --> DASH
  AI --> INT
  1. general: chat-only, thread-centered
  2. maps: map-first (mapId) + realtime collaboration
  3. idea: board-first (boardId) + proposal/HITL workflow
  4. strategy: board-first + framework-driven strategy_item
  5. analytics: dashboard-first (dashboardId) + pre-chat readiness gate
  • รักษา scope invariants ให้ครบทุกจุด (URL, state, API payload)
  • แยก concern ระหว่าง chat orchestration กับ workspace runtime
  • คุม compatibility fallback ให้ลดลงตาม milestone
  • ทำ integration tests ตาม critical cross-mode paths