eed3c8c80c36e0876e3a737416f5ff6991cda4c9
3 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
f6c422bb14 |
feat(swift): implementeer artifact lifecycle management (E4.S2)
Epic 4 Story 2 compleet: Meerdere artifacts met open/close/switch werken!
E4.S2 - Artifact Lifecycle Management (3 SP)
- Store state: openArtifacts[], activeArtifactId
- Store actions met max 3 artifacts logica
- ArtifactArea refactor naar ArtifactContainer
- CommandCenter integration met nieuwe artifact system
Store Updates (stores/swift-store.ts):
- openArtifacts: Artifact[] — Array van open artifacts
- activeArtifactId: string | null — Currently active artifact
- Initial state: [], null
Store Actions:
```typescript
openArtifact(artifact: Omit<Artifact, 'id' | 'createdAt'>) {
// Auto-generate ID + timestamp
// Max 3 artifacts: remove oldest if at capacity
// Set new artifact as active
}
closeArtifact(id: string) {
// Filter out artifact
// Auto-switch to last remaining if closing active
}
switchArtifact(id: string) {
// Verify artifact exists
// Set activeArtifactId
}
closeAllArtifacts() {
// Clear all artifacts + active ID
}
```
Features:
- Max 3 artifacts enforced (oldest removed at capacity)
- Auto-switch when closing active artifact
- Console logging voor debugging
- ID generation met crypto.randomUUID()
- Timestamp tracking met createdAt
Components Updated:
- components/swift/artifacts/artifact-area.tsx (30 regels)
- Simplified: alleen ArtifactContainer rendering
- Props: openArtifacts, activeArtifactId, switchArtifact, closeArtifact
- components/swift/command-center/command-center.tsx
- openArtifact() i.p.v. openBlock()
- getArtifactTitle() voor dynamic titles
- Escape: closeAllArtifacts() i.p.v. closeBlock()
- Artifact opening met title generation
Integration Flow:
1. Chat: AI genereert action met artifact data
2. ChatPanel: setPendingAction(action)
3. CommandCenter: useEffect detecteert pendingAction
4. CommandCenter: getArtifactTitle(type, prefill)
5. CommandCenter: openArtifact({ type, prefill, title })
6. Store: Auto-generate ID, check max 3, add to array
7. ArtifactArea: Renders ArtifactContainer met artifacts
8. ArtifactContainer: Shows tabs (if >1), renders active block
Console Logging:
- "[Store] Max 3 artifacts reached, removing oldest"
- "[Store] Opening artifact: dagnotitie Dagnotitie - Jan"
- "[Store] Closing artifact: [id] New active: [id]"
- "[Store] Switching to artifact: [id]"
- "[Store] Cannot switch to artifact: [id] (not found)"
Build Status:
- ✅ pnpm build succesvol (geen type errors)
- Alleen bekende warnings (Supabase realtime, useCallback)
Voortgang: 56 SP / 85 SP (66%) - 18/31 stories compleet, 2 geskipt
Next: E4.S3 (Slide-in animatie) - 200ms ease-out transitions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|
|
3814189934 |
feat(swift): implementeer artifact opening from chat (E3.S6) 🎉
Epic 3 Story 6 compleet: Artifacts openen automatisch vanuit chat! 🎉 EPIC 3 COMPLEET - Medical Scribe Chat werkt end-to-end! E3.S6 - Artifact Opening from Chat (2 SP) - PendingAction state triggers artifact opening - useEffect in CommandCenter luistert naar pendingAction - Automatische block opening met prefill data - Visual flow: Chat → AI → Action → Artifact verschijnt rechts Components Updated: - components/swift/artifacts/artifact-area.tsx (86 regels) - Renders DagnotatieBlock, ZoekenBlock, OverdrachtBlock - Placeholder state wanneer geen block actief - Conditional rendering based on activeBlock state - components/swift/command-center/command-center.tsx - useEffect voor pendingAction handling - openBlock(type, prefill) aanroep - setPendingAction(null) cleanup - Console logging voor debugging Artifact Opening Flow: 1. User: "Notitie voor Jan: medicatie gegeven" 2. AI response met JSON action (confidence 0.95) 3. ChatPanel: parseActionFromResponse() 4. ChatPanel: setPendingAction(action) if confidence ≥ 0.7 5. CommandCenter: useEffect triggers op pendingAction 6. CommandCenter: openBlock('dagnotitie', { patientName: 'Jan', ... }) 7. ArtifactArea: Renders DagnotatieBlock met prefill 8. setPendingAction(null) cleanup Features: - Automatische artifact opening bij high confidence (≥0.7) - Prefill data van AI naar block (patientName, category, content, etc.) - Console logging voor debugging: - "[CommandCenter] Processing pending action: {...}" - "[CommandCenter] Opening artifact: dagnotitie with prefill: {...}" - Placeholder state met voorbeelden wanneer geen artifact actief - Overflow-y-auto voor scrollable artifacts Blocks Supported: - dagnotitie → DagnotatieBlock - zoeken → ZoekenBlock - overdracht → OverdrachtBlock - fallback → FallbackPicker Build Status: - ✅ pnpm build succesvol (geen type errors) - Alleen bekende warnings (Supabase realtime, useCallback) Epic 3 Summary (Chat API & Medical Scribe): - ✅ E3.S1 — Chat API endpoint skeleton (3 SP) - ✅ E3.S2 — Streaming response logic (5 SP) - ✅ E3.S3 — Medical scribe system prompt (3 SP) - ✅ E3.S4 — Intent detection in response (5 SP) - ❌ E3.S5 — Frontend streaming (GESKIPT - 3 SP) - ✅ E3.S6 — Artifact opening from chat (2 SP) Epic 3 Stats: 5/6 stories (18 SP), 1 geskipt (3 SP) Voortgang: 48 SP / 85 SP (56%) - 16/31 stories compleet, 2 geskipt Next Epic: E4 (Artifact Area & Tabs) - Meerdere artifacts, tabs, animaties 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
9b85448a43 |
feat(swift): implementeer intent detection & action parsing (E3.S4)
Epic 3 Story 4 compleet: AI action objects worden geparsed en gevalideerd.
E3.S4 - Intent Detection in Response (5 SP)
- Action parser met JSON extraction uit markdown code blocks
- Zod validatie voor action schema (intent, entities, confidence, artifact)
- Confidence-based artifact opening (≥0.7 threshold)
- Visual feedback met action badges in chat messages
- Console logging voor debugging
Nieuwe Components:
- lib/swift/action-parser.ts (149 regels)
- parseActionFromResponse(): Extract & validate JSON actions
- extractJsonBlock(): Regex matching voor ```json blocks
- removeJsonBlocks(): Clean text zonder JSON
- shouldOpenArtifact(): Confidence check (≥0.7)
- getConfidenceLabel(): "Zeer zeker", "Redelijk zeker", etc.
- validateArtifactType(): Intent/artifact type matching
Components Updated:
- components/swift/chat/chat-panel.tsx
- Action parsing in onDone callback
- setPendingAction voor artifact opening (E3.S6)
- Console logging: "[ChatPanel] Action detected"
- components/swift/chat/chat-message.tsx
- Action badge met Sparkles icon
- Intent label (Dagnotitie, Patiënt zoeken, Overdracht)
- CheckCircle icon voor high confidence (≥0.7)
- Confidence label display
- stores/swift-store.ts
- updateLastMessage(): Optional action parameter
- Type-safe action assignment (null/undefined handling)
Features:
- JSON extraction via regex: /```json\s*\n([\s\S]*?)\n```/
- Zod schema: type, intent, entities, confidence, artifact
- Confidence thresholds: >0.9, 0.7-0.9, 0.5-0.7, <0.5
- Visual feedback: Sparkles + CheckCircle icons
- Cleaned text content (JSON removed from display)
- Action stored in message.action en pendingAction state
Action Schema:
```typescript
{
type: "action",
intent: "dagnotitie" | "zoeken" | "overdracht" | "unknown",
entities: {
patientName?: string,
patientId?: string,
category?: "medicatie" | "adl" | "gedrag" | "incident" | "observatie",
content?: string,
query?: string
},
confidence: number, // 0-1
artifact?: {
type: BlockType,
prefill: Record<string, any>
}
}
```
Build Status:
- ✅ pnpm build succesvol (geen type errors)
- Alleen bekende warnings (Supabase realtime, useCallback)
Voortgang: 46 SP / 85 SP (54%) - E3.S4 compleet
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|