This commit is contained in:
jyong
2025-07-09 17:34:42 +08:00
parent b538eee5dd
commit bd33b9ffec
4 changed files with 39 additions and 27 deletions

View File

@ -1090,19 +1090,20 @@ class RagPipelineService:
db.session.add(pipeline_customized_template)
db.session.commit()
def is_workflow_exist(self, pipeline: Pipeline) -> bool:
return (
db.session.query(Workflow)
.filter(
Workflow.tenant_id == pipeline.tenant_id,
Workflow.app_id == pipeline.id,
Workflow.version == Workflow.VERSION_DRAFT,
)
.count()
) > 0
def get_node_last_run(self, pipeline: Pipeline, workflow: Workflow, node_id: str) -> WorkflowNodeExecutionModel | None:
return (
db.session.query(Workflow)
.filter(
Workflow.tenant_id == pipeline.tenant_id,
Workflow.app_id == pipeline.id,
Workflow.version == Workflow.VERSION_DRAFT,
)
.count()
) > 0
def get_node_last_run(
self, pipeline: Pipeline, workflow: Workflow, node_id: str
) -> WorkflowNodeExecutionModel | None:
# TODO(QuantumGhost): This query is not fully covered by index.
criteria = (
WorkflowNodeExecutionModel.tenant_id == pipeline.tenant_id,
@ -1116,4 +1117,4 @@ class RagPipelineService:
.order_by(WorkflowNodeExecutionModel.created_at.desc())
.first()
)
return node_exec
return node_exec