From df5b26179a5457498b08603d98744fe12b22c591 Mon Sep 17 00:00:00 2001 From: ziqiang <1694392889@qq.com> Date: Fri, 20 Jun 2025 15:08:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(workflow):=20=E6=B7=BB=E5=8A=A0=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=98=9F=E5=88=97=E8=8A=82=E7=82=B9=20(MqNode)=20?= =?UTF-8?q?=E5=8F=8A=E5=85=B6=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=E5=92=8C?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/core/app/apps/workflow/app_generator.py | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/api/core/app/apps/workflow/app_generator.py b/api/core/app/apps/workflow/app_generator.py index 7f4770fc97..e03d0e22c7 100644 --- a/api/core/app/apps/workflow/app_generator.py +++ b/api/core/app/apps/workflow/app_generator.py @@ -2,6 +2,8 @@ import contextvars import logging import threading import uuid +import requests +import os from collections.abc import Generator, Mapping, Sequence from typing import Any, Literal, Optional, Union, overload @@ -116,6 +118,26 @@ class WorkflowAppGenerator(BaseAppGenerator): inputs: Mapping[str, Any] = args["inputs"] workflow_run_id = str(uuid.uuid4()) + + try: + dify_started_url = os.environ["ZZ_DIFY_STARTED_URL"] + print("gogogo:" + dify_started_url); + payload = { + "app": app_model.name, + "app_id": app_model.id, + "user": "abc-123", + "workflow_run_id": workflow_run_id # Adding the workflow_run_id to the payload + } + headers = { + "Content-Type": "application/json" + } + response = requests.post(dify_started_url, json=payload, headers=headers) + response.raise_for_status() # Raise an exception for HTTP errors + except Exception as e: + # Handle or log the error appropriately + print(f"Failed to send difyStarted notification: {e}") + + # init application generate entity application_generate_entity = WorkflowAppGenerateEntity( task_id=str(uuid.uuid4()),