diff --git a/api/services/workflow_comment_service.py b/api/services/workflow_comment_service.py index 12039811c3..93b2d2f01e 100644 --- a/api/services/workflow_comment_service.py +++ b/api/services/workflow_comment_service.py @@ -5,6 +5,7 @@ from sqlalchemy import desc, select from sqlalchemy.orm import Session, selectinload from werkzeug.exceptions import Forbidden, NotFound +from configs import dify_config from extensions.ext_database import db from libs.datetime_utils import naive_utc_now from libs.helper import uuid_value @@ -61,7 +62,7 @@ class WorkflowCommentService: mentioned_user_ids: Sequence[str], content: str, ) -> list[dict[str, str]]: - """Prepare email payloads for mentioned users.""" + """Prepare email payloads for mentioned users, including the workflow app link.""" if not mentioned_user_ids: return [] @@ -72,6 +73,8 @@ class WorkflowCommentService: app_name = session.scalar(select(App.name).where(App.id == app_id, App.tenant_id == tenant_id)) or "Dify app" commenter_name = session.scalar(select(Account.name).where(Account.id == mentioner_id)) or "Dify user" comment_excerpt = WorkflowCommentService._format_comment_excerpt(content) + base_url = dify_config.CONSOLE_WEB_URL.rstrip("/") + app_url = f"{base_url}/app/{app_id}/workflow" accounts = session.scalars( select(Account) @@ -89,6 +92,7 @@ class WorkflowCommentService: "commenter_name": commenter_name, "app_name": app_name, "comment_content": comment_excerpt, + "app_url": app_url, } ) return payloads diff --git a/api/tasks/mail_workflow_comment_task.py b/api/tasks/mail_workflow_comment_task.py index d80db7d55f..36d51f0514 100644 --- a/api/tasks/mail_workflow_comment_task.py +++ b/api/tasks/mail_workflow_comment_task.py @@ -18,6 +18,7 @@ def send_workflow_comment_mention_email_task( commenter_name: str, app_name: str, comment_content: str, + app_url: str, ): """ Send workflow comment mention email with internationalization support. @@ -29,6 +30,7 @@ def send_workflow_comment_mention_email_task( commenter_name: Name of the comment author app_name: Name of the app where the comment was made comment_content: Comment content excerpt + app_url: Link to the app workflow page """ if not mail.is_inited(): return @@ -48,6 +50,7 @@ def send_workflow_comment_mention_email_task( "commenter_name": commenter_name, "app_name": app_name, "comment_content": comment_content, + "app_url": app_url, }, ) diff --git a/api/templates/without-brand/workflow_comment_mention_template_en-US.html b/api/templates/without-brand/workflow_comment_mention_template_en-US.html index dac52eb293..1ef8fe4e3f 100644 --- a/api/templates/without-brand/workflow_comment_mention_template_en-US.html +++ b/api/templates/without-brand/workflow_comment_mention_template_en-US.html @@ -112,7 +112,7 @@
Open {{ application_title }} to reply to the comment.
+Open {{ application_title }} to reply to the comment.
{{ comment_content }}