Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: open restore version panel raise 500 (#35240)
非法操作76af80e33284
diff --git a/api/controllers/console/app/workflow.py b/api/controllers/console/app/workflow.pyindex da8d25c2eb7..5e6ff87d62b 100644--- a/api/controllers/console/app/workflow.py+++ b/api/controllers/console/app/workflow.py@@ -4,7 +4,7 @@ from collections.abc import Sequencefrom typing import Anyfrom flask import abort, request-from flask_restx import Resource, fields, marshal_with+from flask_restx import Resource, fields, marshal, marshal_withfrom graphon.enums import NodeTypefrom graphon.file import Filefrom graphon.graph_engine.manager import GraphEngineManager@@ -942,7 +942,6 @@ class PublishedAllWorkflowApi(Resource):@login_required@account_initialization_required@get_app_model(mode=[AppMode.ADVANCED_CHAT, AppMode.WORKFLOW])- @marshal_with(workflow_pagination_model)@edit_permission_requireddef get(self, app_model: App):"""@@ -970,9 +969,10 @@ class PublishedAllWorkflowApi(Resource):user_id=user_id,named_only=named_only,)+ serialized_workflows = marshal(workflows, workflow_fields_copy)return {- "items": workflows,+ "items": serialized_workflows,"page": page,"limit": limit,"has_more": has_more,diff --git a/api/tests/unit_tests/controllers/console/app/test_workflow.py b/api/tests/unit_tests/controllers/console/app/test_workflow.pyindex 36076368805..f32d0ef0ecd 100644--- a/api/tests/unit_tests/controllers/console/app/test_workflow.py+++ b/api/tests/unit_tests/controllers/console/app/test_workflow.py@@ -258,6 +258,63 @@ def test_restore_published_workflow_to_draft_returns_400_for_invalid_structure(assert exc.value.description == "invalid workflow graph"+def test_get_published_workflows_marshals_items_before_session_closes(app, monkeypatch: pytest.MonkeyPatch) -> None:+ api = workflow_module.PublishedAllWorkflowApi()+ handler = _unwrap(api.get)++ session_state = {"open": False}++ class _SessionContext:+ def __enter__(self):+ session_state["open"] = True+ return object()++ def __exit__(self, exc_type, exc, tb):+ session_state["open"] = False+ return False++ class _SessionMaker:+ def begin(self):+ return _SessionContext()++ class _Workflow:+ @property+ def id(self):+ assert session_state["open"] is True+ return "w1"++ monkeypatch.setattr(workflow_module, "db", SimpleNamespace(engine=object()))+ monkeypatch.setattr(workflow_module, "sessionmaker", lambda *_args, **_kwargs: _SessionMaker())+ monkeypatch.setattr(workflow_module, "current_account_with_tenant", lambda: (SimpleNamespace(id="u1"), "t1"))+ monkeypatch.setattr(+ workflow_module,+ "WorkflowService",+ lambda: SimpleNamespace(+ get_all_published_workflow=lambda **_kwargs: ([_Workflow()], False),+ ),+ )++ def _fake_marshal(items, fields):+ assert session_state["open"] is True+ return [{"id": item.id} for item in items]++ monkeypatch.setattr(workflow_module, "marshal", _fake_marshal)++ with app.test_request_context(+ "/apps/app/workflows",+ method="GET",+ query_string={"page": 1, "limit": 10, "user_id": "", "named_only": "false"},+ ):+ response = handler(api, app_model=SimpleNamespace(id="app", workflow_id="wf-1"))++ assert response == {+ "items": [{"id": "w1"}],+ "page": 1,+ "limit": 10,+ "has_more": False,+ }++def test_draft_workflow_get_not_found(monkeypatch: pytest.MonkeyPatch) -> None:monkeypatch.setattr(workflow_module, "WorkflowService", lambda: SimpleNamespace(get_draft_workflow=lambda **_k: None)