# Prompt Sprint 3 - Chat Functionality ## 🎯 Sprint 3: Chat Functionality **Iniziato**: 2026-04-06 **Stato**: 🟑 In Progress **Assegnato**: @sprint-lead --- ## πŸ“‹ Obiettivo Implementare la funzionalitΓ  di chat per interrogare le fonti dei notebook. Gli utenti potranno inviare messaggi e ricevere risposte basate sulle fonti caricate. --- ## πŸ—οΈ Architettura ### Pattern (stesso di Sprint 1 & 2) ``` API Layer (FastAPI Routes) ↓ Service Layer (ChatService) ↓ External Layer (notebooklm-py client) ``` ### Endpoints da implementare 1. **POST /api/v1/notebooks/{id}/chat** - Inviare messaggio 2. **GET /api/v1/notebooks/{id}/chat/history** - Ottenere storico chat 3. **POST /api/v1/notebooks/{id}/chat/save** - Salvare risposta come nota (v2) --- ## πŸ“Š Task Breakdown Sprint 3 ### Fase 1: Specifiche - [ ] SPEC-006: Analisi requisiti Chat - [ ] Definire flusso conversazione - [ ] Definire formato messaggi ### Fase 2: API Design - [ ] API-005: Modelli Pydantic (ChatMessage, ChatRequest, ChatResponse) - [ ] Documentazione endpoints chat ### Fase 3: Implementazione - [ ] DEV-012: ChatService - [ ] DEV-013: POST /chat - [ ] DEV-014: GET /chat/history ### Fase 4: Testing - [ ] TEST-006: Unit tests ChatService - [ ] TEST-007: Integration tests chat API --- ## πŸ”§ Implementazione ### ChatService Methods ```python class ChatService: async def send_message( notebook_id: UUID, message: str, include_references: bool = True ) -> ChatResponse: """Send message and get response.""" async def get_history(notebook_id: UUID) -> list[ChatMessage]: """Get chat history for notebook.""" ``` ### Modelli ```python class ChatRequest(BaseModel): message: str include_references: bool = True class ChatResponse(BaseModel): message: str sources: list[SourceReference] timestamp: datetime class ChatMessage(BaseModel): id: UUID role: str # "user" | "assistant" content: str timestamp: datetime sources: list[SourceReference] | None ``` --- ## πŸš€ Prossimi Passi 1. @sprint-lead: Attivare @api-designer per API-005 2. @api-designer: Definire modelli chat 3. @tdd-developer: Iniziare implementazione ChatService --- **Dipende da**: Sprint 2 (Source Management) βœ… **Blocca**: Sprint 4 (Content Generation) πŸ”΄