This commit is contained in:
jyong
2025-05-15 15:14:52 +08:00
parent 3f1363503b
commit 818eb46a8b
21 changed files with 2117 additions and 149 deletions

View File

@ -63,6 +63,10 @@ class Dataset(db.Model): # type: ignore[name-defined]
collection_binding_id = db.Column(StringUUID, nullable=True)
retrieval_model = db.Column(JSONB, nullable=True)
built_in_field_enabled = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
icon_info = db.Column(JSONB, nullable=True)
runtime_mode = db.Column(db.String(255), nullable=True, server_default=db.text("'general'::character varying"))
pipeline_id = db.Column(StringUUID, nullable=True)
chunk_structure = db.Column(db.String(255), nullable=True)
@property
def dataset_keyword_table(self):

View File

@ -51,6 +51,40 @@ class BuiltinToolProvider(Base):
return cast(dict, json.loads(self.encrypted_credentials))
class BuiltinDatasourceProvider(Base):
"""
This table stores the datasource provider information for built-in datasources for each tenant.
"""
__tablename__ = "tool_builtin_datasource_providers"
__table_args__ = (
db.PrimaryKeyConstraint("id", name="tool_builtin_datasource_provider_pkey"),
# one tenant can only have one tool provider with the same name
db.UniqueConstraint("tenant_id", "provider", name="unique_builtin_datasource_provider"),
)
# id of the tool provider
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
# id of the tenant
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=True)
# who created this tool provider
user_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
# name of the tool provider
provider: Mapped[str] = mapped_column(db.String(256), nullable=False)
# credential of the tool provider
encrypted_credentials: Mapped[str] = mapped_column(db.Text, nullable=True)
created_at: Mapped[datetime] = mapped_column(
db.DateTime, nullable=False, server_default=db.text("CURRENT_TIMESTAMP(0)")
)
updated_at: Mapped[datetime] = mapped_column(
db.DateTime, nullable=False, server_default=db.text("CURRENT_TIMESTAMP(0)")
)
@property
def credentials(self) -> dict:
return cast(dict, json.loads(self.encrypted_credentials))
class ApiToolProvider(Base):
"""
The table stores the api providers.