feat: 工作流画布支持草稿试运行(target=draft 执行当前草稿图)
This commit is contained in:
1 parent
3384f2e51c
commit
222595d6c4
7 files changed
+198
-32
No files matched your search
@@ -278,10 +278,46 @@ async def coze_playground_space_save(request: Request) -> dict[str, Any]:
|
||||
return _coze_ok({"id": _DEFAULT_SPACE["id"], "check_not_pass": False})
|
||||
|
||||
|
||||
def _coze_model_type(name: str) -> int:
|
||||
"""Stable positive int32 from the model name.
|
||||
|
||||
The Coze LLM form stores the picked model as ``modelType`` (number) plus
|
||||
``modleName`` (string, upstream typo) — the compiler reads the string, so
|
||||
the number only needs to be stable within a deployment, not reversible.
|
||||
"""
|
||||
digest = 5381
|
||||
for char in name:
|
||||
digest = ((digest * 33) + ord(char)) & 0xFFFFFFFF
|
||||
return digest & 0x7FFFFFFF
|
||||
|
||||
|
||||
@chrome_router.api_route("/api/bot/get_type_list", methods=["GET", "POST"])
|
||||
async def coze_model_type_list(request: Request) -> dict[str, Any]:
|
||||
"""LLM form model list → real DeerFlow models (names only, no secrets).
|
||||
|
||||
The Coze ``Model`` shape is trimmed to what the workflow form consumes:
|
||||
``model_type`` (stable number), ``name`` (the DeerFlow model name, stored
|
||||
verbatim into the node so the runtime can override the model), and empty
|
||||
ability/params maps — ``getLLMModels`` fills in response_format defaults
|
||||
client-side. Parameter tuning panels stay inert: model tuning happens in
|
||||
DeerFlow, the workflow node only picks which model to call.
|
||||
"""
|
||||
await _require_studio_user(request)
|
||||
return _coze_ok({"model_list": []})
|
||||
config = get_app_config()
|
||||
configured = list(getattr(config, 'models', None) or [])
|
||||
model_list = [
|
||||
{
|
||||
"model_type": _coze_model_type(model.name),
|
||||
"name": model.name,
|
||||
"display_name": model.display_name or model.name,
|
||||
"description": "",
|
||||
"model_ability": {},
|
||||
"model_params": [],
|
||||
"is_custom": False,
|
||||
}
|
||||
for model in configured
|
||||
]
|
||||
return _coze_ok({"model_list": model_list})
|
||||
|
||||
|
||||
@router.post("/create")
|
||||
@@ -366,3 +402,60 @@ async def coze_node_template_list(request: Request) -> dict[str, Any]:
|
||||
"plugin_category_list": [],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@router.post("/workflow_references")
|
||||
async def coze_workflow_references(request: Request) -> dict[str, Any]:
|
||||
"""Which workflows reference the current one via subworkflow nodes.
|
||||
|
||||
Honest empty answer: the standalone page's subworkflow form is not wired
|
||||
yet, so no canvas can reference another — an empty list is the truthful
|
||||
state, not a placeholder for missing data.
|
||||
"""
|
||||
_require_enabled()
|
||||
await get_current_user(request)
|
||||
return {"code": 0, "msg": "success", "data": {"workflow_list": []}}
|
||||
|
||||
|
||||
@router.post("/nodeDebug")
|
||||
async def coze_node_debug(request: Request) -> dict[str, Any]:
|
||||
"""Single-node debug: NOT wired to the DeerFlow executor.
|
||||
|
||||
Deliberately a business error (Coze envelope code != 0) so the playground
|
||||
surfaces an explicit message instead of pretending the debug succeeded.
|
||||
"""
|
||||
_require_enabled()
|
||||
await get_current_user(request)
|
||||
return {
|
||||
"code": 4003101,
|
||||
"msg": "节点单点调试暂未接入 DeerFlow 执行器,请使用画布下方「试运行」运行整个工作流",
|
||||
}
|
||||
|
||||
|
||||
@router.post("/llm_fc_setting_detail")
|
||||
@router.post("/llm_fc_setting_merged")
|
||||
async def coze_llm_fc_setting(request: Request) -> dict[str, Any]:
|
||||
"""LLM function-call settings detail/merge for plugin/workflow lists.
|
||||
|
||||
No Coze plugins are wired into the canvas, so every detail map is empty.
|
||||
"""
|
||||
_require_enabled()
|
||||
await get_current_user(request)
|
||||
return {
|
||||
"code": 0,
|
||||
"msg": "success",
|
||||
"data": {
|
||||
"plugin_detail_map": {},
|
||||
"plugin_api_detail_map": {},
|
||||
"workflow_detail_map": {},
|
||||
"dataset_detail_map": {},
|
||||
"knowledge_detail_map": {},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@chrome_router.post("/api/devops/debugger/v1/coze/testcase/casedata/mget")
|
||||
async def coze_testcase_casedata_mget(request: Request) -> dict[str, Any]:
|
||||
"""Playground test-case fetch: no Coze test cases exist for this page."""
|
||||
await _require_studio_user(request)
|
||||
return {"code": 0, "msg": "success", "data": {"case_data_list": [], "total": 0}}
|
||||
Reference in new issue
Block a user