Skip to content

Commit

Permalink
fix: The document list status filtering is incorrect. (#1822)
Browse files Browse the repository at this point in the history
(cherry picked from commit 36f1a3b)
  • Loading branch information
shaohuzhang1 committed Dec 11, 2024
1 parent 5c6e1ad commit 16ecccb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions apps/dataset/serializers/document_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,21 @@ def get_request_params_api():
required=True,
description='知识库id'),
]

@staticmethod
def get_request_body_api():
return openapi.Schema(
type=openapi.TYPE_OBJECT,
required=['source_url_list'],
properties={
'source_url_list': openapi.Schema(type=openapi.TYPE_ARRAY, title="文档地址列表", description="文档地址列表",
'source_url_list': openapi.Schema(type=openapi.TYPE_ARRAY, title="文档地址列表",
description="文档地址列表",
items=openapi.Schema(type=openapi.TYPE_STRING)),
'selector': openapi.Schema(type=openapi.TYPE_STRING, title="选择器", description="选择器")
}
)



class DocumentInstanceSerializer(ApiMixin, serializers.Serializer):
name = serializers.CharField(required=True,
error_messages=ErrMessage.char("文档名称"),
Expand Down Expand Up @@ -396,8 +397,8 @@ def get_query_set(self):
query_set = query_set.annotate(
reversed_status=Reverse('status'),
task_type_status=Substr('reversed_status', TaskType(task_type).value,
TaskType(task_type).value),
).filter(task_type_status__in=[State(status).value]).values('id')
1),
).filter(task_type_status=State(status).value).values('id')
else:
if status != State.SUCCESS.value:
query_set = query_set.filter(status__icontains=status)
Expand Down Expand Up @@ -674,15 +675,15 @@ def cancel(self, instance, with_valid=True):
ListenerManagement.update_status(QuerySet(Paragraph).annotate(
reversed_status=Reverse('status'),
task_type_status=Substr('reversed_status', TaskType(instance.get('type')).value,
TaskType(instance.get('type')).value),
1),
).filter(task_type_status__in=[State.PENDING.value, State.STARTED.value]).filter(
document_id=document_id).values('id'),
TaskType(instance.get('type')),
State.REVOKE)
ListenerManagement.update_status(QuerySet(Document).annotate(
reversed_status=Reverse('status'),
task_type_status=Substr('reversed_status', TaskType(instance.get('type')).value,
TaskType(instance.get('type')).value),
1),
).filter(task_type_status__in=[State.PENDING.value, State.STARTED.value]).filter(
id=document_id).values('id'),
TaskType(instance.get('type')),
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/document/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
"
class="justify-center"
:command="beforeCommand('status', State.STARTED, TaskType.GENERATE_PROBLEM)"
>生成问题中</el-dropdown-item
>生成中</el-dropdown-item
>
</el-dropdown-menu>
</template>
Expand Down

0 comments on commit 16ecccb

Please sign in to comment.