feat(workflow): add support for passing workspace ID

This commit is contained in:
mengyonghao
2026-01-05 10:51:57 +08:00
parent 55dac533d9
commit bf6ede64bd
2 changed files with 9 additions and 6 deletions

View File

@@ -597,7 +597,8 @@ async def draft_run(
async for event in workflow_service.run_stream(
app_id=app_id,
payload=payload,
config=config
config=config,
workspace_id=current_user.current_workspace_id
):
# 提取事件类型和数据
event_type = event.get("event", "message")
@@ -627,7 +628,7 @@ async def draft_run(
}
)
result = await workflow_service.run(app_id, payload,config)
result = await workflow_service.run(app_id, payload, config, current_user.current_workspace_id)
logger.debug(
"工作流试运行返回结果",

View File

@@ -410,7 +410,8 @@ class WorkflowService:
self,
app_id: uuid.UUID,
payload: DraftRunRequest,
config: WorkflowConfig
config: WorkflowConfig,
workspace_id: uuid.UUID,
):
"""运行工作流
@@ -484,7 +485,7 @@ class WorkflowService:
workflow_config=workflow_config_dict,
input_data=input_data,
execution_id=execution.execution_id,
workspace_id="",
workspace_id=str(workspace_id),
user_id=payload.user_id
)
@@ -530,7 +531,8 @@ class WorkflowService:
self,
app_id: uuid.UUID,
payload: DraftRunRequest,
config: WorkflowConfig
config: WorkflowConfig,
workspace_id: uuid.UUID,
):
"""运行工作流(流式)
@@ -603,7 +605,7 @@ class WorkflowService:
workflow_config=workflow_config_dict,
input_data=input_data,
execution_id=execution.execution_id,
workspace_id="",
workspace_id=str(workspace_id),
user_id=payload.user_id
):
# 直接转发 executor 的事件(已经是正确的格式)