feat: Phase 0 — monorepo 骨架 + 全表迁移 + FastAPI/Next 骨架 + CI
- uv(workspace) + pnpm monorepo;docker-compose(pg+api+web) - SQLAlchemy 16 MVP 表 + Alembic 初版迁移(无漂移,users stub) - FastAPI 骨架:统一错误信封(带 request_id) + structlog + /jobs/:id + OpenAPI - Next.js 骨架:纸感主题 token + OpenAPI→TS 客户端代码生成(gen:api) - CI(ruff/mypy/pytest + pg service + alembic 漂移校验) - 四份设计规格(PRODUCT/UX/ARCHITECTURE/DEV_PLAN) + CLAUDE.md
This commit is contained in:
15
packages/config/pyproject.toml
Normal file
15
packages/config/pyproject.toml
Normal file
@@ -0,0 +1,15 @@
|
||||
[project]
|
||||
name = "ww-config"
|
||||
version = "0.0.0"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = ["pydantic>=2.7", "pydantic-settings>=2.3", "ww-shared"]
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["ww_config"]
|
||||
|
||||
[tool.uv.sources]
|
||||
ww-shared = { workspace = true }
|
||||
3
packages/config/ww_config/__init__.py
Normal file
3
packages/config/ww_config/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from ww_config.settings import Settings, get_settings
|
||||
|
||||
__all__ = ["Settings", "get_settings"]
|
||||
29
packages/config/ww_config/settings.py
Normal file
29
packages/config/ww_config/settings.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""应用配置(env 解析)。提供商注册/档位默认见后续阶段。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import lru_cache
|
||||
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
||||
|
||||
app_env: str = "dev"
|
||||
log_json: bool = False
|
||||
database_url: str = "postgresql+asyncpg://writer:writer@localhost:5432/writer"
|
||||
database_url_sync: str = "postgresql+psycopg://writer:writer@localhost:5432/writer"
|
||||
credential_enc_key: str = ""
|
||||
|
||||
# 档位默认(writer/analyst/light)——具体 provider:model 经 tier_routing 覆盖
|
||||
tier_defaults: dict[str, str] = {
|
||||
"writer": "deepseek:deepseek-chat",
|
||||
"analyst": "deepseek:deepseek-chat",
|
||||
"light": "deepseek:deepseek-chat",
|
||||
}
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
return Settings()
|
||||
Reference in New Issue
Block a user