mirror of
https://github.com/langgenius/dify.git
synced 2025-11-14 10:20:05 +00:00
r2
This commit is contained in:
parent
b538eee5dd
commit
bd33b9ffec
@ -10,7 +10,6 @@ from controllers.console import api
|
|||||||
from controllers.console.app.error import (
|
from controllers.console.app.error import (
|
||||||
DraftWorkflowNotExist,
|
DraftWorkflowNotExist,
|
||||||
)
|
)
|
||||||
from controllers.console.app.wraps import get_app_model
|
|
||||||
from controllers.console.datasets.wraps import get_rag_pipeline
|
from controllers.console.datasets.wraps import get_rag_pipeline
|
||||||
from controllers.console.wraps import account_initialization_required, setup_required
|
from controllers.console.wraps import account_initialization_required, setup_required
|
||||||
from controllers.web.error import InvalidArgumentError, NotFoundError
|
from controllers.web.error import InvalidArgumentError, NotFoundError
|
||||||
@ -21,12 +20,11 @@ from core.workflow.constants import CONVERSATION_VARIABLE_NODE_ID, SYSTEM_VARIAB
|
|||||||
from factories.file_factory import build_from_mapping, build_from_mappings
|
from factories.file_factory import build_from_mapping, build_from_mappings
|
||||||
from factories.variable_factory import build_segment_with_type
|
from factories.variable_factory import build_segment_with_type
|
||||||
from libs.login import current_user, login_required
|
from libs.login import current_user, login_required
|
||||||
from models import App, AppMode, db
|
from models import db
|
||||||
from models.dataset import Pipeline
|
from models.dataset import Pipeline
|
||||||
from models.workflow import WorkflowDraftVariable
|
from models.workflow import WorkflowDraftVariable
|
||||||
from services.rag_pipeline.rag_pipeline import RagPipelineService
|
from services.rag_pipeline.rag_pipeline import RagPipelineService
|
||||||
from services.workflow_draft_variable_service import WorkflowDraftVariableList, WorkflowDraftVariableService
|
from services.workflow_draft_variable_service import WorkflowDraftVariableList, WorkflowDraftVariableService
|
||||||
from services.workflow_service import WorkflowService
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -399,8 +397,20 @@ api.add_resource(
|
|||||||
RagPipelineVariableCollectionApi,
|
RagPipelineVariableCollectionApi,
|
||||||
"/rag/pipelines/<uuid:pipeline_id>/workflows/draft/variables",
|
"/rag/pipelines/<uuid:pipeline_id>/workflows/draft/variables",
|
||||||
)
|
)
|
||||||
api.add_resource(RagPipelineNodeVariableCollectionApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/nodes/<string:node_id>/variables")
|
api.add_resource(
|
||||||
api.add_resource(RagPipelineVariableApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/variables/<uuid:variable_id>")
|
RagPipelineNodeVariableCollectionApi,
|
||||||
api.add_resource(RagPipelineVariableResetApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/variables/<uuid:variable_id>/reset")
|
"/rag/pipelines/<uuid:pipeline_id>/workflows/draft/nodes/<string:node_id>/variables",
|
||||||
api.add_resource(RagPipelineSystemVariableCollectionApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/system-variables")
|
)
|
||||||
api.add_resource(RagPipelineEnvironmentVariableCollectionApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/environment-variables")
|
api.add_resource(
|
||||||
|
RagPipelineVariableApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/variables/<uuid:variable_id>"
|
||||||
|
)
|
||||||
|
api.add_resource(
|
||||||
|
RagPipelineVariableResetApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/variables/<uuid:variable_id>/reset"
|
||||||
|
)
|
||||||
|
api.add_resource(
|
||||||
|
RagPipelineSystemVariableCollectionApi, "/rag/pipelines/<uuid:pipeline_id>/workflows/draft/system-variables"
|
||||||
|
)
|
||||||
|
api.add_resource(
|
||||||
|
RagPipelineEnvironmentVariableCollectionApi,
|
||||||
|
"/rag/pipelines/<uuid:pipeline_id>/workflows/draft/environment-variables",
|
||||||
|
)
|
||||||
|
|||||||
@ -960,7 +960,6 @@ class DatasourceListApi(Resource):
|
|||||||
|
|
||||||
|
|
||||||
class RagPipelineWorkflowLastRunApi(Resource):
|
class RagPipelineWorkflowLastRunApi(Resource):
|
||||||
|
|
||||||
@setup_required
|
@setup_required
|
||||||
@login_required
|
@login_required
|
||||||
@account_initialization_required
|
@account_initialization_required
|
||||||
|
|||||||
@ -694,10 +694,12 @@ class PipelineGenerator(BaseAppGenerator):
|
|||||||
datasource_info,
|
datasource_info,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
all_files.append({
|
all_files.append(
|
||||||
|
{
|
||||||
"key": datasource_info.get("key", ""),
|
"key": datasource_info.get("key", ""),
|
||||||
"bucket": datasource_info.get("bucket", None),
|
"bucket": datasource_info.get("bucket", None),
|
||||||
})
|
}
|
||||||
|
)
|
||||||
return all_files
|
return all_files
|
||||||
else:
|
else:
|
||||||
return datasource_info_list
|
return datasource_info_list
|
||||||
|
|||||||
@ -1090,7 +1090,6 @@ class RagPipelineService:
|
|||||||
db.session.add(pipeline_customized_template)
|
db.session.add(pipeline_customized_template)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
def is_workflow_exist(self, pipeline: Pipeline) -> bool:
|
def is_workflow_exist(self, pipeline: Pipeline) -> bool:
|
||||||
return (
|
return (
|
||||||
db.session.query(Workflow)
|
db.session.query(Workflow)
|
||||||
@ -1102,7 +1101,9 @@ class RagPipelineService:
|
|||||||
.count()
|
.count()
|
||||||
) > 0
|
) > 0
|
||||||
|
|
||||||
def get_node_last_run(self, pipeline: Pipeline, workflow: Workflow, node_id: str) -> WorkflowNodeExecutionModel | None:
|
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.
|
# TODO(QuantumGhost): This query is not fully covered by index.
|
||||||
criteria = (
|
criteria = (
|
||||||
WorkflowNodeExecutionModel.tenant_id == pipeline.tenant_id,
|
WorkflowNodeExecutionModel.tenant_id == pipeline.tenant_id,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user