Phase 1: Diagnosis
Phase 1: Diagnosis
Section titled “Phase 1: Diagnosis”Phase 1 is the first analytical step after the initial chat (Phase 0). It presents an interactive diagnosis card that captures the user’s legal situation and enriches it with context from the Valter API.
What Happens
Section titled “What Happens”- User describes their legal question in the Composer
- Intent detection identifies a case analysis need
- A
diagnosisblock appears with pre-filled fields extracted from the query - User edits and refines the fields (situation, legal area, theme, thesis)
- User selects their situation (researching, evaluating, acting, or studying)
- System calls Valter
/v1/retrievefor initial context enrichment action_promptblocks suggest next steps- Phase 2 becomes available
Block Types Produced
Section titled “Block Types Produced”| Block Type | Purpose |
|---|---|
diagnosis | Main card with editable fields: situation description, legal area, theme, thesis |
action_prompt | Interactive buttons for situation selection and additional context |
Server Actions
Section titled “Server Actions”// Update diagnosis fieldsupdateDiagnosis(sessionId: string, fields: Partial<DiagnosisFields>) → Returns: BriefingFlowState
// Select user situation (determines Phase 4 delivery mode)chooseSituation(sessionId: string, situation: Situation) → Returns: { state: BriefingFlowState, phase2Blocks: Block[] }
// Add context informationaddAdditionalContext(sessionId: string, text: string) → Returns: BriefingFlowStateValter API Integration
Section titled “Valter API Integration”Phase 1 calls Valter to enrich the diagnosis with relevant context:
| Endpoint | Purpose |
|---|---|
/v1/retrieve | Search for initial precedents matching the legal area and theme |
🚧 Planned Feature — The Valter integration for Phase 1 is being implemented as part of v0.3 (adapter layer) and v0.4 (briefing phases).
Situation Selection
Section titled “Situation Selection”The situation selection in Phase 1 is critical because it cascades to Phase 4:
| Selection | Label | Meaning | Phase 4 Output |
|---|---|---|---|
pesquisando | Researching | Gathering information | Síntese (Synthesis) |
avaliando | Evaluating | Analyzing a specific case | Parecer (Opinion) |
atuando | Acting | Taking legal action | Estratégia (Strategy) |
estudando | Studying | Academic study | Mapa (Map) |