mirror of
https://github.com/langgenius/dify.git
synced 2026-04-27 19:27:23 +08:00
two more
This commit is contained in:
parent
8611301722
commit
d428e01805
@ -1547,7 +1547,7 @@ class PipelineRecommendedPlugin(TypeBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SegmentAttachmentBinding(Base):
|
class SegmentAttachmentBinding(TypeBase):
|
||||||
__tablename__ = "segment_attachment_bindings"
|
__tablename__ = "segment_attachment_bindings"
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
sa.PrimaryKeyConstraint("id", name="segment_attachment_binding_pkey"),
|
sa.PrimaryKeyConstraint("id", name="segment_attachment_binding_pkey"),
|
||||||
@ -1560,10 +1560,12 @@ class SegmentAttachmentBinding(Base):
|
|||||||
),
|
),
|
||||||
sa.Index("segment_attachment_binding_attachment_idx", "attachment_id"),
|
sa.Index("segment_attachment_binding_attachment_idx", "attachment_id"),
|
||||||
)
|
)
|
||||||
id: Mapped[str] = mapped_column(StringUUID, default=lambda: str(uuidv7()))
|
id: Mapped[str] = mapped_column(StringUUID, default=lambda: str(uuidv7()), init=False)
|
||||||
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
||||||
dataset_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
dataset_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
||||||
document_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
document_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
||||||
segment_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
segment_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
||||||
attachment_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
attachment_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
||||||
created_at: Mapped[datetime] = mapped_column(sa.DateTime, nullable=False, server_default=func.current_timestamp())
|
created_at: Mapped[datetime] = mapped_column(
|
||||||
|
sa.DateTime, nullable=False, server_default=func.current_timestamp(), init=False
|
||||||
|
)
|
||||||
|
|||||||
@ -1711,7 +1711,7 @@ class ApiToken(Base): # bug: this uses setattr so idk the field.
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class UploadFile(Base):
|
class UploadFile(TypeBase):
|
||||||
__tablename__ = "upload_files"
|
__tablename__ = "upload_files"
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
sa.PrimaryKeyConstraint("id", name="upload_file_pkey"),
|
sa.PrimaryKeyConstraint("id", name="upload_file_pkey"),
|
||||||
@ -1721,7 +1721,7 @@ class UploadFile(Base):
|
|||||||
# NOTE: The `id` field is generated within the application to minimize extra roundtrips
|
# NOTE: The `id` field is generated within the application to minimize extra roundtrips
|
||||||
# (especially when generating `source_url`).
|
# (especially when generating `source_url`).
|
||||||
# The `server_default` serves as a fallback mechanism.
|
# The `server_default` serves as a fallback mechanism.
|
||||||
id: Mapped[str] = mapped_column(StringUUID, default=lambda: str(uuid4()))
|
id: Mapped[str] = mapped_column(StringUUID, default=lambda: str(uuid4()), init=False)
|
||||||
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
||||||
storage_type: Mapped[str] = mapped_column(String(255), nullable=False)
|
storage_type: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||||
key: Mapped[str] = mapped_column(String(255), nullable=False)
|
key: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||||
@ -1732,7 +1732,7 @@ class UploadFile(Base):
|
|||||||
|
|
||||||
# The `created_by_role` field indicates whether the file was created by an `Account` or an `EndUser`.
|
# The `created_by_role` field indicates whether the file was created by an `Account` or an `EndUser`.
|
||||||
# Its value is derived from the `CreatorUserRole` enumeration.
|
# Its value is derived from the `CreatorUserRole` enumeration.
|
||||||
created_by_role: Mapped[str] = mapped_column(String(255), nullable=False, server_default=sa.text("'account'"))
|
created_by_role: Mapped[CreatorUserRole] = mapped_column(String(255), nullable=False, server_default=sa.text("'account'"))
|
||||||
|
|
||||||
# The `created_by` field stores the ID of the entity that created this upload file.
|
# The `created_by` field stores the ID of the entity that created this upload file.
|
||||||
#
|
#
|
||||||
@ -1753,47 +1753,11 @@ class UploadFile(Base):
|
|||||||
used: Mapped[bool] = mapped_column(sa.Boolean, nullable=False, server_default=sa.text("false"))
|
used: Mapped[bool] = mapped_column(sa.Boolean, nullable=False, server_default=sa.text("false"))
|
||||||
|
|
||||||
# `used_by` may indicate the ID of the user who utilized this file.
|
# `used_by` may indicate the ID of the user who utilized this file.
|
||||||
used_by: Mapped[str | None] = mapped_column(StringUUID, nullable=True)
|
used_by: Mapped[str | None] = mapped_column(StringUUID, nullable=True, default=None)
|
||||||
used_at: Mapped[datetime | None] = mapped_column(sa.DateTime, nullable=True)
|
used_at: Mapped[datetime | None] = mapped_column(sa.DateTime, nullable=True, default=None)
|
||||||
hash: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
hash: Mapped[str | None] = mapped_column(String(255), nullable=True, default=None)
|
||||||
source_url: Mapped[str] = mapped_column(LongText, default="")
|
source_url: Mapped[str] = mapped_column(LongText, default="")
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
*,
|
|
||||||
tenant_id: str,
|
|
||||||
storage_type: str,
|
|
||||||
key: str,
|
|
||||||
name: str,
|
|
||||||
size: int,
|
|
||||||
extension: str,
|
|
||||||
mime_type: str,
|
|
||||||
created_by_role: CreatorUserRole,
|
|
||||||
created_by: str,
|
|
||||||
created_at: datetime,
|
|
||||||
used: bool,
|
|
||||||
used_by: str | None = None,
|
|
||||||
used_at: datetime | None = None,
|
|
||||||
hash: str | None = None,
|
|
||||||
source_url: str = "",
|
|
||||||
):
|
|
||||||
self.id = str(uuid.uuid4())
|
|
||||||
self.tenant_id = tenant_id
|
|
||||||
self.storage_type = storage_type
|
|
||||||
self.key = key
|
|
||||||
self.name = name
|
|
||||||
self.size = size
|
|
||||||
self.extension = extension
|
|
||||||
self.mime_type = mime_type
|
|
||||||
self.created_by_role = created_by_role.value
|
|
||||||
self.created_by = created_by
|
|
||||||
self.created_at = created_at
|
|
||||||
self.used = used
|
|
||||||
self.used_by = used_by
|
|
||||||
self.used_at = used_at
|
|
||||||
self.hash = hash
|
|
||||||
self.source_url = source_url
|
|
||||||
|
|
||||||
|
|
||||||
class ApiRequest(TypeBase):
|
class ApiRequest(TypeBase):
|
||||||
__tablename__ = "api_requests"
|
__tablename__ = "api_requests"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user