feat: DeepSeek v4 模型对齐、作业助手脚本与 Agent 对比测试

- 前端 WorkflowEditor/ModelConfigs/NodeTemplates:deepseek-v4-flash、v4-pro,弃用提示
- llm_service 默认 deepseek-v4-flash;workflow_engine 等与模型配置注入
- 作业管理脚本支持 AGENT_NAME 与 v4-pro;新增 compare_homework_agents 脚本
- 文档重命名为 (红头)项目核心文档汇总.md 并更新 DeepSeek 说明

Made-with: Cursor
This commit is contained in:
renjianbo
2026-04-30 00:57:13 +08:00
parent cadeb2dc32
commit 4366312946
12 changed files with 488 additions and 55 deletions

View File

@@ -41,6 +41,19 @@ def _snapshot_to_jsonable(snapshot: dict) -> dict:
return _json.loads(_json.dumps(snapshot, default=str))
def _trusted_user_for_execution(db, execution: Optional[Execution]) -> Optional[str]:
"""用于校验 LLM 节点引用的 model_configs 归属(与 Workflow / Agent 所有者一致)。"""
if not execution:
return None
if execution.agent_id:
ag = db.query(Agent).filter(Agent.id == execution.agent_id).first()
return ag.user_id if ag else None
if execution.workflow_id:
wf = db.query(Workflow).filter(Workflow.id == execution.workflow_id).first()
return wf.user_id if wf else None
return None
@celery_app.task(bind=True)
def execute_workflow_task(
self,
@@ -80,12 +93,14 @@ def execute_workflow_task(
# 创建工作流引擎(传入logger、db、合并后的执行预算)
budget = merge_budget_for_execution(db, execution) if execution else {}
trusted_uid = _trusted_user_for_execution(db, execution)
engine = WorkflowEngine(
workflow_id,
workflow_data,
logger=execution_logger,
db=db,
budget_limits=budget,
trusted_model_config_user_id=trusted_uid,
)
max_retries = max(0, int(getattr(settings, "WORKFLOW_TASK_MAX_RETRIES", 0) or 0))
@@ -269,12 +284,14 @@ def resume_workflow_task(
self.update_state(state="PROGRESS", meta={"progress": 0, "status": "running"})
budget = merge_budget_for_execution(db, execution) if execution else {}
trusted_uid = _trusted_user_for_execution(db, execution)
engine = WorkflowEngine(
wf_key,
workflow_data,
logger=execution_logger,
db=db,
budget_limits=budget,
trusted_model_config_user_id=trusted_uid,
)
max_retries = max(0, int(getattr(settings, "WORKFLOW_TASK_MAX_RETRIES", 0) or 0))
result: Optional[dict] = None