refactor: 推进后端分层架构治理

This commit is contained in:
jxxghp
2026-08-18 00:29:14 +08:00
parent 5d0bacabd5
commit 5128ae9e1e
363 changed files with 34179 additions and 6019 deletions
+30 -36
View File
@@ -1,36 +1,30 @@
from .agent import *
from .cache import *
from .category import *
from .common import *
from .context import *
from .dashboard import *
from .download import *
from .event import *
from .exception import *
from .file import *
from .history import *
from .llm import *
from .mediaserver import *
from .message import *
from .mfa import *
from .music import *
from .monitoring import *
from .notification import *
from .plugin import *
from .response import *
from .rule import *
from .search import *
from .storage import *
from .openai import *
from .servarr import *
from .servcookie import *
from .site import *
from .subscribe import *
from .system import *
from .system import *
from .tmdb import *
from .token import *
from .transfer import *
from .user import *
from .workflow import *
from .mcp import *
"""Schema 根包的惰性兼容导出入口。
公开符号清单由 ``scripts/schema/exports.py`` 从各 schema 子模块生成。
旧的 ``app.schemas.X`` 与 ``from app.schemas import X`` 路径保持不变,但仅在首次
访问具体符号时加载其所有者模块,避免任意 schema 导入触发完整模型图。
"""
from importlib import import_module as _import_module
from typing import Any as _Any
from app.schemas.exports import SCHEMA_EXPORTS as _SCHEMA_EXPORTS
def __getattr__(name: str) -> _Any:
"""按生成清单惰性解析并缓存 schema 公开符号。"""
contract = _SCHEMA_EXPORTS.get(name)
if contract is None:
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
module_name, symbol_name = contract
value = getattr(_import_module(module_name), symbol_name)
globals()[name] = value
return value
def __dir__() -> list[str]:
"""返回兼容公开面,供 IDE、文档与交互式检查使用。"""
return sorted({*globals(), *_SCHEMA_EXPORTS})
__all__ = sorted(_SCHEMA_EXPORTS)