|
|
|
@ -19,7 +19,7 @@ from flask import request
|
|
|
|
from flask_login import UserMixin
|
|
|
|
from flask_login import UserMixin
|
|
|
|
from sqlalchemy import Float, Index, PrimaryKeyConstraint, func, text
|
|
|
|
from sqlalchemy import Float, Index, PrimaryKeyConstraint, func, text
|
|
|
|
from sqlalchemy.orm import Mapped, Session, mapped_column
|
|
|
|
from sqlalchemy.orm import Mapped, Session, mapped_column
|
|
|
|
|
|
|
|
from sqlalchemy.types import String
|
|
|
|
from configs import dify_config
|
|
|
|
from configs import dify_config
|
|
|
|
from constants import DEFAULT_FILE_NUMBER_LIMITS
|
|
|
|
from constants import DEFAULT_FILE_NUMBER_LIMITS
|
|
|
|
from core.file import FILE_MODEL_IDENTITY, File, FileTransferMethod, FileType
|
|
|
|
from core.file import FILE_MODEL_IDENTITY, File, FileTransferMethod, FileType
|
|
|
|
@ -40,7 +40,7 @@ class DifySetup(Base):
|
|
|
|
__tablename__ = "dify_setups"
|
|
|
|
__tablename__ = "dify_setups"
|
|
|
|
__table_args__ = (db.PrimaryKeyConstraint("version", name="dify_setup_pkey"),)
|
|
|
|
__table_args__ = (db.PrimaryKeyConstraint("version", name="dify_setup_pkey"),)
|
|
|
|
|
|
|
|
|
|
|
|
version = mapped_column(db.String(255), nullable=False)
|
|
|
|
version = mapped_column(String(255), nullable=False)
|
|
|
|
setup_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
setup_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -76,15 +76,15 @@ class App(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
tenant_id: Mapped[str] = mapped_column(StringUUID)
|
|
|
|
tenant_id: Mapped[str] = mapped_column(StringUUID)
|
|
|
|
name: Mapped[str] = mapped_column(db.String(255))
|
|
|
|
name: Mapped[str] = mapped_column(String(255))
|
|
|
|
description: Mapped[str] = mapped_column(db.Text, server_default=db.text("''::character varying"))
|
|
|
|
description: Mapped[str] = mapped_column(db.Text, server_default=db.text("''::character varying"))
|
|
|
|
mode: Mapped[str] = mapped_column(db.String(255))
|
|
|
|
mode: Mapped[str] = mapped_column(String(255))
|
|
|
|
icon_type: Mapped[Optional[str]] = mapped_column(db.String(255)) # image, emoji
|
|
|
|
icon_type: Mapped[Optional[str]] = mapped_column(String(255)) # image, emoji
|
|
|
|
icon = db.Column(db.String(255))
|
|
|
|
icon = db.Column(String(255))
|
|
|
|
icon_background: Mapped[Optional[str]] = mapped_column(db.String(255))
|
|
|
|
icon_background: Mapped[Optional[str]] = mapped_column(String(255))
|
|
|
|
app_model_config_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
app_model_config_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
workflow_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
workflow_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
status: Mapped[str] = mapped_column(db.String(255), server_default=db.text("'normal'::character varying"))
|
|
|
|
status: Mapped[str] = mapped_column(String(255), server_default=db.text("'normal'::character varying"))
|
|
|
|
enable_site: Mapped[bool] = mapped_column(db.Boolean)
|
|
|
|
enable_site: Mapped[bool] = mapped_column(db.Boolean)
|
|
|
|
enable_api: Mapped[bool] = mapped_column(db.Boolean)
|
|
|
|
enable_api: Mapped[bool] = mapped_column(db.Boolean)
|
|
|
|
api_rpm: Mapped[int] = mapped_column(db.Integer, server_default=db.text("0"))
|
|
|
|
api_rpm: Mapped[int] = mapped_column(db.Integer, server_default=db.text("0"))
|
|
|
|
@ -309,8 +309,8 @@ class AppModelConfig(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
provider = mapped_column(db.String(255), nullable=True)
|
|
|
|
provider = mapped_column(String(255), nullable=True)
|
|
|
|
model_id = mapped_column(db.String(255), nullable=True)
|
|
|
|
model_id = mapped_column(String(255), nullable=True)
|
|
|
|
configs = mapped_column(db.JSON, nullable=True)
|
|
|
|
configs = mapped_column(db.JSON, nullable=True)
|
|
|
|
created_by = mapped_column(StringUUID, nullable=True)
|
|
|
|
created_by = mapped_column(StringUUID, nullable=True)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
@ -324,12 +324,12 @@ class AppModelConfig(Base):
|
|
|
|
more_like_this = mapped_column(db.Text)
|
|
|
|
more_like_this = mapped_column(db.Text)
|
|
|
|
model = mapped_column(db.Text)
|
|
|
|
model = mapped_column(db.Text)
|
|
|
|
user_input_form = mapped_column(db.Text)
|
|
|
|
user_input_form = mapped_column(db.Text)
|
|
|
|
dataset_query_variable = mapped_column(db.String(255))
|
|
|
|
dataset_query_variable = mapped_column(String(255))
|
|
|
|
pre_prompt = mapped_column(db.Text)
|
|
|
|
pre_prompt = mapped_column(db.Text)
|
|
|
|
agent_mode = mapped_column(db.Text)
|
|
|
|
agent_mode = mapped_column(db.Text)
|
|
|
|
sensitive_word_avoidance = mapped_column(db.Text)
|
|
|
|
sensitive_word_avoidance = mapped_column(db.Text)
|
|
|
|
retriever_resource = mapped_column(db.Text)
|
|
|
|
retriever_resource = mapped_column(db.Text)
|
|
|
|
prompt_type = mapped_column(db.String(255), nullable=False, server_default=db.text("'simple'::character varying"))
|
|
|
|
prompt_type = mapped_column(String(255), nullable=False, server_default=db.text("'simple'::character varying"))
|
|
|
|
chat_prompt_config = mapped_column(db.Text)
|
|
|
|
chat_prompt_config = mapped_column(db.Text)
|
|
|
|
completion_prompt_config = mapped_column(db.Text)
|
|
|
|
completion_prompt_config = mapped_column(db.Text)
|
|
|
|
dataset_configs = mapped_column(db.Text)
|
|
|
|
dataset_configs = mapped_column(db.Text)
|
|
|
|
@ -564,14 +564,14 @@ class RecommendedApp(Base):
|
|
|
|
id = mapped_column(StringUUID, primary_key=True, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, primary_key=True, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
description = mapped_column(db.JSON, nullable=False)
|
|
|
|
description = mapped_column(db.JSON, nullable=False)
|
|
|
|
copyright = mapped_column(db.String(255), nullable=False)
|
|
|
|
copyright = mapped_column(String(255), nullable=False)
|
|
|
|
privacy_policy = mapped_column(db.String(255), nullable=False)
|
|
|
|
privacy_policy = mapped_column(String(255), nullable=False)
|
|
|
|
custom_disclaimer: Mapped[str] = mapped_column(sa.TEXT, default="")
|
|
|
|
custom_disclaimer: Mapped[str] = mapped_column(sa.TEXT, default="")
|
|
|
|
category = mapped_column(db.String(255), nullable=False)
|
|
|
|
category = mapped_column(String(255), nullable=False)
|
|
|
|
position = mapped_column(db.Integer, nullable=False, default=0)
|
|
|
|
position = mapped_column(db.Integer, nullable=False, default=0)
|
|
|
|
is_listed = mapped_column(db.Boolean, nullable=False, default=True)
|
|
|
|
is_listed = mapped_column(db.Boolean, nullable=False, default=True)
|
|
|
|
install_count = mapped_column(db.Integer, nullable=False, default=0)
|
|
|
|
install_count = mapped_column(db.Integer, nullable=False, default=0)
|
|
|
|
language = mapped_column(db.String(255), nullable=False, server_default=db.text("'en-US'::character varying"))
|
|
|
|
language = mapped_column(String(255), nullable=False, server_default=db.text("'en-US'::character varying"))
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
updated_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
updated_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
@ -620,26 +620,26 @@ class Conversation(Base):
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_model_config_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
app_model_config_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
model_provider = mapped_column(db.String(255), nullable=True)
|
|
|
|
model_provider = mapped_column(String(255), nullable=True)
|
|
|
|
override_model_configs = mapped_column(db.Text)
|
|
|
|
override_model_configs = mapped_column(db.Text)
|
|
|
|
model_id = mapped_column(db.String(255), nullable=True)
|
|
|
|
model_id = mapped_column(String(255), nullable=True)
|
|
|
|
mode: Mapped[str] = mapped_column(db.String(255))
|
|
|
|
mode: Mapped[str] = mapped_column(String(255))
|
|
|
|
name = mapped_column(db.String(255), nullable=False)
|
|
|
|
name = mapped_column(String(255), nullable=False)
|
|
|
|
summary = mapped_column(db.Text)
|
|
|
|
summary = mapped_column(db.Text)
|
|
|
|
_inputs: Mapped[dict] = mapped_column("inputs", db.JSON)
|
|
|
|
_inputs: Mapped[dict] = mapped_column("inputs", db.JSON)
|
|
|
|
introduction = mapped_column(db.Text)
|
|
|
|
introduction = mapped_column(db.Text)
|
|
|
|
system_instruction = mapped_column(db.Text)
|
|
|
|
system_instruction = mapped_column(db.Text)
|
|
|
|
system_instruction_tokens = mapped_column(db.Integer, nullable=False, server_default=db.text("0"))
|
|
|
|
system_instruction_tokens = mapped_column(db.Integer, nullable=False, server_default=db.text("0"))
|
|
|
|
status = mapped_column(db.String(255), nullable=False)
|
|
|
|
status = mapped_column(String(255), nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
# The `invoke_from` records how the conversation is created.
|
|
|
|
# The `invoke_from` records how the conversation is created.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Its value corresponds to the members of `InvokeFrom`.
|
|
|
|
# Its value corresponds to the members of `InvokeFrom`.
|
|
|
|
# (api/core/app/entities/app_invoke_entities.py)
|
|
|
|
# (api/core/app/entities/app_invoke_entities.py)
|
|
|
|
invoke_from = mapped_column(db.String(255), nullable=True)
|
|
|
|
invoke_from = mapped_column(String(255), nullable=True)
|
|
|
|
|
|
|
|
|
|
|
|
# ref: ConversationSource.
|
|
|
|
# ref: ConversationSource.
|
|
|
|
from_source = mapped_column(db.String(255), nullable=False)
|
|
|
|
from_source = mapped_column(String(255), nullable=False)
|
|
|
|
from_end_user_id = mapped_column(StringUUID)
|
|
|
|
from_end_user_id = mapped_column(StringUUID)
|
|
|
|
from_account_id = mapped_column(StringUUID)
|
|
|
|
from_account_id = mapped_column(StringUUID)
|
|
|
|
read_at = mapped_column(db.DateTime)
|
|
|
|
read_at = mapped_column(db.DateTime)
|
|
|
|
@ -897,8 +897,8 @@ class Message(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
model_provider = mapped_column(db.String(255), nullable=True)
|
|
|
|
model_provider = mapped_column(String(255), nullable=True)
|
|
|
|
model_id = mapped_column(db.String(255), nullable=True)
|
|
|
|
model_id = mapped_column(String(255), nullable=True)
|
|
|
|
override_model_configs = mapped_column(db.Text)
|
|
|
|
override_model_configs = mapped_column(db.Text)
|
|
|
|
conversation_id = mapped_column(StringUUID, db.ForeignKey("conversations.id"), nullable=False)
|
|
|
|
conversation_id = mapped_column(StringUUID, db.ForeignKey("conversations.id"), nullable=False)
|
|
|
|
_inputs: Mapped[dict] = mapped_column("inputs", db.JSON)
|
|
|
|
_inputs: Mapped[dict] = mapped_column("inputs", db.JSON)
|
|
|
|
@ -914,12 +914,12 @@ class Message(Base):
|
|
|
|
parent_message_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
parent_message_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
provider_response_latency = mapped_column(db.Float, nullable=False, server_default=db.text("0"))
|
|
|
|
provider_response_latency = mapped_column(db.Float, nullable=False, server_default=db.text("0"))
|
|
|
|
total_price = mapped_column(db.Numeric(10, 7))
|
|
|
|
total_price = mapped_column(db.Numeric(10, 7))
|
|
|
|
currency = mapped_column(db.String(255), nullable=False)
|
|
|
|
currency = mapped_column(String(255), nullable=False)
|
|
|
|
status = mapped_column(db.String(255), nullable=False, server_default=db.text("'normal'::character varying"))
|
|
|
|
status = mapped_column(String(255), nullable=False, server_default=db.text("'normal'::character varying"))
|
|
|
|
error = mapped_column(db.Text)
|
|
|
|
error = mapped_column(db.Text)
|
|
|
|
message_metadata = mapped_column(db.Text)
|
|
|
|
message_metadata = mapped_column(db.Text)
|
|
|
|
invoke_from: Mapped[Optional[str]] = mapped_column(db.String(255), nullable=True)
|
|
|
|
invoke_from: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
|
|
|
|
from_source = mapped_column(db.String(255), nullable=False)
|
|
|
|
from_source = mapped_column(String(255), nullable=False)
|
|
|
|
from_end_user_id: Mapped[Optional[str]] = mapped_column(StringUUID)
|
|
|
|
from_end_user_id: Mapped[Optional[str]] = mapped_column(StringUUID)
|
|
|
|
from_account_id: Mapped[Optional[str]] = mapped_column(StringUUID)
|
|
|
|
from_account_id: Mapped[Optional[str]] = mapped_column(StringUUID)
|
|
|
|
created_at: Mapped[datetime] = mapped_column(db.DateTime, server_default=func.current_timestamp())
|
|
|
|
created_at: Mapped[datetime] = mapped_column(db.DateTime, server_default=func.current_timestamp())
|
|
|
|
@ -1241,9 +1241,9 @@ class MessageFeedback(Base):
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
conversation_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
conversation_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
message_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
message_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
rating = mapped_column(db.String(255), nullable=False)
|
|
|
|
rating = mapped_column(String(255), nullable=False)
|
|
|
|
content = mapped_column(db.Text)
|
|
|
|
content = mapped_column(db.Text)
|
|
|
|
from_source = mapped_column(db.String(255), nullable=False)
|
|
|
|
from_source = mapped_column(String(255), nullable=False)
|
|
|
|
from_end_user_id = mapped_column(StringUUID)
|
|
|
|
from_end_user_id = mapped_column(StringUUID)
|
|
|
|
from_account_id = mapped_column(StringUUID)
|
|
|
|
from_account_id = mapped_column(StringUUID)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
@ -1301,12 +1301,12 @@ class MessageFile(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
message_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
message_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
type: Mapped[str] = mapped_column(db.String(255), nullable=False)
|
|
|
|
type: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
transfer_method: Mapped[str] = mapped_column(db.String(255), nullable=False)
|
|
|
|
transfer_method: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
url: Mapped[Optional[str]] = mapped_column(db.Text, nullable=True)
|
|
|
|
url: Mapped[Optional[str]] = mapped_column(db.Text, nullable=True)
|
|
|
|
belongs_to: Mapped[Optional[str]] = mapped_column(db.String(255), nullable=True)
|
|
|
|
belongs_to: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
|
|
|
|
upload_file_id: Mapped[Optional[str]] = mapped_column(StringUUID, nullable=True)
|
|
|
|
upload_file_id: Mapped[Optional[str]] = mapped_column(StringUUID, nullable=True)
|
|
|
|
created_by_role: Mapped[str] = mapped_column(db.String(255), nullable=False)
|
|
|
|
created_by_role: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
created_by: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_by: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_at: Mapped[datetime] = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at: Mapped[datetime] = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
@ -1418,10 +1418,10 @@ class OperationLog(Base):
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
account_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
account_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
action = mapped_column(db.String(255), nullable=False)
|
|
|
|
action = mapped_column(String(255), nullable=False)
|
|
|
|
content = mapped_column(db.JSON)
|
|
|
|
content = mapped_column(db.JSON)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_ip = mapped_column(db.String(255), nullable=False)
|
|
|
|
created_ip = mapped_column(String(255), nullable=False)
|
|
|
|
updated_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
updated_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1436,9 +1436,9 @@ class EndUser(Base, UserMixin):
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
type = mapped_column(db.String(255), nullable=False)
|
|
|
|
type = mapped_column(String(255), nullable=False)
|
|
|
|
external_user_id = mapped_column(db.String(255), nullable=True)
|
|
|
|
external_user_id = mapped_column(String(255), nullable=True)
|
|
|
|
name = mapped_column(db.String(255))
|
|
|
|
name = mapped_column(String(255))
|
|
|
|
is_anonymous = mapped_column(db.Boolean, nullable=False, server_default=db.text("true"))
|
|
|
|
is_anonymous = mapped_column(db.Boolean, nullable=False, server_default=db.text("true"))
|
|
|
|
session_id: Mapped[str] = mapped_column()
|
|
|
|
session_id: Mapped[str] = mapped_column()
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
@ -1455,10 +1455,10 @@ class AppMCPServer(Base):
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
name = mapped_column(db.String(255), nullable=False)
|
|
|
|
name = mapped_column(String(255), nullable=False)
|
|
|
|
description = mapped_column(db.String(255), nullable=False)
|
|
|
|
description = mapped_column(String(255), nullable=False)
|
|
|
|
server_code = mapped_column(db.String(255), nullable=False)
|
|
|
|
server_code = mapped_column(String(255), nullable=False)
|
|
|
|
status = mapped_column(db.String(255), nullable=False, server_default=db.text("'normal'::character varying"))
|
|
|
|
status = mapped_column(String(255), nullable=False, server_default=db.text("'normal'::character varying"))
|
|
|
|
parameters = mapped_column(db.Text, nullable=False)
|
|
|
|
parameters = mapped_column(db.Text, nullable=False)
|
|
|
|
|
|
|
|
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
@ -1488,28 +1488,28 @@ class Site(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
title = mapped_column(db.String(255), nullable=False)
|
|
|
|
title = mapped_column(String(255), nullable=False)
|
|
|
|
icon_type = mapped_column(db.String(255), nullable=True)
|
|
|
|
icon_type = mapped_column(String(255), nullable=True)
|
|
|
|
icon = mapped_column(db.String(255))
|
|
|
|
icon = mapped_column(String(255))
|
|
|
|
icon_background = mapped_column(db.String(255))
|
|
|
|
icon_background = mapped_column(String(255))
|
|
|
|
description = mapped_column(db.Text)
|
|
|
|
description = mapped_column(db.Text)
|
|
|
|
default_language = mapped_column(db.String(255), nullable=False)
|
|
|
|
default_language = mapped_column(String(255), nullable=False)
|
|
|
|
chat_color_theme = mapped_column(db.String(255))
|
|
|
|
chat_color_theme = mapped_column(String(255))
|
|
|
|
chat_color_theme_inverted = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
chat_color_theme_inverted = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
copyright = mapped_column(db.String(255))
|
|
|
|
copyright = mapped_column(String(255))
|
|
|
|
privacy_policy = mapped_column(db.String(255))
|
|
|
|
privacy_policy = mapped_column(String(255))
|
|
|
|
show_workflow_steps = mapped_column(db.Boolean, nullable=False, server_default=db.text("true"))
|
|
|
|
show_workflow_steps = mapped_column(db.Boolean, nullable=False, server_default=db.text("true"))
|
|
|
|
use_icon_as_answer_icon = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
use_icon_as_answer_icon = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
_custom_disclaimer: Mapped[str] = mapped_column("custom_disclaimer", sa.TEXT, default="")
|
|
|
|
_custom_disclaimer: Mapped[str] = mapped_column("custom_disclaimer", sa.TEXT, default="")
|
|
|
|
customize_domain = mapped_column(db.String(255))
|
|
|
|
customize_domain = mapped_column(String(255))
|
|
|
|
customize_token_strategy = mapped_column(db.String(255), nullable=False)
|
|
|
|
customize_token_strategy = mapped_column(String(255), nullable=False)
|
|
|
|
prompt_public = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
prompt_public = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
status = mapped_column(db.String(255), nullable=False, server_default=db.text("'normal'::character varying"))
|
|
|
|
status = mapped_column(String(255), nullable=False, server_default=db.text("'normal'::character varying"))
|
|
|
|
created_by = mapped_column(StringUUID, nullable=True)
|
|
|
|
created_by = mapped_column(StringUUID, nullable=True)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
updated_by = mapped_column(StringUUID, nullable=True)
|
|
|
|
updated_by = mapped_column(StringUUID, nullable=True)
|
|
|
|
updated_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
updated_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
code = mapped_column(db.String(255))
|
|
|
|
code = mapped_column(String(255))
|
|
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
@property
|
|
|
|
def custom_disclaimer(self):
|
|
|
|
def custom_disclaimer(self):
|
|
|
|
@ -1547,8 +1547,8 @@ class ApiToken(Base):
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
app_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
type = mapped_column(db.String(16), nullable=False)
|
|
|
|
type = mapped_column(String(16), nullable=False)
|
|
|
|
token = mapped_column(db.String(255), nullable=False)
|
|
|
|
token = mapped_column(String(255), nullable=False)
|
|
|
|
last_used_at = mapped_column(db.DateTime, nullable=True)
|
|
|
|
last_used_at = mapped_column(db.DateTime, nullable=True)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
@ -1570,21 +1570,21 @@ class UploadFile(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id: Mapped[str] = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
tenant_id: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
storage_type: Mapped[str] = mapped_column(db.String(255), nullable=False)
|
|
|
|
storage_type: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
key: Mapped[str] = mapped_column(db.String(255), nullable=False)
|
|
|
|
key: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
name: Mapped[str] = mapped_column(db.String(255), nullable=False)
|
|
|
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
size: Mapped[int] = mapped_column(db.Integer, nullable=False)
|
|
|
|
size: Mapped[int] = mapped_column(db.Integer, nullable=False)
|
|
|
|
extension: Mapped[str] = mapped_column(db.String(255), nullable=False)
|
|
|
|
extension: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
mime_type: Mapped[str] = mapped_column(db.String(255), nullable=True)
|
|
|
|
mime_type: Mapped[str] = mapped_column(String(255), nullable=True)
|
|
|
|
created_by_role: Mapped[str] = mapped_column(
|
|
|
|
created_by_role: Mapped[str] = mapped_column(
|
|
|
|
db.String(255), nullable=False, server_default=db.text("'account'::character varying")
|
|
|
|
String(255), nullable=False, server_default=db.text("'account'::character varying")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
created_by: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_by: Mapped[str] = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_at: Mapped[datetime] = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at: Mapped[datetime] = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
used: Mapped[bool] = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
used: Mapped[bool] = mapped_column(db.Boolean, nullable=False, server_default=db.text("false"))
|
|
|
|
used_by: Mapped[str | None] = mapped_column(StringUUID, nullable=True)
|
|
|
|
used_by: Mapped[str | None] = mapped_column(StringUUID, nullable=True)
|
|
|
|
used_at: Mapped[datetime | None] = mapped_column(db.DateTime, nullable=True)
|
|
|
|
used_at: Mapped[datetime | None] = mapped_column(db.DateTime, nullable=True)
|
|
|
|
hash: Mapped[str | None] = mapped_column(db.String(255), nullable=True)
|
|
|
|
hash: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
|
|
|
source_url: Mapped[str] = mapped_column(sa.TEXT, default="")
|
|
|
|
source_url: Mapped[str] = mapped_column(sa.TEXT, default="")
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(
|
|
|
|
def __init__(
|
|
|
|
@ -1633,10 +1633,10 @@ class ApiRequest(Base):
|
|
|
|
id = mapped_column(StringUUID, nullable=False, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, nullable=False, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
api_token_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
api_token_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
path = mapped_column(db.String(255), nullable=False)
|
|
|
|
path = mapped_column(String(255), nullable=False)
|
|
|
|
request = mapped_column(db.Text, nullable=True)
|
|
|
|
request = mapped_column(db.Text, nullable=True)
|
|
|
|
response = mapped_column(db.Text, nullable=True)
|
|
|
|
response = mapped_column(db.Text, nullable=True)
|
|
|
|
ip = mapped_column(db.String(255), nullable=False)
|
|
|
|
ip = mapped_column(String(255), nullable=False)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1649,7 +1649,7 @@ class MessageChain(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id = mapped_column(StringUUID, nullable=False, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, nullable=False, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
message_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
message_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
type = mapped_column(db.String(255), nullable=False)
|
|
|
|
type = mapped_column(String(255), nullable=False)
|
|
|
|
input = mapped_column(db.Text, nullable=True)
|
|
|
|
input = mapped_column(db.Text, nullable=True)
|
|
|
|
output = mapped_column(db.Text, nullable=True)
|
|
|
|
output = mapped_column(db.Text, nullable=True)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=db.func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=db.func.current_timestamp())
|
|
|
|
@ -1686,9 +1686,9 @@ class MessageAgentThought(Base):
|
|
|
|
answer_price_unit = mapped_column(db.Numeric(10, 7), nullable=False, server_default=db.text("0.001"))
|
|
|
|
answer_price_unit = mapped_column(db.Numeric(10, 7), nullable=False, server_default=db.text("0.001"))
|
|
|
|
tokens = mapped_column(db.Integer, nullable=True)
|
|
|
|
tokens = mapped_column(db.Integer, nullable=True)
|
|
|
|
total_price = mapped_column(db.Numeric, nullable=True)
|
|
|
|
total_price = mapped_column(db.Numeric, nullable=True)
|
|
|
|
currency = mapped_column(db.String, nullable=True)
|
|
|
|
currency = mapped_column(String, nullable=True)
|
|
|
|
latency = mapped_column(db.Float, nullable=True)
|
|
|
|
latency = mapped_column(db.Float, nullable=True)
|
|
|
|
created_by_role = mapped_column(db.String, nullable=False)
|
|
|
|
created_by_role = mapped_column(String, nullable=False)
|
|
|
|
created_by = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_by = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=db.func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=db.func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
@ -1808,8 +1808,8 @@ class Tag(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
tenant_id = mapped_column(StringUUID, nullable=True)
|
|
|
|
type = mapped_column(db.String(16), nullable=False)
|
|
|
|
type = mapped_column(String(16), nullable=False)
|
|
|
|
name = mapped_column(db.String(255), nullable=False)
|
|
|
|
name = mapped_column(String(255), nullable=False)
|
|
|
|
created_by = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_by = mapped_column(StringUUID, nullable=False)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
|
|
|
|
|
|
|
|
@ -1839,7 +1839,7 @@ class TraceAppConfig(Base):
|
|
|
|
|
|
|
|
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
id = mapped_column(StringUUID, server_default=db.text("uuid_generate_v4()"))
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
app_id = mapped_column(StringUUID, nullable=False)
|
|
|
|
tracing_provider = mapped_column(db.String(255), nullable=True)
|
|
|
|
tracing_provider = mapped_column(String(255), nullable=True)
|
|
|
|
tracing_config = mapped_column(db.JSON, nullable=True)
|
|
|
|
tracing_config = mapped_column(db.JSON, nullable=True)
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
created_at = mapped_column(db.DateTime, nullable=False, server_default=func.current_timestamp())
|
|
|
|
updated_at = mapped_column(
|
|
|
|
updated_at = mapped_column(
|
|
|
|
|