M4b:ai_provider 删除手术①-⑥——神识全面接管模型出口
- ① 后端删除 app/ai_provider/(38 文件,含 anthropic/openai 格式、billing、audio、embedding)、services/ai_provider_admin.py、core/config/model_config.py、tests/ai_provider/(21 文件) - ② 连带退役 application/agent/(旧 Agent 循环/steer/follow-up/确认注册表)、application/skill_executor.py、app/skills/(python skills 孤儿)、endpoints/audio.py、application/imports.py(ProviderManager 消费方);settings 端点收敛为生成偏好 - ③ runs.py 修剪:AgentRunRegistry/steer/follow-up/confirmations 端点退役,保留 list/get/events/cancel/stream;safety 确认改为直接落库裁决(pending→approved/denied) - ④ 前端删除:models 页、ModelGatewayView、gateway.ts、GatewayPanel(玄关)、ModelGatewayPanel/ModelStrategyForm、audio.ts/useVoiceInput、网关类型与 mock;设置页收敛为外观/语言/通知 - ⑤ 配置收敛:config/models|providers|pricing.example.yaml 归档 shenshi/config/;.env.example 删 provider keys/MODEL_ENDPOINT_POOL/MODEL_CONFIG_PATH,收敛 SHENSHI_* - ⑥ 验收:rg 审计灵台 Provider SDK import 与 ai_provider 引用归零;后端 528 passed(2 个预存失败经 HEAD 复跑验证与本手术无关)、前端 type-check+201 passed、神识 go vet+test、BFF 4 passed
This commit is contained in:
1 parent
0d383725b5
commit
462d570751
129 files changed
+81
-15867
No files matched your search
@@ -15,7 +15,6 @@ from fastapi.middleware.cors import CORSMiddleware
|
||||
from sqlalchemy.exc import OperationalError
|
||||
|
||||
from app.api.router import api_router
|
||||
from app.application.agent.confirmation import ConfirmationRegistry
|
||||
from app.application.tool_runtime.runtime import ToolRuntime
|
||||
from app.core.config import settings
|
||||
from app.core.errors import register_exception_handlers, trace_id_var
|
||||
@@ -71,14 +70,6 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
except Exception: # noqa: BLE001
|
||||
log_with_context("SQLite WAL 模式设置失败,已跳过", level="WARNING")
|
||||
|
||||
# 加载模型网关 endpoint 覆盖缓存(DB 优先于 yaml/env);迁移未完或读失败则降级跳过
|
||||
try:
|
||||
from app.services.ai_provider_admin import reload_provider_manager
|
||||
|
||||
await reload_provider_manager()
|
||||
except Exception: # noqa: BLE001
|
||||
log_with_context("模型网关覆盖缓存加载失败,已跳过", level="WARNING")
|
||||
|
||||
# 运行时注入:事件存储始终就绪(DbEventStore 持久化到 events 表,重启不丢);
|
||||
# 工具运行时依赖沙箱配置,未配置(缺 SANDBOX_AUTH_SECRET 等)则降级 None(工具 API 503)。
|
||||
# 事件流与历史查询不依赖沙箱,始终可用。
|
||||
@@ -122,16 +113,6 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
|
||||
_app.state.confirmation_store = DbConfirmationStore(AsyncSessionLocal)
|
||||
log_with_context("confirmation_store_set_to_db")
|
||||
# 进程内检查点确认注册表:混合唤醒(同进程 Event + 重启后 DB polling)。
|
||||
_app.state.confirmation_registry = ConfirmationRegistry()
|
||||
from app.application.agent import AgentRunRegistry, discover_python_skills
|
||||
|
||||
_app.state.agent_run_registry = AgentRunRegistry()
|
||||
_app.state.python_skill_catalog = discover_python_skills(("app.skills",))
|
||||
log_with_context(
|
||||
"Python Skills 目录就绪",
|
||||
skills=[skill.name for skill in _app.state.python_skill_catalog.skills],
|
||||
)
|
||||
sandbox_http: httpx.AsyncClient | None = None
|
||||
tools_http: httpx.AsyncClient | None = None
|
||||
if settings.enable_tool_runtime:
|
||||
|
||||
Reference in new issue
Block a user