- deploy temporal server (postgresql + auto-setup + ui) in docker-compose - new temporal/ module: workflow + activities + worker manager - convert lesson plan 4-step orchestration to temporal workflow - activities wrap existing analyze/recommend/generate/prepare_review steps - worker injects failover_chain/content_client/data_ana_client via module globals - start() uses temporal client.start_workflow, falls back to asyncio in dev - register temporal ports 7233/8085 in port-allocation Implements M6.5 of v2.1 migration plan (ADR-030).
57 lines
1.5 KiB
TOML
57 lines
1.5 KiB
TOML
[project]
|
||
name = "ai-service"
|
||
version = "0.1.0"
|
||
description = "AI 网关服务 - LLM 集成 + 出题 + 备课工作流(D6 智能洞察领域 · 生成子域)"
|
||
requires-python = ">=3.12"
|
||
dependencies = [
|
||
# 通过 workspace 继承 shared-py 集中声明的共享库版本
|
||
"edu-shared-py",
|
||
# 服务特有依赖(非共享库)
|
||
"httpx>=0.27.0",
|
||
# gRPC
|
||
"grpcio>=1.66.0",
|
||
"protobuf>=5.28.0",
|
||
# Kafka(用量事件发布,派生数据豁免 Outbox)
|
||
"aiokafka>=0.11.0",
|
||
# Prompt 模板渲染
|
||
"jinja2>=3.1.0",
|
||
"pyyaml>=6.0.2",
|
||
# Redis(限流 + 缓存 + 工作流状态)
|
||
"redis>=5.1.0",
|
||
# 重试机制(LLM 调用 + 下游 gRPC)
|
||
"tenacity>=9.0.0",
|
||
# GraphQL Federation 2 子图(v2.1 M1,Apollo Router 组合)
|
||
"strawberry-graphql[asgi]>=0.257.0",
|
||
# Temporal 工作流引擎(v2.1 §8.2 ADR-030,AI 耗时工作流)
|
||
"temporalio>=1.7.0",
|
||
]
|
||
|
||
[tool.uv.sources]
|
||
edu-shared-py = { workspace = true }
|
||
|
||
[project.optional-dependencies]
|
||
dev = [
|
||
"grpcio-tools>=1.66.0",
|
||
"pytest>=8.3.0",
|
||
"pytest-asyncio>=0.24.0",
|
||
"pytest-cov>=5.0.0",
|
||
"ruff>=0.7.0",
|
||
]
|
||
|
||
[tool.ruff]
|
||
line-length = 100
|
||
target-version = "py312"
|
||
exclude = ["src/ai/proto_gen", "tests"]
|
||
|
||
[tool.ruff.lint]
|
||
select = ["E", "F", "I", "N", "W", "UP", "B", "SIM"]
|
||
|
||
[tool.pytest.ini_options]
|
||
asyncio_mode = "auto"
|
||
testpaths = ["tests"]
|
||
python_files = ["test_*.py"]
|
||
addopts = "--cov=src --cov-report=term-missing --cov-fail-under=80"
|
||
|
||
[tool.coverage.run]
|
||
omit = ["src/ai/proto_gen/*"]
|