flowchart TD
A[User query] --> B[Frontend chat UI choose mode]
B --> C[nlq_plan]
subgraph API_FastAPI
C[nlq_plan]
D[nlq_execute]
E[nlq_history]
F[chroma_package]
G[chroma_upsert]
end
C --> H[Generate SQL draft with RAG and rules]
H --> I[Check schema and nonempty tables in Postgres]
I --> J[Validate and guard SQL]
J --> K[Insert plan log portal_nlq_history]
K --> F
B --> D
D --> L[Run SQL on Postgres]
L --> M[Result rows and stats]
M --> N[Metabase embed in UI]
M --> K
A --> O[User comment]
O --> E
E --> K
F --> P[Build doc_text and meta diff outcome]
P --> Q[Upsert to portal_chroma_doc queued]
Q --> G
G --> R[ChromaDB nlq_history collection]
R --> C
N --> S[Output SQL or chart or explain or all]
S --> B
classDef api fill:#e9f2ff,stroke:#1f5fff,stroke-width:1.2px;
class C,D,E,F,G api;
コメントを残す