File size: 1,395 Bytes
d309047
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from fastapi import APIRouter, HTTPException
from services.session_store import get_session
from services.ollama_client import generate_digest
from ml.rag import clear_store

router = APIRouter()

@router.get("/{session_id}/digest")
async def get_digest(session_id: str):
    """Generate a post-meeting digest from the full session."""
    session = get_session(session_id)
    if not session:
        raise HTTPException(status_code=404, detail="Session not found")

    full_text = " ".join(
        seg["text"] for seg in session.get("transcript", [])
    )
    action_items = [i["text"] for i in session.get("action_items", [])]
    decisions = [d["text"] for d in session.get("decisions", [])]

    digest = generate_digest(full_text, action_items, decisions)
    clear_store(session_id)

    return {
        "digest": digest,
        "action_items": session.get("action_items", []),
        "decisions": session.get("decisions", []),
        "open_questions": session.get("open_questions", []),
        "total_sentences": len(session.get("transcript", [])),
    }

@router.get("/{session_id}/transcript")
async def get_transcript(session_id: str):
    """Return the full transcript for a session."""
    session = get_session(session_id)
    if not session:
        raise HTTPException(status_code=404, detail="Session not found")
    return {"transcript": session.get("transcript", [])}