From 8a86a2c81727e3c499fbbd5d6287c8e20c19abab Mon Sep 17 00:00:00 2001 From: jyong <718720800@qq.com> Date: Thu, 5 Jun 2025 14:09:50 +0800 Subject: [PATCH] r2 --- .../app/apps/pipeline/pipeline_generator.py | 6 ++-- api/core/entities/knowledge_entities.py | 1 + ...5_1356-d466c551816f_add_pipeline_info_5.py | 35 +++++++++++++++++++ api/models/oauth.py | 2 +- api/services/datasource_provider_service.py | 2 +- 5 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 api/migrations/versions/2025_06_05_1356-d466c551816f_add_pipeline_info_5.py diff --git a/api/core/app/apps/pipeline/pipeline_generator.py b/api/core/app/apps/pipeline/pipeline_generator.py index 82560175b7..54491609bb 100644 --- a/api/core/app/apps/pipeline/pipeline_generator.py +++ b/api/core/app/apps/pipeline/pipeline_generator.py @@ -157,7 +157,7 @@ class PipelineGenerator(BaseAppGenerator): stream=streaming, invoke_from=invoke_from, call_depth=call_depth, - workflow_run_id=workflow_run_id, + workflow_execution_id=workflow_run_id, ) contexts.plugin_tool_providers.set({}) @@ -379,7 +379,7 @@ class PipelineGenerator(BaseAppGenerator): stream=streaming, invoke_from=InvokeFrom.DEBUGGER, call_depth=0, - workflow_run_id=str(uuid.uuid4()), + workflow_execution_id=str(uuid.uuid4()), ) contexts.plugin_tool_providers.set({}) contexts.plugin_tool_providers_lock.set(threading.Lock()) @@ -461,7 +461,7 @@ class PipelineGenerator(BaseAppGenerator): invoke_from=InvokeFrom.DEBUGGER, extras={"auto_generate_conversation_name": False}, single_loop_run=RagPipelineGenerateEntity.SingleLoopRunEntity(node_id=node_id, inputs=args["inputs"]), - workflow_run_id=str(uuid.uuid4()), + workflow_execution_id=str(uuid.uuid4()), ) contexts.plugin_tool_providers.set({}) contexts.plugin_tool_providers_lock.set(threading.Lock()) diff --git a/api/core/entities/knowledge_entities.py b/api/core/entities/knowledge_entities.py index 3beea56e15..63fce06005 100644 --- a/api/core/entities/knowledge_entities.py +++ b/api/core/entities/knowledge_entities.py @@ -29,6 +29,7 @@ class PipelineDataset(BaseModel): class PipelineDocument(BaseModel): id: str position: int + data_source_type: str data_source_info: Optional[dict] = None name: str indexing_status: str diff --git a/api/migrations/versions/2025_06_05_1356-d466c551816f_add_pipeline_info_5.py b/api/migrations/versions/2025_06_05_1356-d466c551816f_add_pipeline_info_5.py new file mode 100644 index 0000000000..56860d1f80 --- /dev/null +++ b/api/migrations/versions/2025_06_05_1356-d466c551816f_add_pipeline_info_5.py @@ -0,0 +1,35 @@ +"""add_pipeline_info_5 + +Revision ID: d466c551816f +Revises: e4fb49a4fe86 +Create Date: 2025-06-05 13:56:05.962215 + +""" +from alembic import op +import models as models +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'd466c551816f' +down_revision = 'e4fb49a4fe86' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('datasource_providers', schema=None) as batch_op: + batch_op.drop_constraint(batch_op.f('datasource_provider_plugin_id_provider_idx'), type_='unique') + batch_op.create_index('datasource_provider_auth_type_provider_idx', ['tenant_id', 'plugin_id', 'provider'], unique=False) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('datasource_providers', schema=None) as batch_op: + batch_op.drop_index('datasource_provider_auth_type_provider_idx') + batch_op.create_unique_constraint(batch_op.f('datasource_provider_plugin_id_provider_idx'), ['plugin_id', 'provider']) + + # ### end Alembic commands ### diff --git a/api/models/oauth.py b/api/models/oauth.py index 938a309069..b1b09e5d45 100644 --- a/api/models/oauth.py +++ b/api/models/oauth.py @@ -25,7 +25,7 @@ class DatasourceProvider(Base): __tablename__ = "datasource_providers" __table_args__ = ( db.PrimaryKeyConstraint("id", name="datasource_provider_pkey"), - db.UniqueConstraint("plugin_id", "provider", name="datasource_provider_auth_type_provider_idx"), + db.Index("datasource_provider_auth_type_provider_idx", "tenant_id", "plugin_id", "provider"), ) id = db.Column(StringUUID, server_default=db.text("uuid_generate_v4()")) tenant_id = db.Column(StringUUID, nullable=False) diff --git a/api/services/datasource_provider_service.py b/api/services/datasource_provider_service.py index ffc056921b..5bede09a64 100644 --- a/api/services/datasource_provider_service.py +++ b/api/services/datasource_provider_service.py @@ -104,7 +104,7 @@ class DatasourceProviderService: for datasource_provider in datasource_providers: encrypted_credentials = datasource_provider.encrypted_credentials # Get provider credential secret variables - credential_secret_variables = self.extract_secret_variables(tenant_id=tenant_id, provider_id=provider) + credential_secret_variables = self.extract_secret_variables(tenant_id=tenant_id, provider_id=f"{plugin_id}/{provider}") # Obfuscate provider credentials copy_credentials = encrypted_credentials.copy()