mirror of https://github.com/langgenius/dify.git
Merge branch 'feat/r2' into deploy/rag-dev
This commit is contained in:
commit
14d5af468c
|
|
@ -0,0 +1,43 @@
|
|||
"""add_pipeline_info_6
|
||||
|
||||
Revision ID: 224fba149d48
|
||||
Revises: d466c551816f
|
||||
Create Date: 2025-06-11 11:55:01.179201
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import models as models
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '224fba149d48'
|
||||
down_revision = 'd466c551816f'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('pipeline_built_in_templates', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('created_by', models.types.StringUUID(), nullable=False))
|
||||
batch_op.add_column(sa.Column('updated_by', models.types.StringUUID(), nullable=True))
|
||||
|
||||
with op.batch_alter_table('pipeline_customized_templates', schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column('created_by', models.types.StringUUID(), nullable=False))
|
||||
batch_op.add_column(sa.Column('updated_by', models.types.StringUUID(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('pipeline_customized_templates', schema=None) as batch_op:
|
||||
batch_op.drop_column('updated_by')
|
||||
batch_op.drop_column('created_by')
|
||||
|
||||
with op.batch_alter_table('pipeline_built_in_templates', schema=None) as batch_op:
|
||||
batch_op.drop_column('updated_by')
|
||||
batch_op.drop_column('created_by')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1202,6 +1202,15 @@ class PipelineBuiltInTemplate(Base): # type: ignore[name-defined]
|
|||
language = db.Column(db.String(255), nullable=False)
|
||||
created_at = db.Column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
||||
updated_at = db.Column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
||||
created_by = db.Column(StringUUID, nullable=False)
|
||||
updated_by = db.Column(StringUUID, nullable=True)
|
||||
|
||||
@property
|
||||
def created_user_name(self):
|
||||
account = db.session.query(Account).filter(Account.id == self.created_by).first()
|
||||
if account:
|
||||
return account.name
|
||||
return ""
|
||||
|
||||
|
||||
class PipelineCustomizedTemplate(Base): # type: ignore[name-defined]
|
||||
|
|
@ -1221,9 +1230,18 @@ class PipelineCustomizedTemplate(Base): # type: ignore[name-defined]
|
|||
yaml_content = db.Column(db.Text, nullable=False)
|
||||
install_count = db.Column(db.Integer, nullable=False, default=0)
|
||||
language = db.Column(db.String(255), nullable=False)
|
||||
created_by = db.Column(StringUUID, nullable=False)
|
||||
updated_by = db.Column(StringUUID, nullable=True)
|
||||
created_at = db.Column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
||||
updated_at = db.Column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
||||
|
||||
@property
|
||||
def created_user_name(self):
|
||||
account = db.session.query(Account).filter(Account.id == self.created_by).first()
|
||||
if account:
|
||||
return account.name
|
||||
return ""
|
||||
|
||||
|
||||
class Pipeline(Base): # type: ignore[name-defined]
|
||||
__tablename__ = "pipelines"
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ class CustomizedPipelineTemplateRetrieval(PipelineTemplateRetrievalBase):
|
|||
return {
|
||||
"id": pipeline_template.id,
|
||||
"name": pipeline_template.name,
|
||||
"icon": pipeline_template.icon,
|
||||
"icon_info": pipeline_template.icon,
|
||||
"description": pipeline_template.description,
|
||||
"chunk_structure": pipeline_template.chunk_structure,
|
||||
"export_data": yaml.safe_load(pipeline_template.yaml_content),
|
||||
"created_by": pipeline_template.created_user_name,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ class DatabasePipelineTemplateRetrieval(PipelineTemplateRetrievalBase):
|
|||
return {
|
||||
"id": pipeline_template.id,
|
||||
"name": pipeline_template.name,
|
||||
"icon": pipeline_template.icon,
|
||||
"icon_info": pipeline_template.icon,
|
||||
"chunk_structure": pipeline_template.chunk_structure,
|
||||
"export_data": yaml.safe_load(pipeline_template.yaml_content),
|
||||
"created_by": pipeline_template.created_user_name,
|
||||
"description": pipeline_template.description,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ class RagPipelineService:
|
|||
customized_template.name = template_info.name
|
||||
customized_template.description = template_info.description
|
||||
customized_template.icon = template_info.icon_info.model_dump()
|
||||
customized_template.updated_by = current_user.id
|
||||
db.session.commit()
|
||||
return customized_template
|
||||
|
||||
|
|
@ -694,7 +695,6 @@ class RagPipelineService:
|
|||
db.session.add(document)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
return workflow_node_execution
|
||||
|
||||
def update_workflow(
|
||||
|
|
@ -969,6 +969,7 @@ class RagPipelineService:
|
|||
position=max_position + 1 if max_position else 1,
|
||||
chunk_structure=dataset.chunk_structure,
|
||||
language="en-US",
|
||||
created_by=current_user.id,
|
||||
)
|
||||
db.session.add(pipeline_customized_template)
|
||||
db.session.commit()
|
||||
|
|
|
|||
Loading…
Reference in New Issue