Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class InstanceSerializer(serializers.Serializer):
similarity = serializers.FloatField(required=True, max_value=1, min_value=0,
label=_("Similarity"))
search_mode = serializers.CharField(required=True, validators=[
validators.RegexValidator(regex=re.compile("^embedding|keywords|blend$"),
validators.RegexValidator(regex=re.compile("^(embedding|keywords|blend)$"),
message=_("The type only supports embedding|keywords|blend"), code=500)
], label=_("Retrieval Mode"))
workspace_id = serializers.CharField(required=True, label=_("Workspace ID"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DatasetSettingSerializer(serializers.Serializer):
similarity = serializers.FloatField(required=True, max_value=2, min_value=0,
label=_('similarity'))
search_mode = serializers.CharField(required=True, validators=[
validators.RegexValidator(regex=re.compile("^embedding|keywords|blend$"),
validators.RegexValidator(regex=re.compile("^(embedding|keywords|blend)$"),
message=_("The type only supports embedding|keywords|blend"), code=500)
], label=_("Retrieval Mode"))
max_paragraph_char_number = serializers.IntegerField(required=True,
Expand Down
4 changes: 2 additions & 2 deletions apps/application/flow/step_node/tool_node/i_tool_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class InputField(serializers.Serializer):
name = serializers.CharField(required=True, label=_('Variable Name'))
is_required = serializers.BooleanField(required=True, label=_("Is this field required"))
type = serializers.CharField(required=True, label=_("type"), validators=[
validators.RegexValidator(regex=re.compile("^string|int|dict|array|float|boolean$"),
validators.RegexValidator(regex=re.compile("^(string|int|dict|array|float|boolean)$"),
message=_("The field only supports string|int|dict|array|float"), code=500)
])
source = serializers.CharField(required=True, label=_("source"), validators=[
validators.RegexValidator(regex=re.compile("^custom|reference$"),
validators.RegexValidator(regex=re.compile("^(custom|reference)$"),
message=_("The field only supports custom|reference"), code=500)
])
value = ObjectField(required=True, label=_("Variable Value"), model_type_list=[str, list])
Expand Down
4 changes: 2 additions & 2 deletions apps/application/serializers/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ class KnowledgeSettingSerializer(serializers.Serializer):
required=True,
validators=[
validators.RegexValidator(
regex=re.compile("^embedding|keywords|blend$"),
regex=re.compile("^(embedding|keywords|blend)$"),
message=_("The type only supports embedding|keywords|blend"),
code=500,
)
Expand Down Expand Up @@ -641,7 +641,7 @@ class SimplateRequest(serializers.Serializer):
label=_("Application Type"),
validators=[
validators.RegexValidator(
regex=re.compile("^SIMPLE|WORK_FLOW$"),
regex=re.compile("^(SIMPLE|WORK_FLOW)$"),
message=_("Application type only supports SIMPLE|WORK_FLOW"),
code=500,
)
Expand Down
2 changes: 1 addition & 1 deletion apps/application/serializers/application_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ApplicationChatQuerySerializers(serializers.Serializer):
min_trample = serializers.IntegerField(required=False, min_value=0,
label=_("Minimum number of clicks"))
comparer = serializers.CharField(required=False, label=_("Comparator"), validators=[
validators.RegexValidator(regex=re.compile("^and|or$"),
validators.RegexValidator(regex=re.compile("^(and|or)$"),
message=_("Only supports and|or"), code=500)
])

Expand Down
4 changes: 2 additions & 2 deletions apps/knowledge/serializers/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class DocumentEditInstanceSerializer(serializers.Serializer):
required=False,
validators=[
validators.RegexValidator(
regex=re.compile("^optimization|directly_return$"),
regex=re.compile("^(optimization|directly_return)$"),
message=_("The type only supports optimization|directly_return"),
code=500,
)
Expand Down Expand Up @@ -266,7 +266,7 @@ class Export(serializers.Serializer):
required=True,
validators=[
validators.RegexValidator(
regex=re.compile("^csv|excel$"), message=_("The template type only supports excel|csv"), code=500
regex=re.compile("^(csv|excel)$"), message=_("The template type only supports excel|csv"), code=500
)
],
label=_("type"),
Expand Down
6 changes: 3 additions & 3 deletions apps/knowledge/serializers/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class HitTestSerializer(serializers.Serializer):
label=_("search mode"),
validators=[
validators.RegexValidator(
regex=re.compile("^embedding|keywords|blend$"),
regex=re.compile("^(embedding|keywords|blend)$"),
message=_("The type only supports embedding|keywords|blend"),
code=500,
)
Expand Down Expand Up @@ -1257,7 +1257,7 @@ class SyncWeb(serializers.Serializer):
label=_("sync type"),
validators=[
validators.RegexValidator(
regex=re.compile("^replace|complete$"),
regex=re.compile("^(replace|complete)$"),
message=_("The synchronization type only supports:replace|complete"),
code=500,
)
Expand Down Expand Up @@ -1364,7 +1364,7 @@ class HitTest(serializers.Serializer):
label=_("search mode"),
validators=[
validators.RegexValidator(
regex=re.compile("^embedding|keywords|blend$"),
regex=re.compile("^(embedding|keywords|blend)$"),
message=_("The type only supports embedding|keywords|blend"),
code=500,
)
Expand Down
2 changes: 1 addition & 1 deletion apps/system_manage/serializers/valid_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

class ValidSerializer(serializers.Serializer):
valid_type = serializers.CharField(required=True, label=_('type'), validators=[
validators.RegexValidator(regex=re.compile("^application|knowledge|user$"),
validators.RegexValidator(regex=re.compile("^(application|knowledge|user)$"),
message="类型只支持:application|knowledge|user", code=500)
])
valid_count = serializers.IntegerField(required=True, label=_('check quantity'))
Expand Down
2 changes: 1 addition & 1 deletion apps/trigger/serializers/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def is_valid(self, *, model=None, raise_exception=False):

class InputField(serializers.Serializer):
source = serializers.CharField(required=True, label=_("source"), validators=[
validators.RegexValidator(regex=re.compile("^custom|reference$"),
validators.RegexValidator(regex=re.compile("^(custom|reference)$"),
message=_("The field only supports custom|reference"), code=500)
])
value = ObjectField(required=True, label=_("Variable Value"), model_type_list=[str, list])
Expand Down
4 changes: 2 additions & 2 deletions apps/users/serializers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ class SendEmailSerializer(serializers.Serializer):
code=ExceptionCodeConstants.EMAIL_FORMAT_ERROR.value.code)])

type = serializers.CharField(required=True, label=_("Type"), validators=[
validators.RegexValidator(regex=re.compile("^register|reset_password$"),
validators.RegexValidator(regex=re.compile("^(register|reset_password)$"),
message=_("The type only supports register|reset_password"), code=500)
])

Expand Down Expand Up @@ -1231,7 +1231,7 @@ class CheckCodeSerializer(serializers.Serializer):
type = serializers.CharField(required=True,
label=_("Type"),
validators=[
validators.RegexValidator(regex=re.compile("^register|reset_password$"),
validators.RegexValidator(regex=re.compile("^(register|reset_password)$"),
message=_(
"The type only supports register|reset_password"),
code=500)
Expand Down