feat: 模型配置支持删除,岗位行动规划对接任务系统字典与批量新增 Skill

模型管理新增 DELETE 接口与前端删除能力(支持含斜杠的模型名);行动规划改为 9 字段 JSON,prepare 传入 taskId/字典并绑定 position-roundtable-action-create Skill。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
董宏凯andCursor committed 2026-08-12 14:47:14 +08:00
1 parent af509eb670
commit c9c2dc7ea8
12 files changed
+697 -95

No files matched your search

@@ -6,6 +6,7 @@ from types import SimpleNamespace
import pytest
import yaml
from starlette.routing import Match
from app.gateway.routers import model_management as router
@@ -53,6 +54,64 @@ def test_connection_error_redaction_hides_literal_and_resolved_keys() -> None:
assert router._redact_text(message, ["raw-secret", "resolved-secret"]) == "provider rejected *** and ***"
def test_model_mutation_routes_accept_names_with_slashes() -> None:
for method in ("PUT", "DELETE"):
route = next(
item
for item in router.router.routes
if getattr(item, "methods", set()) == {method} and getattr(item, "path", "") == "/api/admin/models/{model_name:path}"
)
match, child_scope = route.matches(
{
"type": "http",
"method": method,
"path": "/api/admin/models/zai-org/GLM-5-FP8",
}
)
assert match is Match.FULL
assert child_scope["path_params"] == {"model_name": "zai-org/GLM-5-FP8"}
@pytest.mark.asyncio
async def test_delete_model_configuration_removes_matching_model_and_activates_config(
tmp_path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
config_path = tmp_path / "config.yaml"
config_path.write_text(
"""models:
- name: zai-org/GLM-5-FP8
use: langchain_openai:ChatOpenAI
model: GLM-5-FP8
- name: keep-me
use: langchain_openai:ChatOpenAI
model: keep-me
""",
encoding="utf-8",
)
saved: dict[str, object] = {}
async def save_models(_request, raw_before: str, models: list[dict[str, object]]) -> list[dict[str, object]]:
saved["raw_before"] = raw_before
saved["models"] = models
return models
monkeypatch.setattr(router, "_resolve_config_path", lambda: config_path)
monkeypatch.setattr(router, "_save_models", save_models)
request = SimpleNamespace(state=SimpleNamespace(user=SimpleNamespace(system_role="admin")))
await router.delete_model_configuration("zai-org/GLM-5-FP8", request)
assert "zai-org/GLM-5-FP8" in str(saved["raw_before"])
assert saved["models"] == [
{
"name": "keep-me",
"use": "langchain_openai:ChatOpenAI",
"model": "keep-me",
}
]
@pytest.mark.asyncio
async def test_connection_test_uses_one_minimal_prompt_without_writing_config(
tmp_path,