refactor: remove legacy assistant compatibility

This commit is contained in:
Xin Wang
2026-08-18 10:07:18 +08:00
parent abfcd4cd19
commit d003ee77a5
40 changed files with 505 additions and 729 deletions
+4 -4
View File
@@ -20,7 +20,7 @@ from schemas import (
)
from services.auth import require_admin
from services.masking import mask, resolve_incoming_key
from services.node_specs import graph_references, normalize_graph, validate_graph
from services.node_specs import copy_graph, graph_references, validate_graph
from services.state_expressions import StateExpressionError, validate_update_rules
from services.system_tools import RESERVED_TOOL_NAMES
from services.tool_policy import policy_for_tool
@@ -98,9 +98,9 @@ def _validate_workflow(body: AssistantUpsert) -> None:
if body.graph and str(body.graph.get("specVersion") or "") != "4":
raise HTTPException(
400,
"Workflow API 仅接受 specVersion=4;旧图请先执行数据库迁移",
"Workflow API 仅接受当前 specVersion=4 图结构",
)
body.graph = normalize_graph(body.graph or {})
body.graph = copy_graph(body.graph or {})
errors = validate_graph(body.graph)
settings = body.graph.get("settings") or {}
graph_runtime_mode = str(settings.get("runtimeMode") or "pipeline")
@@ -636,7 +636,7 @@ async def _to_out(session: AsyncSession, assistant: Assistant) -> AssistantOut:
api_key=mask(assistant.api_key),
app_id=assistant.app_id,
graph=(
normalize_graph(assistant.graph or {})
copy_graph(assistant.graph or {})
if assistant.type == "workflow"
else {}
),