mirror of
https://github.com/langgenius/dify.git
synced 2025-11-24 08:52:43 +00:00
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
import enum
|
|
from datetime import datetime
|
|
from uuid import uuid4
|
|
|
|
import sqlalchemy as sa
|
|
from sqlalchemy import DateTime, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from .base import TypeBase
|
|
from .types import LongText, StringUUID
|
|
|
|
|
|
class APIBasedExtensionPoint(enum.StrEnum):
|
|
APP_EXTERNAL_DATA_TOOL_QUERY = "app.external_data_tool.query"
|
|
PING = "ping"
|
|
APP_MODERATION_INPUT = "app.moderation.input"
|
|
APP_MODERATION_OUTPUT = "app.moderation.output"
|
|
|
|
|
|
class APIBasedExtension(TypeBase):
|
|
__tablename__ = "api_based_extensions"
|
|
__table_args__ = (
|
|
sa.PrimaryKeyConstraint("id", name="api_based_extension_pkey"),
|
|
sa.Index("api_based_extension_tenant_idx", "tenant_id"),
|
|
)
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, default=lambda: str(uuid4()), init=False)
|
|
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
api_endpoint: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
api_key: Mapped[str] = mapped_column(LongText, nullable=False)
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
DateTime, nullable=False, server_default=func.current_timestamp(), init=False
|
|
)
|