Merge branch 'main' into feat/trigger

This commit is contained in:
Yeuoly
2025-09-01 18:05:31 +08:00
480 changed files with 10562 additions and 4040 deletions

View File

@ -7,7 +7,7 @@ from typing import TYPE_CHECKING, Any, Optional, Union
from uuid import uuid4
import sqlalchemy as sa
from sqlalchemy import DateTime, orm
from sqlalchemy import DateTime, exists, orm, select
from core.file.constants import maybe_file_object
from core.file.models import File
@ -336,12 +336,13 @@ class Workflow(Base):
"""
from models.tools import WorkflowToolProvider
return (
db.session.query(WorkflowToolProvider)
.where(WorkflowToolProvider.tenant_id == self.tenant_id, WorkflowToolProvider.app_id == self.app_id)
.count()
> 0
stmt = select(
exists().where(
WorkflowToolProvider.tenant_id == self.tenant_id,
WorkflowToolProvider.app_id == self.app_id,
)
)
return db.session.execute(stmt).scalar_one()
@property
def environment_variables(self) -> Sequence[StringVariable | IntegerVariable | FloatVariable | SecretVariable]:
@ -921,7 +922,7 @@ def _naive_utc_datetime():
class WorkflowDraftVariable(Base):
"""`WorkflowDraftVariable` record variables and outputs generated during
debugging worfklow or chatflow.
debugging workflow or chatflow.
IMPORTANT: This model maintains multiple invariant rules that must be preserved.
Do not instantiate this class directly with the constructor.