mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-30 09:42:48 +00:00
feat: 添加发布接口
This commit is contained in:
parent
ec59a6968b
commit
e6c94750df
|
|
@ -18,7 +18,8 @@ from common.util.field_message import ErrMessage
|
|||
class ReplyNodeParamsSerializer(serializers.Serializer):
|
||||
reply_type = serializers.CharField(required=True, error_messages=ErrMessage.char("回复类型"))
|
||||
fields = serializers.ListField(required=False, error_messages=ErrMessage.list("引用字段"))
|
||||
content = serializers.CharField(required=False, error_messages=ErrMessage.char("直接回答内容"))
|
||||
content = serializers.CharField(required=False, allow_blank=True, allow_null=True,
|
||||
error_messages=ErrMessage.char("直接回答内容"))
|
||||
|
||||
def is_valid(self, *, raise_exception=False):
|
||||
super().is_valid(raise_exception=True)
|
||||
|
|
|
|||
|
|
@ -60,12 +60,12 @@ class Flow:
|
|||
|
||||
@staticmethod
|
||||
def is_valid_node_params(node: Node):
|
||||
get_node(node.type)(node, Node)
|
||||
get_node(node.type)(node, None, None)
|
||||
|
||||
def is_valid_node(self, node: Node):
|
||||
self.is_valid_node_params(node)
|
||||
if node.type == 'condition-node':
|
||||
branch_list = node.properties.get('branch')
|
||||
branch_list = node.properties.get('node_data').get('branch')
|
||||
for branch in branch_list:
|
||||
source_anchor_id = f"{node.id}_{branch.get('id')}_right"
|
||||
edge_list = [edge for edge in self.edges if edge.sourceAnchorId == source_anchor_id]
|
||||
|
|
@ -89,7 +89,7 @@ class Flow:
|
|||
node_list = reduce(lambda x, y: [*x, *y],
|
||||
[[node for node in self.nodes if node.id == edge.targetNodeId] for edge in edge_list],
|
||||
[])
|
||||
if len(node_list) == 0:
|
||||
if len(node_list) == 0 and not end_nodes.__contains__(node.type):
|
||||
raise AppApiException(500,
|
||||
f'不存在的下一个节点')
|
||||
return node_list
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ urlpatterns = [
|
|||
path('application/profile', views.Application.Profile.as_view(), name='application/profile'),
|
||||
path('application/embed', views.Application.Embed.as_view()),
|
||||
path('application/authentication', views.Application.Authentication.as_view()),
|
||||
path('application/<str:application_id>/publish', views.Application.Publish.as_view()),
|
||||
path('application/<str:application_id>/edit_icon', views.Application.EditIcon.as_view()),
|
||||
path('application/<str:application_id>/statistics/customer_count',
|
||||
views.ApplicationStatistics.CustomerCount.as_view()),
|
||||
|
|
|
|||
Loading…
Reference in New Issue