@ -40,8 +40,8 @@ class DifySetup(Base):
__tablename__ = " dify_setups "
__table_args__ = ( db . PrimaryKeyConstraint ( " version " , name = " dify_setup_pkey " ) , )
version = db. C olumn( db . String ( 255 ) , nullable = False )
setup_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
version = mapped_c olumn( db . String ( 255 ) , nullable = False )
setup_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
class AppMode ( StrEnum ) :
@ -74,31 +74,31 @@ class App(Base):
__tablename__ = " apps "
__table_args__ = ( db . PrimaryKeyConstraint ( " id " , name = " app_pkey " ) , db . Index ( " app_tenant_id_idx " , " tenant_id " ) )
id = db . C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id : Mapped [ str ] = db. Column ( StringUUID , nullable = False )
name = db . C olumn( db . String ( 255 ) , nullable = False )
description = db . Column ( db . Text , nullable = False , server_default = db . text ( " ' ' ::character varying " ) )
mode : Mapped [ str ] = mapped_column ( db . String ( 255 ) , nullable = False )
icon_type = db . C olumn( db . String ( 255 ) , nullable = True ) # image, emoji
id : Mapped [ str ] = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id : Mapped [ str ] = mapped_column( StringUUID )
name : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) )
description : Mapped [ str ] = mapped_column ( db . Text , server_default = db . text ( " ' ' ::character varying " ) )
mode : Mapped [ str ] = mapped_column ( db . String ( 255 ) )
icon_type : Mapped [ Optional [ str ] ] = mapped_c olumn( db . String ( 255 ) ) # image, emoji
icon = db . Column ( db . String ( 255 ) )
icon_background = db . C olumn( db . String ( 255 ) )
app_model_config_id = db. C olumn( StringUUID , nullable = True )
workflow_id = db. C olumn( StringUUID , nullable = True )
status = db . C olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' normal ' ::character varying " ) )
enable_site = db . Column ( db . Boolean , nullable = False )
enable_api = db . Column ( db . Boolean , nullable = False )
api_rpm = db . Column ( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
api_rph = db . Column ( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
is_demo = db . Column ( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
is_public = db . Column ( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
is_universal = db . Column ( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
tracing = db. C olumn( db . Text , nullable = True )
max_active_requests : Mapped [ Optional [ int ] ] = mapped_column ( nullable = True )
created_by = db. C olumn( StringUUID , nullable = True )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_by = db. C olumn( StringUUID , nullable = True )
updated_at = db . C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
use_icon_as_answer_icon = db . C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
icon_background : Mapped [ Optional [ str ] ] = mapped_c olumn( db . String ( 255 ) )
app_model_config_id = mapped_c olumn( StringUUID , nullable = True )
workflow_id = mapped_c olumn( StringUUID , nullable = True )
status : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , server_default = db . text ( " ' normal ' ::character varying " ) )
enable_site : 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_rph : Mapped [ int ] = mapped_column ( db . Integer , server_default = db . text ( " 0 " ) )
is_demo : Mapped [ bool ] = mapped_column ( db . Boolean , server_default = db . text ( " false " ) )
is_public : Mapped [ bool ] = mapped_column ( db . Boolean , server_default = db . text ( " false " ) )
is_universal : Mapped [ bool ] = mapped_column ( db . Boolean , server_default = db . text ( " false " ) )
tracing = mapped_c olumn( db . Text , nullable = True )
max_active_requests : Mapped [ Optional [ int ] ]
created_by = mapped_c olumn( StringUUID , nullable = True )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_by = mapped_c olumn( StringUUID , nullable = True )
updated_at : Mapped [ datetime ] = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
use_icon_as_answer_icon : Mapped [ bool ] = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
@property
def desc_or_prompt ( self ) :
@ -307,34 +307,34 @@ class AppModelConfig(Base):
__tablename__ = " app_model_configs "
__table_args__ = ( db . PrimaryKeyConstraint ( " id " , name = " app_model_config_pkey " ) , db . Index ( " app_app_id_idx " , " app_id " ) )
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
provider = db. C olumn( db . String ( 255 ) , nullable = True )
model_id = db. C olumn( db . String ( 255 ) , nullable = True )
configs = db. C olumn( db . JSON , nullable = True )
created_by = db. C olumn( StringUUID , nullable = True )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_by = db. C olumn( StringUUID , nullable = True )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
opening_statement = db. C olumn( db . Text )
suggested_questions = db. C olumn( db . Text )
suggested_questions_after_answer = db. C olumn( db . Text )
speech_to_text = db. C olumn( db . Text )
text_to_speech = db. C olumn( db . Text )
more_like_this = db. C olumn( db . Text )
model = db. C olumn( db . Text )
user_input_form = db. C olumn( db . Text )
dataset_query_variable = db. C olumn( db . String ( 255 ) )
pre_prompt = db. C olumn( db . Text )
agent_mode = db. C olumn( db . Text )
sensitive_word_avoidance = db. C olumn( db . Text )
retriever_resource = db. C olumn( db . Text )
prompt_type = db. C olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' simple ' ::character varying " ) )
chat_prompt_config = db. C olumn( db . Text )
completion_prompt_config = db. C olumn( db . Text )
dataset_configs = db. C olumn( db . Text )
external_data_tools = db. C olumn( db . Text )
file_upload = db. C olumn( db . Text )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = False )
provider = mapped_c olumn( db . String ( 255 ) , nullable = True )
model_id = mapped_c olumn( db . String ( 255 ) , nullable = True )
configs = mapped_c olumn( db . JSON , nullable = True )
created_by = mapped_c olumn( StringUUID , nullable = True )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_by = mapped_c olumn( StringUUID , nullable = True )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
opening_statement = mapped_c olumn( db . Text )
suggested_questions = mapped_c olumn( db . Text )
suggested_questions_after_answer = mapped_c olumn( db . Text )
speech_to_text = mapped_c olumn( db . Text )
text_to_speech = mapped_c olumn( db . Text )
more_like_this = mapped_c olumn( db . Text )
model = mapped_c olumn( db . Text )
user_input_form = mapped_c olumn( db . Text )
dataset_query_variable = mapped_c olumn( db . String ( 255 ) )
pre_prompt = mapped_c olumn( db . Text )
agent_mode = mapped_c olumn( db . Text )
sensitive_word_avoidance = mapped_c olumn( db . Text )
retriever_resource = mapped_c olumn( db . Text )
prompt_type = mapped_c olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' simple ' ::character varying " ) )
chat_prompt_config = mapped_c olumn( db . Text )
completion_prompt_config = mapped_c olumn( db . Text )
dataset_configs = mapped_c olumn( db . Text )
external_data_tools = mapped_c olumn( db . Text )
file_upload = mapped_c olumn( db . Text )
@property
def app ( self ) :
@ -561,19 +561,19 @@ class RecommendedApp(Base):
db . Index ( " recommended_app_is_listed_idx " , " is_listed " , " language " ) ,
)
id = db. C olumn( StringUUID , primary_key = True , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
description = db. C olumn( db . JSON , nullable = False )
copyright = db. C olumn( db . String ( 255 ) , nullable = False )
privacy_policy = db. C olumn( db . String ( 255 ) , nullable = False )
id = mapped_c olumn( StringUUID , primary_key = True , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = False )
description = mapped_c olumn( db . JSON , nullable = False )
copyright = mapped_c olumn( db . String ( 255 ) , nullable = False )
privacy_policy = mapped_c olumn( db . String ( 255 ) , nullable = False )
custom_disclaimer : Mapped [ str ] = mapped_column ( sa . TEXT , default = " " )
category = db. C olumn( db . String ( 255 ) , nullable = False )
position = db. C olumn( db . Integer , nullable = False , default = 0 )
is_listed = db. C olumn( db . Boolean , nullable = False , default = True )
install_count = db. C olumn( db . Integer , nullable = False , default = 0 )
language = db. C olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' en-US ' ::character varying " ) )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
category = mapped_c olumn( db . String ( 255 ) , nullable = False )
position = mapped_c olumn( db . Integer , nullable = False , default = 0 )
is_listed = mapped_c olumn( db . Boolean , nullable = False , default = True )
install_count = mapped_c olumn( db . Integer , nullable = False , default = 0 )
language = mapped_c olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' en-US ' ::character varying " ) )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
@property
def app ( self ) :
@ -590,14 +590,14 @@ class InstalledApp(Base):
db . UniqueConstraint ( " tenant_id " , " app_id " , name = " unique_tenant_app " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = db. C olumn( StringUUID , nullable = False )
app_id = db. C olumn( StringUUID , nullable = False )
app_owner_tenant_id = db. C olumn( StringUUID , nullable = False )
position = db. C olumn( db . Integer , nullable = False , default = 0 )
is_pinned = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
last_used_at = db. C olumn( db . DateTime , nullable = True )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = mapped_c olumn( StringUUID , nullable = False )
app_id = mapped_c olumn( StringUUID , nullable = False )
app_owner_tenant_id = mapped_c olumn( StringUUID , nullable = False )
position = mapped_c olumn( db . Integer , nullable = False , default = 0 )
is_pinned = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
last_used_at = mapped_c olumn( db . DateTime , nullable = True )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
@property
def app ( self ) :
@ -618,42 +618,42 @@ class Conversation(Base):
)
id : Mapped [ str ] = mapped_column ( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
app_model_config_id = db. C olumn( StringUUID , nullable = True )
model_provider = db. C olumn( db . String ( 255 ) , nullable = True )
override_model_configs = db. C olumn( db . Text )
model_id = db. C olumn( db . String ( 255 ) , nullable = True )
app_id = mapped_c olumn( StringUUID , nullable = False )
app_model_config_id = mapped_c olumn( StringUUID , nullable = True )
model_provider = mapped_c olumn( db . String ( 255 ) , nullable = True )
override_model_configs = mapped_c olumn( db . Text )
model_id = mapped_c olumn( db . String ( 255 ) , nullable = True )
mode : Mapped [ str ] = mapped_column ( db . String ( 255 ) )
name = db. C olumn( db . String ( 255 ) , nullable = False )
summary = db. C olumn( db . Text )
name = mapped_c olumn( db . String ( 255 ) , nullable = False )
summary = mapped_c olumn( db . Text )
_inputs : Mapped [ dict ] = mapped_column ( " inputs " , db . JSON )
introduction = db. C olumn( db . Text )
system_instruction = db. C olumn( db . Text )
system_instruction_tokens = db. C olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
status = db. C olumn( db . String ( 255 ) , nullable = False )
introduction = mapped_c olumn( db . Text )
system_instruction = mapped_c olumn( db . Text )
system_instruction_tokens = mapped_c olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
status = mapped_c olumn( db . String ( 255 ) , nullable = False )
# The `invoke_from` records how the conversation is created.
#
# Its value corresponds to the members of `InvokeFrom`.
# (api/core/app/entities/app_invoke_entities.py)
invoke_from = db. C olumn( db . String ( 255 ) , nullable = True )
invoke_from = mapped_c olumn( db . String ( 255 ) , nullable = True )
# ref: ConversationSource.
from_source = db. C olumn( db . String ( 255 ) , nullable = False )
from_end_user_id = db. C olumn( StringUUID )
from_account_id = db. C olumn( StringUUID )
read_at = db. C olumn( db . DateTime )
read_account_id = db. C olumn( StringUUID )
from_source = mapped_c olumn( db . String ( 255 ) , nullable = False )
from_end_user_id = mapped_c olumn( StringUUID )
from_account_id = mapped_c olumn( StringUUID )
read_at = mapped_c olumn( db . DateTime )
read_account_id = mapped_c olumn( StringUUID )
dialogue_count : Mapped [ int ] = mapped_column ( default = 0 )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
messages = db . relationship ( " Message " , backref = " conversation " , lazy = " select " , passive_deletes = " all " )
message_annotations = db . relationship (
" MessageAnnotation " , backref = " conversation " , lazy = " select " , passive_deletes = " all "
)
is_deleted = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
is_deleted = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
@property
def inputs ( self ) :
@ -896,36 +896,36 @@ class Message(Base):
)
id : Mapped [ str ] = mapped_column ( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
model_provider = db. C olumn( db . String ( 255 ) , nullable = True )
model_id = db. C olumn( db . String ( 255 ) , nullable = True )
override_model_configs = db. C olumn( db . Text )
conversation_id = db. C olumn( StringUUID , db . ForeignKey ( " conversations.id " ) , nullable = False )
app_id = mapped_c olumn( StringUUID , nullable = False )
model_provider = mapped_c olumn( db . String ( 255 ) , nullable = True )
model_id = mapped_c olumn( db . String ( 255 ) , nullable = True )
override_model_configs = mapped_c olumn( db . Text )
conversation_id = mapped_c olumn( StringUUID , db . ForeignKey ( " conversations.id " ) , nullable = False )
_inputs : Mapped [ dict ] = mapped_column ( " inputs " , db . JSON )
query : Mapped [ str ] = db. C olumn( db . Text , nullable = False )
message = db. C olumn( db . JSON , nullable = False )
message_tokens : Mapped [ int ] = db. C olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
message_unit_price = db. C olumn( db . Numeric ( 10 , 4 ) , nullable = False )
message_price_unit = db. C olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
answer : Mapped [ str ] = db . Column ( db . Text , nullable = False )
answer_tokens : Mapped [ int ] = db. C olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
answer_unit_price = db. C olumn( db . Numeric ( 10 , 4 ) , nullable = False )
answer_price_unit = db. C olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
parent_message_id = db. C olumn( StringUUID , nullable = True )
provider_response_latency = db. C olumn( db . Float , nullable = False , server_default = db . text ( " 0 " ) )
total_price = db. C olumn( db . Numeric ( 10 , 7 ) )
currency = db. C olumn( db . String ( 255 ) , nullable = False )
status = db. C olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' normal ' ::character varying " ) )
error = db. C olumn( db . Text )
message_metadata = db. C olumn( db . Text )
invoke_from : Mapped [ Optional [ str ] ] = db. C olumn( db . String ( 255 ) , nullable = True )
from_source = db. C olumn( db . String ( 255 ) , nullable = False )
from_end_user_id : Mapped [ Optional [ str ] ] = db. C olumn( StringUUID )
from_account_id : Mapped [ Optional [ str ] ] = db. C olumn( StringUUID )
query : Mapped [ str ] = mapped_c olumn( db . Text , nullable = False )
message = mapped_c olumn( db . JSON , nullable = False )
message_tokens : Mapped [ int ] = mapped_c olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
message_unit_price = mapped_c olumn( db . Numeric ( 10 , 4 ) , nullable = False )
message_price_unit = mapped_c olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
answer : Mapped [ str ] = db . Column ( db . Text , nullable = False ) # TODO make it mapped_column
answer_tokens : Mapped [ int ] = mapped_c olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
answer_unit_price = mapped_c olumn( db . Numeric ( 10 , 4 ) , nullable = False )
answer_price_unit = mapped_c olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
parent_message_id = mapped_c olumn( StringUUID , nullable = True )
provider_response_latency = mapped_c olumn( db . Float , nullable = False , server_default = db . text ( " 0 " ) )
total_price = mapped_c olumn( db . Numeric ( 10 , 7 ) )
currency = mapped_c olumn( db . String ( 255 ) , nullable = False )
status = mapped_c olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' normal ' ::character varying " ) )
error = mapped_c olumn( db . Text )
message_metadata = mapped_c olumn( db . Text )
invoke_from : Mapped [ Optional [ str ] ] = mapped_c olumn( db . String ( 255 ) , nullable = True )
from_source = mapped_c olumn( db . String ( 255 ) , nullable = False )
from_end_user_id : Mapped [ Optional [ str ] ] = mapped_c olumn( StringUUID )
from_account_id : Mapped [ Optional [ str ] ] = mapped_c olumn( StringUUID )
created_at : Mapped [ datetime ] = mapped_column ( db . DateTime , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
agent_based = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
workflow_run_id : Mapped [ str ] = db . C olumn( StringUUID )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
agent_based = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
workflow_run_id : Mapped [ Optional [ str ] ] = mapped_c olumn( StringUUID )
@property
def inputs ( self ) :
@ -1239,17 +1239,17 @@ class MessageFeedback(Base):
db . Index ( " message_feedback_conversation_idx " , " conversation_id " , " from_source " , " rating " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
conversation_id = db. C olumn( StringUUID , nullable = False )
message_id = db. C olumn( StringUUID , nullable = False )
rating = db. C olumn( db . String ( 255 ) , nullable = False )
content = db. C olumn( db . Text )
from_source = db. C olumn( db . String ( 255 ) , nullable = False )
from_end_user_id = db. C olumn( StringUUID )
from_account_id = db. C olumn( StringUUID )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = False )
conversation_id = mapped_c olumn( StringUUID , nullable = False )
message_id = mapped_c olumn( StringUUID , nullable = False )
rating = mapped_c olumn( db . String ( 255 ) , nullable = False )
content = mapped_c olumn( db . Text )
from_source = mapped_c olumn( db . String ( 255 ) , nullable = False )
from_end_user_id = mapped_c olumn( StringUUID )
from_account_id = mapped_c olumn( StringUUID )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
@property
def from_account ( self ) :
@ -1301,16 +1301,16 @@ class MessageFile(Base):
self . created_by_role = created_by_role . value
self . created_by = created_by
id : Mapped [ str ] = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
message_id : Mapped [ str ] = db. C olumn( StringUUID , nullable = False )
type : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = False )
transfer_method : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = False )
url : Mapped [ Optional [ str ] ] = db. C olumn( db . Text , nullable = True )
belongs_to : Mapped [ Optional [ str ] ] = db. C olumn( db . String ( 255 ) , nullable = True )
upload_file_id : Mapped [ Optional [ str ] ] = db. C olumn( StringUUID , nullable = True )
created_by_role : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = False )
created_by : Mapped [ str ] = db. C olumn( StringUUID , nullable = False )
created_at : Mapped [ datetime ] = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id : Mapped [ str ] = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
message_id : Mapped [ str ] = mapped_c olumn( StringUUID , nullable = False )
type : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = False )
transfer_method : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = False )
url : Mapped [ Optional [ str ] ] = mapped_c olumn( db . Text , nullable = True )
belongs_to : Mapped [ Optional [ str ] ] = mapped_c olumn( db . String ( 255 ) , nullable = True )
upload_file_id : Mapped [ Optional [ str ] ] = mapped_c olumn( StringUUID , nullable = True )
created_by_role : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = False )
created_by : Mapped [ str ] = mapped_c olumn( StringUUID , nullable = False )
created_at : Mapped [ datetime ] = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
class MessageAnnotation ( Base ) :
@ -1322,16 +1322,16 @@ class MessageAnnotation(Base):
db . Index ( " message_annotation_message_idx " , " message_id " ) ,
)
id = db . C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db . Column ( StringUUID , nullable = False )
conversation_id = db . C olumn( StringUUID , db . ForeignKey ( " conversations.id " ) , nullable = True )
message_id = db . Column ( StringUUID , nullable = True )
id : Mapped [ str ] = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id : Mapped [ str ] = mapped_column ( StringUUID )
conversation_id : Mapped [ Optional [ str ] ] = mapped_c olumn( StringUUID , db . ForeignKey ( " conversations.id " ) )
message_id : Mapped [ Optional [ str ] ] = mapped_column ( StringUUID )
question = db . Column ( db . Text , nullable = True )
content = db. C olumn( db . Text , nullable = False )
hit_count = db. C olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
account_id = db. C olumn( StringUUID , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
content = mapped_c olumn( db . Text , nullable = False )
hit_count = mapped_c olumn( db . Integer , nullable = False , server_default = db . text ( " 0 " ) )
account_id = mapped_c olumn( StringUUID , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
@property
def account ( self ) :
@ -1354,17 +1354,17 @@ class AppAnnotationHitHistory(Base):
db . Index ( " app_annotation_hit_histories_message_idx " , " message_id " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
annotation_id : Mapped [ str ] = db. C olumn( StringUUID , nullable = False )
source = db. C olumn( db . Text , nullable = False )
question = db. C olumn( db . Text , nullable = False )
account_id = db. C olumn( StringUUID , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
score = db. C olumn( Float , nullable = False , server_default = db . text ( " 0 " ) )
message_id = db. C olumn( StringUUID , nullable = False )
annotation_question = db. C olumn( db . Text , nullable = False )
annotation_content = db. C olumn( db . Text , nullable = False )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = False )
annotation_id : Mapped [ str ] = mapped_c olumn( StringUUID , nullable = False )
source = mapped_c olumn( db . Text , nullable = False )
question = mapped_c olumn( db . Text , nullable = False )
account_id = mapped_c olumn( StringUUID , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
score = mapped_c olumn( Float , nullable = False , server_default = db . text ( " 0 " ) )
message_id = mapped_c olumn( StringUUID , nullable = False )
annotation_question = mapped_c olumn( db . Text , nullable = False )
annotation_content = mapped_c olumn( db . Text , nullable = False )
@property
def account ( self ) :
@ -1389,14 +1389,14 @@ class AppAnnotationSetting(Base):
db . Index ( " app_annotation_settings_app_idx " , " app_id " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
score_threshold = db. C olumn( Float , nullable = False , server_default = db . text ( " 0 " ) )
collection_binding_id = db. C olumn( StringUUID , nullable = False )
created_user_id = db. C olumn( StringUUID , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_user_id = db. C olumn( StringUUID , nullable = False )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = False )
score_threshold = mapped_c olumn( Float , nullable = False , server_default = db . text ( " 0 " ) )
collection_binding_id = mapped_c olumn( StringUUID , nullable = False )
created_user_id = mapped_c olumn( StringUUID , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_user_id = mapped_c olumn( StringUUID , nullable = False )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
@property
def collection_binding_detail ( self ) :
@ -1417,14 +1417,14 @@ class OperationLog(Base):
db . Index ( " operation_log_account_action_idx " , " tenant_id " , " account_id " , " action " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = db. C olumn( StringUUID , nullable = False )
account_id = db. C olumn( StringUUID , nullable = False )
action = db. C olumn( db . String ( 255 ) , nullable = False )
content = db. C olumn( db . JSON )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
created_ip = db. C olumn( db . String ( 255 ) , nullable = False )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = mapped_c olumn( StringUUID , nullable = False )
account_id = mapped_c olumn( StringUUID , nullable = False )
action = mapped_c olumn( db . String ( 255 ) , nullable = False )
content = mapped_c olumn( db . JSON )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
created_ip = mapped_c olumn( db . String ( 255 ) , nullable = False )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
class EndUser ( Base , UserMixin ) :
@ -1435,16 +1435,16 @@ class EndUser(Base, UserMixin):
db . Index ( " end_user_tenant_session_id_idx " , " tenant_id " , " session_id " , " type " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id : Mapped [ str ] = db. C olumn( StringUUID , nullable = False )
app_id = db. C olumn( StringUUID , nullable = True )
type = db. C olumn( db . String ( 255 ) , nullable = False )
external_user_id = db. C olumn( db . String ( 255 ) , nullable = True )
name = db. C olumn( db . String ( 255 ) )
is_anonymous = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " true " ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id : Mapped [ str ] = mapped_c olumn( StringUUID , nullable = False )
app_id = mapped_c olumn( StringUUID , nullable = True )
type = mapped_c olumn( db . String ( 255 ) , nullable = False )
external_user_id = mapped_c olumn( db . String ( 255 ) , nullable = True )
name = mapped_c olumn( db . String ( 255 ) )
is_anonymous = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " true " ) )
session_id : Mapped [ str ] = mapped_column ( )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
class AppMCPServer ( Base ) :
@ -1454,17 +1454,17 @@ class AppMCPServer(Base):
db . UniqueConstraint ( " tenant_id " , " app_id " , name = " unique_app_mcp_server_tenant_app_id " ) ,
db . UniqueConstraint ( " server_code " , name = " unique_app_mcp_server_server_code " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = db. C olumn( StringUUID , nullable = False )
app_id = db. C olumn( StringUUID , nullable = False )
name = db. C olumn( db . String ( 255 ) , nullable = False )
description = db. C olumn( db . String ( 255 ) , nullable = False )
server_code = db. C olumn( db . String ( 255 ) , nullable = False )
status = db. C olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' normal ' ::character varying " ) )
parameters = db. C olumn( db . Text , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = mapped_c olumn( StringUUID , nullable = False )
app_id = mapped_c olumn( StringUUID , nullable = False )
name = mapped_c olumn( db . String ( 255 ) , nullable = False )
description = mapped_c olumn( db . String ( 255 ) , nullable = False )
server_code = mapped_c olumn( db . String ( 255 ) , nullable = False )
status = mapped_c olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' normal ' ::character varying " ) )
parameters = mapped_c olumn( db . Text , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
@staticmethod
def generate_server_code ( n ) :
@ -1488,30 +1488,30 @@ class Site(Base):
db . Index ( " site_code_idx " , " code " , " status " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
title = db. C olumn( db . String ( 255 ) , nullable = False )
icon_type = db. C olumn( db . String ( 255 ) , nullable = True )
icon = db. C olumn( db . String ( 255 ) )
icon_background = db. C olumn( db . String ( 255 ) )
description = db. C olumn( db . Text )
default_language = db. C olumn( db . String ( 255 ) , nullable = False )
chat_color_theme = db. C olumn( db . String ( 255 ) )
chat_color_theme_inverted = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
copyright = db. C olumn( db . String ( 255 ) )
privacy_policy = db. C olumn( db . String ( 255 ) )
show_workflow_steps = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " true " ) )
use_icon_as_answer_icon = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = False )
title = mapped_c olumn( db . String ( 255 ) , nullable = False )
icon_type = mapped_c olumn( db . String ( 255 ) , nullable = True )
icon = mapped_c olumn( db . String ( 255 ) )
icon_background = mapped_c olumn( db . String ( 255 ) )
description = mapped_c olumn( db . Text )
default_language = mapped_c olumn( db . String ( 255 ) , nullable = False )
chat_color_theme = mapped_c olumn( db . String ( 255 ) )
chat_color_theme_inverted = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
copyright = mapped_c olumn( db . String ( 255 ) )
privacy_policy = mapped_c olumn( db . String ( 255 ) )
show_workflow_steps = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " true " ) )
use_icon_as_answer_icon = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
_custom_disclaimer : Mapped [ str ] = mapped_column ( " custom_disclaimer " , sa . TEXT , default = " " )
customize_domain = db. C olumn( db . String ( 255 ) )
customize_token_strategy = db. C olumn( db . String ( 255 ) , nullable = False )
prompt_public = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
status = db. C olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' normal ' ::character varying " ) )
created_by = db. C olumn( StringUUID , nullable = True )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_by = db. C olumn( StringUUID , nullable = True )
updated_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
code = db. C olumn( db . String ( 255 ) )
customize_domain = mapped_c olumn( db . String ( 255 ) )
customize_token_strategy = mapped_c olumn( db . String ( 255 ) , nullable = False )
prompt_public = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
status = mapped_c olumn( db . String ( 255 ) , nullable = False , server_default = db . text ( " ' normal ' ::character varying " ) )
created_by = mapped_c olumn( StringUUID , nullable = True )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_by = mapped_c olumn( StringUUID , nullable = True )
updated_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
code = mapped_c olumn( db . String ( 255 ) )
@property
def custom_disclaimer ( self ) :
@ -1546,13 +1546,13 @@ class ApiToken(Base):
db . Index ( " api_token_tenant_idx " , " tenant_id " , " type " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = True )
tenant_id = db. C olumn( StringUUID , nullable = True )
type = db. C olumn( db . String ( 16 ) , nullable = False )
token = db. C olumn( db . String ( 255 ) , nullable = False )
last_used_at = db. C olumn( db . DateTime , nullable = True )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = True )
tenant_id = mapped_c olumn( StringUUID , nullable = True )
type = mapped_c olumn( db . String ( 16 ) , nullable = False )
token = mapped_c olumn( db . String ( 255 ) , nullable = False )
last_used_at = mapped_c olumn( db . DateTime , nullable = True )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
@staticmethod
def generate_api_key ( prefix , n ) :
@ -1570,23 +1570,23 @@ class UploadFile(Base):
db . Index ( " upload_file_tenant_idx " , " tenant_id " ) ,
)
id : Mapped [ str ] = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id : Mapped [ str ] = db. C olumn( StringUUID , nullable = False )
storage_type : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = False )
key : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = False )
name : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = False )
size : Mapped [ int ] = db. C olumn( db . Integer , nullable = False )
extension : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = False )
mime_type : Mapped [ str ] = db. C olumn( db . String ( 255 ) , nullable = True )
created_by_role : Mapped [ str ] = db. C olumn(
id : Mapped [ str ] = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id : Mapped [ str ] = mapped_c olumn( StringUUID , nullable = False )
storage_type : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = False )
key : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = False )
name : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = False )
size : Mapped [ int ] = mapped_c olumn( db . Integer , nullable = False )
extension : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = False )
mime_type : Mapped [ str ] = mapped_c olumn( db . String ( 255 ) , nullable = True )
created_by_role : Mapped [ str ] = mapped_c olumn(
db . String ( 255 ) , nullable = False , server_default = db . text ( " ' account ' ::character varying " )
)
created_by : Mapped [ str ] = db. C olumn( StringUUID , nullable = False )
created_at : Mapped [ datetime ] = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
used : Mapped [ bool ] = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
used_by : Mapped [ str | None ] = db. C olumn( StringUUID , nullable = True )
used_at : Mapped [ datetime | None ] = db. C olumn( db . DateTime , nullable = True )
hash : Mapped [ str | None ] = db. C olumn( db . String ( 255 ) , nullable = True )
created_by : Mapped [ str ] = mapped_c olumn( StringUUID , nullable = False )
created_at : Mapped [ datetime ] = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
used : Mapped [ bool ] = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " false " ) )
used_by : Mapped [ str | None ] = mapped_c olumn( StringUUID , nullable = True )
used_at : Mapped [ datetime | None ] = mapped_c olumn( db . DateTime , nullable = True )
hash : Mapped [ str | None ] = mapped_c olumn( db . String ( 255 ) , nullable = True )
source_url : Mapped [ str ] = mapped_column ( sa . TEXT , default = " " )
def __init__ (
@ -1632,14 +1632,14 @@ class ApiRequest(Base):
db . Index ( " api_request_token_idx " , " tenant_id " , " api_token_id " ) ,
)
id = db. C olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = db. C olumn( StringUUID , nullable = False )
api_token_id = db. C olumn( StringUUID , nullable = False )
path = db. C olumn( db . String ( 255 ) , nullable = False )
request = db. C olumn( db . Text , nullable = True )
response = db. C olumn( db . Text , nullable = True )
ip = db. C olumn( db . String ( 255 ) , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = mapped_c olumn( StringUUID , nullable = False )
api_token_id = mapped_c olumn( StringUUID , nullable = False )
path = mapped_c olumn( db . String ( 255 ) , nullable = False )
request = mapped_c olumn( db . Text , nullable = True )
response = mapped_c olumn( db . Text , nullable = True )
ip = mapped_c olumn( db . String ( 255 ) , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
class MessageChain ( Base ) :
@ -1649,12 +1649,12 @@ class MessageChain(Base):
db . Index ( " message_chain_message_id_idx " , " message_id " ) ,
)
id = db. C olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
message_id = db. C olumn( StringUUID , nullable = False )
type = db. C olumn( db . String ( 255 ) , nullable = False )
input = db. C olumn( db . Text , nullable = True )
output = db. C olumn( db . Text , nullable = True )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = db . func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
message_id = mapped_c olumn( StringUUID , nullable = False )
type = mapped_c olumn( db . String ( 255 ) , nullable = False )
input = mapped_c olumn( db . Text , nullable = True )
output = mapped_c olumn( db . Text , nullable = True )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = db . func . current_timestamp ( ) )
class MessageAgentThought ( Base ) :
@ -1665,34 +1665,34 @@ class MessageAgentThought(Base):
db . Index ( " message_agent_thought_message_chain_id_idx " , " message_chain_id " ) ,
)
id = db. C olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
message_id = db. C olumn( StringUUID , nullable = False )
message_chain_id = db. C olumn( StringUUID , nullable = True )
position = db. C olumn( db . Integer , nullable = False )
thought = db. C olumn( db . Text , nullable = True )
tool = db. C olumn( db . Text , nullable = True )
tool_labels_str = db. C olumn( db . Text , nullable = False , server_default = db . text ( " ' {} ' ::text " ) )
tool_meta_str = db. C olumn( db . Text , nullable = False , server_default = db . text ( " ' {} ' ::text " ) )
tool_input = db. C olumn( db . Text , nullable = True )
observation = db. C olumn( db . Text , nullable = True )
# plugin_id = db.C olumn(StringUUID, nullable=True) ## for future design
tool_process_data = db. C olumn( db . Text , nullable = True )
message = db. C olumn( db . Text , nullable = True )
message_token = db. C olumn( db . Integer , nullable = True )
message_unit_price = db. C olumn( db . Numeric , nullable = True )
message_price_unit = db. C olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
message_files = db. C olumn( db . Text , nullable = True )
id = mapped_c olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
message_id = mapped_c olumn( StringUUID , nullable = False )
message_chain_id = mapped_c olumn( StringUUID , nullable = True )
position = mapped_c olumn( db . Integer , nullable = False )
thought = mapped_c olumn( db . Text , nullable = True )
tool = mapped_c olumn( db . Text , nullable = True )
tool_labels_str = mapped_c olumn( db . Text , nullable = False , server_default = db . text ( " ' {} ' ::text " ) )
tool_meta_str = mapped_c olumn( db . Text , nullable = False , server_default = db . text ( " ' {} ' ::text " ) )
tool_input = mapped_c olumn( db . Text , nullable = True )
observation = mapped_c olumn( db . Text , nullable = True )
# plugin_id = mapped_c olumn(StringUUID, nullable=True) ## for future design
tool_process_data = mapped_c olumn( db . Text , nullable = True )
message = mapped_c olumn( db . Text , nullable = True )
message_token = mapped_c olumn( db . Integer , nullable = True )
message_unit_price = mapped_c olumn( db . Numeric , nullable = True )
message_price_unit = mapped_c olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
message_files = mapped_c olumn( db . Text , nullable = True )
answer = db . Column ( db . Text , nullable = True )
answer_token = db. C olumn( db . Integer , nullable = True )
answer_unit_price = db. C olumn( db . Numeric , nullable = True )
answer_price_unit = db. C olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
tokens = db. C olumn( db . Integer , nullable = True )
total_price = db. C olumn( db . Numeric , nullable = True )
currency = db. C olumn( db . String , nullable = True )
latency = db. C olumn( db . Float , nullable = True )
created_by_role = db. C olumn( db . String , nullable = False )
created_by = db. C olumn( StringUUID , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = db . func . current_timestamp ( ) )
answer_token = mapped_c olumn( db . Integer , nullable = True )
answer_unit_price = mapped_c olumn( db . Numeric , nullable = True )
answer_price_unit = mapped_c olumn( db . Numeric ( 10 , 7 ) , nullable = False , server_default = db . text ( " 0.001 " ) )
tokens = mapped_c olumn( db . Integer , nullable = True )
total_price = mapped_c olumn( db . Numeric , nullable = True )
currency = mapped_c olumn( db . String , nullable = True )
latency = mapped_c olumn( db . Float , nullable = True )
created_by_role = mapped_c olumn( db . String , nullable = False )
created_by = mapped_c olumn( StringUUID , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = db . func . current_timestamp ( ) )
@property
def files ( self ) - > list :
@ -1778,24 +1778,24 @@ class DatasetRetrieverResource(Base):
db . Index ( " dataset_retriever_resource_message_id_idx " , " message_id " ) ,
)
id = db. C olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
message_id = db. C olumn( StringUUID , nullable = False )
position = db. C olumn( db . Integer , nullable = False )
dataset_id = db. C olumn( StringUUID , nullable = False )
dataset_name = db. C olumn( db . Text , nullable = False )
document_id = db. C olumn( StringUUID , nullable = True )
document_name = db. C olumn( db . Text , nullable = False )
data_source_type = db. C olumn( db . Text , nullable = True )
segment_id = db. C olumn( StringUUID , nullable = True )
score = db. C olumn( db . Float , nullable = True )
content = db. C olumn( db . Text , nullable = False )
hit_count = db. C olumn( db . Integer , nullable = True )
word_count = db. C olumn( db . Integer , nullable = True )
segment_position = db. C olumn( db . Integer , nullable = True )
index_node_hash = db. C olumn( db . Text , nullable = True )
retriever_from = db. C olumn( db . Text , nullable = False )
created_by = db. C olumn( StringUUID , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = db . func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , nullable = False , server_default = db . text ( " uuid_generate_v4() " ) )
message_id = mapped_c olumn( StringUUID , nullable = False )
position = mapped_c olumn( db . Integer , nullable = False )
dataset_id = mapped_c olumn( StringUUID , nullable = False )
dataset_name = mapped_c olumn( db . Text , nullable = False )
document_id = mapped_c olumn( StringUUID , nullable = True )
document_name = mapped_c olumn( db . Text , nullable = False )
data_source_type = mapped_c olumn( db . Text , nullable = True )
segment_id = mapped_c olumn( StringUUID , nullable = True )
score = mapped_c olumn( db . Float , nullable = True )
content = mapped_c olumn( db . Text , nullable = False )
hit_count = mapped_c olumn( db . Integer , nullable = True )
word_count = mapped_c olumn( db . Integer , nullable = True )
segment_position = mapped_c olumn( db . Integer , nullable = True )
index_node_hash = mapped_c olumn( db . Text , nullable = True )
retriever_from = mapped_c olumn( db . Text , nullable = False )
created_by = mapped_c olumn( StringUUID , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = db . func . current_timestamp ( ) )
class Tag ( Base ) :
@ -1808,12 +1808,12 @@ class Tag(Base):
TAG_TYPE_LIST = [ " knowledge " , " app " ]
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = db. C olumn( StringUUID , nullable = True )
type = db. C olumn( db . String ( 16 ) , nullable = False )
name = db. C olumn( db . String ( 255 ) , nullable = False )
created_by = db. C olumn( StringUUID , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = mapped_c olumn( StringUUID , nullable = True )
type = mapped_c olumn( db . String ( 16 ) , nullable = False )
name = mapped_c olumn( db . String ( 255 ) , nullable = False )
created_by = mapped_c olumn( StringUUID , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
class TagBinding ( Base ) :
@ -1824,12 +1824,12 @@ class TagBinding(Base):
db . Index ( " tag_bind_tag_id_idx " , " tag_id " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = db. C olumn( StringUUID , nullable = True )
tag_id = db. C olumn( StringUUID , nullable = True )
target_id = db. C olumn( StringUUID , nullable = True )
created_by = db. C olumn( StringUUID , nullable = False )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
tenant_id = mapped_c olumn( StringUUID , nullable = True )
tag_id = mapped_c olumn( StringUUID , nullable = True )
target_id = mapped_c olumn( StringUUID , nullable = True )
created_by = mapped_c olumn( StringUUID , nullable = False )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
class TraceAppConfig ( Base ) :
@ -1839,15 +1839,15 @@ class TraceAppConfig(Base):
db . Index ( " trace_app_config_app_id_idx " , " app_id " ) ,
)
id = db. C olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = db. C olumn( StringUUID , nullable = False )
tracing_provider = db. C olumn( db . String ( 255 ) , nullable = True )
tracing_config = db. C olumn( db . JSON , nullable = True )
created_at = db. C olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = db. C olumn(
id = mapped_c olumn( StringUUID , server_default = db . text ( " uuid_generate_v4() " ) )
app_id = mapped_c olumn( StringUUID , nullable = False )
tracing_provider = mapped_c olumn( db . String ( 255 ) , nullable = True )
tracing_config = mapped_c olumn( db . JSON , nullable = True )
created_at = mapped_c olumn( db . DateTime , nullable = False , server_default = func . current_timestamp ( ) )
updated_at = mapped_c olumn(
db . DateTime , nullable = False , server_default = func . current_timestamp ( ) , onupdate = func . current_timestamp ( )
)
is_active = db. C olumn( db . Boolean , nullable = False , server_default = db . text ( " true " ) )
is_active = mapped_c olumn( db . Boolean , nullable = False , server_default = db . text ( " true " ) )
@property
def tracing_config_dict ( self ) :