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
Chore/code format and Repair commit_id 3254018d more deleted codes and Fix naming error ambiguity between workflow_run_id and workflow_id (#17075)
jiangbo721a1aa325ce326
diff --git a/api/controllers/service_api/app/workflow.py b/api/controllers/service_api/app/workflow.pyindex 1cd7e5bf239..2854a435057 100644--- a/api/controllers/service_api/app/workflow.py+++ b/api/controllers/service_api/app/workflow.py@@ -54,7 +54,7 @@ workflow_run_fields = {class WorkflowRunDetailApi(Resource):@validate_app_token@marshal_with(workflow_run_fields)- def get(self, app_model: App, workflow_id: str):+ def get(self, app_model: App, workflow_run_id: str):"""Get a workflow task running detail"""@@ -62,7 +62,7 @@ class WorkflowRunDetailApi(Resource):if app_mode != AppMode.WORKFLOW:raise NotWorkflowAppError()- workflow_run = db.session.query(WorkflowRun).filter(WorkflowRun.id == workflow_id).first()+ workflow_run = db.session.query(WorkflowRun).filter(WorkflowRun.id == workflow_run_id).first()return workflow_run@@ -163,6 +163,6 @@ class WorkflowAppLogApi(Resource):api.add_resource(WorkflowRunApi, "/workflows/run")-api.add_resource(WorkflowRunDetailApi, "/workflows/run/<string:workflow_id>")+api.add_resource(WorkflowRunDetailApi, "/workflows/run/<string:workflow_run_id>")api.add_resource(WorkflowTaskStopApi, "/workflows/tasks/<string:task_id>/stop")api.add_resource(WorkflowAppLogApi, "/workflows/logs")diff --git a/api/core/app/task_pipeline/workflow_cycle_manage.py b/api/core/app/task_pipeline/workflow_cycle_manage.pyindex 8204d0be85b..ebae3285a60 100644--- a/api/core/app/task_pipeline/workflow_cycle_manage.py+++ b/api/core/app/task_pipeline/workflow_cycle_manage.py@@ -44,6 +44,7 @@ from core.app.entities.task_entities import (WorkflowFinishStreamResponse,WorkflowStartStreamResponse,)+from core.app.task_pipeline.exc import WorkflowRunNotFoundErrorfrom core.file import FILE_MODEL_IDENTITY, Filefrom core.model_runtime.utils.encoders import jsonable_encoderfrom core.ops.entities.trace_entity import TraceTaskName@@ -66,8 +67,6 @@ from models.workflow import (WorkflowRunStatus,)-from .exc import WorkflowRunNotFoundError-class WorkflowCycleManage:def __init__(@@ -166,7 +165,7 @@ class WorkflowCycleManage:outputs = WorkflowEntry.handle_special_values(outputs)- workflow_run.status = WorkflowRunStatus.SUCCEEDED.value+ workflow_run.status = WorkflowRunStatus.SUCCEEDEDworkflow_run.outputs = json.dumps(outputs or {})workflow_run.elapsed_time = time.perf_counter() - start_atworkflow_run.total_tokens = total_tokens@@ -201,7 +200,7 @@ class WorkflowCycleManage:workflow_run = self._get_workflow_run(session=session, workflow_run_id=workflow_run_id)outputs = WorkflowEntry.handle_special_values(dict(outputs) if outputs else None)- workflow_run.status = WorkflowRunStatus.PARTIAL_SUCCESSED.value+ workflow_run.status = WorkflowRunStatus.PARTIAL_SUCCEEDED.valueworkflow_run.outputs = json.dumps(outputs or {})workflow_run.elapsed_time = time.perf_counter() - start_atworkflow_run.total_tokens = total_tokensdiff --git a/api/core/rag/index_processor/constant/built_in_field.py b/api/core/rag/index_processor/constant/built_in_field.pyindex 09c5e949ebd..c8ad53e3dd9 100644--- a/api/core/rag/index_processor/constant/built_in_field.py+++ b/api/core/rag/index_processor/constant/built_in_field.py@@ -1,7 +1,7 @@-from enum import Enum+from enum import Enum, StrEnum-class BuiltInField(str, Enum):+class BuiltInField(StrEnum):document_name = "document_name"uploader = "uploader"upload_date = "upload_date"diff --git a/api/core/rag/index_processor/constant/index_type.py b/api/core/rag/index_processor/constant/index_type.pyindex 0845b58e25b..659086e8088 100644--- a/api/core/rag/index_processor/constant/index_type.py+++ b/api/core/rag/index_processor/constant/index_type.py@@ -1,7 +1,7 @@-from enum import Enum+from enum import StrEnum-class IndexType(str, Enum):+class IndexType(StrEnum):PARAGRAPH_INDEX = "text_model"QA_INDEX = "qa_model"PARENT_CHILD_INDEX = "hierarchical_model"diff --git a/api/core/rag/index_processor/processor/parent_child_index_processor.py b/api/core/rag/index_processor/processor/parent_child_index_processor.pyindex 894b85339ac..1cde5e1c8fb 100644--- a/api/core/rag/index_processor/processor/parent_child_index_processor.py+++ b/api/core/rag/index_processor/processor/parent_child_index_processor.py@@ -39,6 +39,8 @@ class ParentChildIndexProcessor(BaseIndexProcessor):all_documents = [] # type: ignoreif rules.parent_mode == ParentMode.PARAGRAPH:# Split the text documents into nodes.+ if not rules.segmentation:+ raise ValueError("No segmentation found in rules.")splitter = self._get_splitter(processing_rule_mode=process_rule.get("mode"),max_tokens=rules.segmentation.max_tokens,diff --git a/api/models/model.py b/api/models/model.pyindex 05bc1fd3012..8262109ba5e 100644--- a/api/models/model.py+++ b/api/models/model.py@@ -791,7 +791,7 @@ class Conversation(db.Model): # type: ignore[name-defined]WorkflowRunStatus.SUCCEEDED: 0,WorkflowRunStatus.FAILED: 0,WorkflowRunStatus.STOPPED: 0,- WorkflowRunStatus.PARTIAL_SUCCESSED: 0,+ WorkflowRunStatus.PARTIAL_SUCCEEDED: 0,}for message in messages:@@ -802,7 +802,7 @@ class Conversation(db.Model): # type: ignore[name-defined]{"success": status_counts[WorkflowRunStatus.SUCCEEDED],"failed": status_counts[WorkflowRunStatus.FAILED],- "partial_success": status_counts[WorkflowRunStatus.PARTIAL_SUCCESSED],+ "partial_success": status_counts[WorkflowRunStatus.PARTIAL_SUCCEEDED],}if messageselse Nonediff --git a/api/models/workflow.py b/api/models/workflow.pyindex ed6820702c2..cefb2a7de39 100644--- a/api/models/workflow.py+++ b/api/models/workflow.py@@ -109,7 +109,7 @@ class Workflow(Base):tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)app_id: Mapped[str] = mapped_column(StringUUID, nullable=False)type: Mapped[str] = mapped_column(db.String(255), nullable=False)- version: Mapped[str]+ version: Mapped[str] = mapped_column(db.String(255), nullable=False)marked_name: Mapped[str] = mapped_column(default="", server_default="")marked_comment: Mapped[str] = mapped_column(default="", server_default="")graph: Mapped[str] = mapped_column(sa.Text)@@ -352,7 +352,7 @@ class WorkflowRunStatus(StrEnum):SUCCEEDED = "succeeded"FAILED = "failed"STOPPED = "stopped"- PARTIAL_SUCCESSED = "partial-succeeded"+ PARTIAL_SUCCEEDED = "partial-succeeded"class WorkflowRun(Base):diff --git a/api/services/entities/knowledge_entities/knowledge_entities.py b/api/services/entities/knowledge_entities/knowledge_entities.pyindex 6aa7b51d442..bb3be61f850 100644--- a/api/services/entities/knowledge_entities/knowledge_entities.py+++ b/api/services/entities/knowledge_entities/knowledge_entities.py@@ -1,4 +1,4 @@-from enum import Enum+from enum import StrEnumfrom typing import Literal, Optionalfrom pydantic import BaseModel@@ -11,7 +11,7 @@ class SegmentUpdateEntity(BaseModel):enabled: Optional[bool] = None-class ParentMode(str, Enum):+class ParentMode(StrEnum):FULL_DOC = "full-doc"PARAGRAPH = "paragraph"diff --git a/web/app/components/develop/template/template_workflow.zh.mdx b/web/app/components/develop/template/template_workflow.zh.mdxindex 75ca3df9257..939df2703df 100644--- a/web/app/components/develop/template/template_workflow.zh.mdx+++ b/web/app/components/develop/template/template_workflow.zh.mdx@@ -318,7 +318,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等---<Heading- url='/workflows/run/:workflow_id'+ url='/workflows/run/:workflow_run_id'method='GET'title='获取workflow执行情况'name='#get-workflow-run-detail'@@ -327,7 +327,7 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等<Col>根据 workflow 执行 ID 获取 workflow 任务当前执行结果### Path- - `workflow_id` (string) workflow 执行 ID,可在流式返回 Chunk 中获取+ - `workflow_run_id` (string) workflow_run_id,可在流式返回 Chunk 中获取### Response- `id` (string) workflow 执行 ID- `workflow_id` (string) 关联的 Workflow ID@@ -343,9 +343,9 @@ Workflow 应用无会话支持,适合用于翻译/文章写作/总结 AI 等</Col><Col sticky>### Request Example- <CodeGroup title="Request" tag="GET" label="/workflows/run/:workflow_id" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_id' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json'`}>+ <CodeGroup title="Request" tag="GET" label="/workflows/run/:workflow_run_id" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json'`}>```bash {{ title: 'cURL' }}- curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_id' \+ curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_run_id' \-H 'Authorization: Bearer {api_key}' \-H 'Content-Type: application/json'```