5e24215ffe
Co-authored-by: Copilot <copilot@github.com>
2.7 KiB
2.7 KiB
6. Runtime View
Describes concrete behavior and interactions of the system's building blocks in form of scenarios from the following areas:
- Important use cases or features: how do building blocks execute them?
- Interactions at critical external interfaces: how do building blocks cooperate with users and neighboring systems?
- Operation and administration: launch, start-up, stop
- Error and exception scenarios
Scenario 1: User Authentication
- User submits login form in Flask frontend
- Flask POSTs credentials to
POST /auth/login - Auth Service validates credentials against DuckDB
- Auth Service returns JWT token
- Flask stores token in session cookie
- User is redirected to dashboard
Scenario 2: AI Text Generation
- User fills in text generation form in Flask frontend
- Flask POSTs prompt + model to
POST /generate/textwith JWT header - Auth Service validates JWT
- AI Service sends prompt to openrouter.ai
- openrouter.ai returns generated text
- FastAPI returns result to Flask
- Flask renders result page for user
Scenario 3: Image Generation
- User submits image generation form
- Flask POSTs to
POST /generate/image - AI Service calls openrouter.ai image model
- Image URL returned to Flask
- Flask renders page with generated image
Scenario 4: Video Generation (Text-to-Video)
- User submits video generation form with prompt and model selection
- Flask POSTs to
POST /generate/videowith JWT header - Auth Service validates JWT
- AI Service calls OpenRouter
/video/generations - OpenRouter returns a job response (
status: "queued"or"completed") - FastAPI returns
VideoResponseto Flask - Flask renders result page; if status is
queued, the UI may poll or notify asynchronously
Scenario 5: Image-to-Video Generation
- User uploads or provides an image URL and a text prompt
- Flask POSTs to
POST /generate/video/from-imagewith JWT header - AI Service calls OpenRouter
/video/generations/from-image - Returns
VideoResponsewithvideo_urlwhen completed
Scenario 6: Token Refresh
- Access token expires (TTL 15 min)
- Client POSTs current refresh token to
POST /auth/refresh - Auth Service validates JTI against
refresh_tokenstable (not revoked, not expired) - Old JTI is revoked; new JTI inserted into
refresh_tokens - New access token + new refresh token returned to client
Scenario 7: Admin User Management
- Admin logs in and receives access token with
role: admin - Admin GETs
/admin/statsto view user and token counts - Admin DELETEs
/users/{id}to remove a user — refresh tokens for that user are cascade-deleted - Admin PUTs
/users/{id}/roleto promote a user to admin or demote to user