870 B
870 B
SpeakEasy: Know who's talking
Client flow
- Client uploads
EPUB - Backend:
- Stores file
- Creates
book_id - Publishes job to RabbitMQ
- Client subscribes:
GET /books/{book_id}/streamvia WebSocket
- Backend:
- Authenticates user
- Remembers:
connection -> book_id
- Worker processes text:
- Calls Ollama
- Stores result in Postgres
- Emits "result ready" event
- Backend:
- Receives event
- Pushes mathing results to the subscribed client
Example WebSocket message to client
{
"book_id": "book-abc",
"paragraph_id": "p-432",
"speaker": "Mary",
"confidence": 0.87
}
Worker flow
- Receives job from RabbitMQ
- Loads paragraph text
- Embeds paragraph
- Queries vector DB (pgvector)
- Builds prompt with retrieved content
- Sends prompt to Ollama
- Stores result