mirror of
https://github.com/langgenius/dify.git
synced 2026-01-14 06:07:33 +08:00
WIP: pause reasons
This commit is contained in:
parent
5b690f056d
commit
c7957d5740
@ -2,7 +2,6 @@
|
||||
Console/Studio Human Input Form APIs.
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
from collections.abc import Generator
|
||||
|
||||
|
||||
@ -406,12 +406,12 @@ class Workflow(Base): # bug
|
||||
|
||||
return helper.generate_text_hash(json.dumps(entity, sort_keys=True))
|
||||
|
||||
@property
|
||||
@deprecated(
|
||||
"This property is not accurate for determining if a workflow is published as a tool."
|
||||
"It only checks if there's a WorkflowToolProvider for the app, "
|
||||
"not if this specific workflow version is the one being used by the tool."
|
||||
)
|
||||
@property
|
||||
def tool_published(self) -> bool:
|
||||
"""
|
||||
DEPRECATED: This property is not accurate for determining if a workflow is published as a tool.
|
||||
|
||||
@ -6,9 +6,39 @@ by the core workflow module. These models are independent of the storage mechani
|
||||
and don't contain implementation details like tenant_id, app_id, etc.
|
||||
"""
|
||||
|
||||
import enum
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import Sequence
|
||||
from datetime import datetime
|
||||
from typing import Annotated, Literal, TypeAlias
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from sqlalchemy import Sequence
|
||||
|
||||
|
||||
class _PauseTypeEnum(enum.StrEnum):
|
||||
human_input = enum.auto()
|
||||
breakpoint = enum.auto()
|
||||
scheduling = enum.auto()
|
||||
|
||||
|
||||
class HumanInputPause(BaseModel):
|
||||
type: Literal[_PauseTypeEnum.human_input] = _PauseTypeEnum.human_input
|
||||
form_id: str
|
||||
|
||||
|
||||
class SchedulingPause(BaseModel):
|
||||
type: Literal[_PauseTypeEnum.scheduling] = _PauseTypeEnum.scheduling
|
||||
|
||||
|
||||
PauseType: TypeAlias = Annotated[HumanInputPause | SchedulingPause, Field(discriminator="type")]
|
||||
|
||||
|
||||
class PauseDetail(BaseModel):
|
||||
node_id: str
|
||||
node_title: str
|
||||
pause_type: PauseType
|
||||
|
||||
|
||||
from core.workflow.entities.pause_reason import PauseReason
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ from sqlalchemy import Engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
import contexts
|
||||
from core.workflow.entities.workflow_pause import PauseDetail
|
||||
from extensions.ext_database import db
|
||||
from libs.infinite_scroll_pagination import InfiniteScrollPagination
|
||||
from models import (
|
||||
@ -159,3 +160,9 @@ class WorkflowRunService:
|
||||
app_id=app_model.id,
|
||||
workflow_run_id=run_id,
|
||||
)
|
||||
|
||||
def get_pause_details(self, workflow_run_id: str) -> Sequence[PauseDetail]:
|
||||
pause = self._workflow_run_repo.get_workflow_pause(workflow_run_id)
|
||||
if pause is None:
|
||||
return []
|
||||
return pause.get_pause_details()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user