mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
feat(model): add validation for custom disclaimer length (#10287)
This commit is contained in:
parent
52eb18937e
commit
6ab6b9cc40
|
@ -1298,7 +1298,7 @@ class Site(db.Model):
|
||||||
privacy_policy = db.Column(db.String(255))
|
privacy_policy = db.Column(db.String(255))
|
||||||
show_workflow_steps = db.Column(db.Boolean, nullable=False, server_default=db.text("true"))
|
show_workflow_steps = db.Column(db.Boolean, nullable=False, server_default=db.text("true"))
|
||||||
use_icon_as_answer_icon = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
use_icon_as_answer_icon = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||||
custom_disclaimer: Mapped[str] = mapped_column(sa.TEXT, default="")
|
_custom_disclaimer: Mapped[str] = mapped_column("custom_disclaimer", sa.TEXT, default="")
|
||||||
customize_domain = db.Column(db.String(255))
|
customize_domain = db.Column(db.String(255))
|
||||||
customize_token_strategy = db.Column(db.String(255), nullable=False)
|
customize_token_strategy = db.Column(db.String(255), nullable=False)
|
||||||
prompt_public = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
prompt_public = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||||
|
@ -1309,6 +1309,16 @@ class Site(db.Model):
|
||||||
updated_at = db.Column(db.DateTime, nullable=False, server_default=db.text("CURRENT_TIMESTAMP(0)"))
|
updated_at = db.Column(db.DateTime, nullable=False, server_default=db.text("CURRENT_TIMESTAMP(0)"))
|
||||||
code = db.Column(db.String(255))
|
code = db.Column(db.String(255))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def custom_disclaimer(self):
|
||||||
|
return self._custom_disclaimer
|
||||||
|
|
||||||
|
@custom_disclaimer.setter
|
||||||
|
def custom_disclaimer(self, value: str):
|
||||||
|
if len(value) > 512:
|
||||||
|
raise ValueError("Custom disclaimer cannot exceed 512 characters.")
|
||||||
|
self._custom_disclaimer = value
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_code(n):
|
def generate_code(n):
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user