How kid0317/crewai_mas_demo_m2l7 works
This is a FastAPI service that accepts a creative brief and multiple images, then returns a structured Xiaohongshu note report. Its main workflow validates the request, saves and compresses images, runs image analysis and editing followed by strategy, copywriting, and SEO stages, and formats the result. The graph also shows the documented API security and observability capabilities, plus persistence components present in the tree. Some links rely on README or SOURCE INDEX references; unsampled implementation details are not inferred.
Main entry points: flows.py Flow orchestration · xhs_note.py Report endpoint · main.py FastAPI app · xhs_note_service.py Note service
Components 28
HTTP API
- Report endpoint
src/app/api/v1/xhs_note.py - API key checks
src/app/core/security.py - Request dependencies
src/app/api/dependencies.py - Response schemas
src/app/schemas/common.py
Note Generation
- Note data models
src/app/schemas/xhs_note.py - Note service
src/app/services/xhs_note_service.py - Image processing
src/app/core/image_utils.py - Flow orchestration
src/app/crews/xhs_note/flows.py - Visual analysis
src/app/crews/xhs_note/flows.py - Image editing
src/app/crews/xhs_note/flows.py - Content strategy
src/app/crews/xhs_note/flows.py - Copywriting
src/app/crews/xhs_note/flows.py - SEO optimization
src/app/crews/xhs_note/flows.py - Agent factory
src/app/crews/xhs_note/agents.py - Task factory
src/app/crews/xhs_note/tasks.py - Crew tools
src/app/crews/tools/add_image_tool_local.py - Aliyun LLM adapter
src/app/crews/llm/aliyun_llm.py
Application Platform
- FastAPI app
src/app/main.py - Health endpoints
src/app/api/v1/health.py - Application settings
src/app/core/config.py - HTTP tracing
src/app/observability/http_trace.py - Structured logging
src/app/observability/logging.py - Prometheus metrics
src/app/observability/metrics.py
Persistence
- OceanBase client
src/app/db/clients/oceanbase_client.py - Database base model
src/app/db/models/base.py - Local file client
src/app/db/clients/file_client.py
Other components
- API caller
- Aliyun model service
Connections 26
- API caller → Report endpoint: submits images
README.md - FastAPI app → Report endpoint: mounts router
src/app/main.py - FastAPI app → Health endpoints: mounts routes
src/app/main.py - Report endpoint → API key checks: checks API key
- Report endpoint → Request dependencies: gets request ID
src/app/api/v1/xhs_note.py - Report endpoint → Note service: calls
src/app/api/v1/xhs_note.py - Report endpoint → Response schemas: returns envelope
src/app/api/v1/xhs_note.py - Note service → Image processing: compresses images
src/app/services/xhs_note_service.py - Note service → Note data models: builds request
src/app/services/xhs_note_service.py - Note service → Flow orchestration: runs flow
src/app/services/xhs_note_service.py - Flow orchestration → Visual analysis: runs phase
README.md - Flow orchestration → Image editing: runs phase
README.md - Flow orchestration → Content strategy: runs phase
README.md - Flow orchestration → Copywriting: runs phase
README.md - Flow orchestration → SEO optimization: runs phase
README.md - Flow orchestration → Task factory: builds tasks
src/app/crews/xhs_note/flows.py - Task factory → Agent factory: creates agents
src/app/crews/xhs_note/tasks.py - Agent factory → Aliyun LLM adapter: gets model
src/app/crews/xhs_note/agents.py - Agent factory → Crew tools: registers tools
src/app/crews/xhs_note/agents.py - Aliyun LLM adapter → Aliyun model service: sends requests
src/app/crews/llm/aliyun_llm.py - FastAPI app → Application settings: loads settings
src/app/main.py - FastAPI app → HTTP tracing: installs middleware
src/app/main.py - HTTP tracing → Structured logging: records context
src/app/observability/http_trace.py - FastAPI app → Prometheus metrics: exposes metrics
README.md - OceanBase client → Application settings: reads settings
src/app/db/clients/oceanbase_client.py - OceanBase client → Database base model: uses model base
src/app/db/clients/oceanbase_client.py