mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
parent
87f3c88fd2
commit
a7f7189df8
|
|
@ -56,7 +56,6 @@ from embedding.task.embedding import embedding_by_document, delete_embedding_by_
|
|||
delete_embedding_by_document, update_embedding_dataset_id, delete_embedding_by_paragraph_ids, \
|
||||
embedding_by_document_list
|
||||
from smartdoc.conf import PROJECT_DIR
|
||||
from django.db import models
|
||||
|
||||
parse_qa_handle_list = [XlsParseQAHandle(), CsvParseQAHandle(), XlsxParseQAHandle()]
|
||||
parse_table_handle_list = [CsvSplitHandle(), XlsSplitHandle(), XlsxSplitHandle()]
|
||||
|
|
@ -364,6 +363,7 @@ class DocumentSerializers(ApiMixin, serializers.Serializer):
|
|||
"文档名称"))
|
||||
hit_handling_method = serializers.CharField(required=False, error_messages=ErrMessage.char("命中处理方式"))
|
||||
is_active = serializers.BooleanField(required=False, error_messages=ErrMessage.boolean("文档是否可用"))
|
||||
task_type = serializers.IntegerField(required=False, error_messages=ErrMessage.integer("任务类型"))
|
||||
status = serializers.CharField(required=False, error_messages=ErrMessage.char("文档状态"))
|
||||
|
||||
def get_query_set(self):
|
||||
|
|
@ -375,8 +375,22 @@ class DocumentSerializers(ApiMixin, serializers.Serializer):
|
|||
query_set = query_set.filter(**{'hit_handling_method': self.data.get('hit_handling_method')})
|
||||
if 'is_active' in self.data and self.data.get('is_active') is not None:
|
||||
query_set = query_set.filter(**{'is_active': self.data.get('is_active')})
|
||||
if 'status' in self.data and self.data.get('status') is not None:
|
||||
query_set = query_set.filter(**{'status': self.data.get('status')})
|
||||
if 'status' in self.data and self.data.get(
|
||||
'status') is not None:
|
||||
task_type = self.data.get('task_type')
|
||||
status = self.data.get(
|
||||
'status')
|
||||
if task_type is not None:
|
||||
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')
|
||||
else:
|
||||
if status != State.SUCCESS.value:
|
||||
query_set = query_set.filter(status__icontains=status)
|
||||
else:
|
||||
query_set = query_set.filter(status__iregex='^[2n]*$')
|
||||
query_set = query_set.order_by('-create_time', 'id')
|
||||
return query_set
|
||||
|
||||
|
|
|
|||
|
|
@ -99,33 +99,43 @@
|
|||
>全部</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
:class="filterMethod['status'] === '1' ? 'is-active' : ''"
|
||||
:class="filterMethod['status'] === State.SUCCESS ? 'is-active' : ''"
|
||||
class="justify-center"
|
||||
:command="beforeCommand('status', '1')"
|
||||
:command="beforeCommand('status', State.SUCCESS)"
|
||||
>成功</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
:class="filterMethod['status'] === '2' ? 'is-active' : ''"
|
||||
:class="filterMethod['status'] === State.FAILURE ? 'is-active' : ''"
|
||||
class="justify-center"
|
||||
:command="beforeCommand('status', '2')"
|
||||
:command="beforeCommand('status', State.FAILURE)"
|
||||
>失败</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
:class="filterMethod['status'] === '0' ? 'is-active' : ''"
|
||||
:class="
|
||||
filterMethod['status'] === State.STARTED &&
|
||||
filterMethod['task_type'] == TaskType.EMBEDDING
|
||||
? 'is-active'
|
||||
: ''
|
||||
"
|
||||
class="justify-center"
|
||||
:command="beforeCommand('status', '0')"
|
||||
:command="beforeCommand('status', State.STARTED, TaskType.EMBEDDING)"
|
||||
>索引中</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
:class="filterMethod['status'] === '3' ? 'is-active' : ''"
|
||||
:class="filterMethod['status'] === State.PENDING ? 'is-active' : ''"
|
||||
class="justify-center"
|
||||
:command="beforeCommand('status', '3')"
|
||||
:command="beforeCommand('status', State.PENDING)"
|
||||
>排队中</el-dropdown-item
|
||||
>
|
||||
<el-dropdown-item
|
||||
:class="filterMethod['status'] === '4' ? 'is-active' : ''"
|
||||
:class="
|
||||
filterMethod['status'] === State.STARTED &&
|
||||
filterMethod['task_type'] === TaskType.GENERATE_PROBLEM
|
||||
? 'is-active'
|
||||
: ''
|
||||
"
|
||||
class="justify-center"
|
||||
:command="beforeCommand('status', '4')"
|
||||
:command="beforeCommand('status', State.STARTED, TaskType.GENERATE_PROBLEM)"
|
||||
>生成问题中</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
|
|
@ -481,13 +491,18 @@ function openDatasetDialog(row?: any) {
|
|||
|
||||
function dropdownHandle(obj: any) {
|
||||
filterMethod.value[obj.attr] = obj.command
|
||||
if (obj.attr == 'status') {
|
||||
filterMethod.value['task_type'] = obj.task_type
|
||||
}
|
||||
|
||||
getList()
|
||||
}
|
||||
|
||||
function beforeCommand(attr: string, val: any) {
|
||||
function beforeCommand(attr: string, val: any, task_type?: number) {
|
||||
return {
|
||||
attr: attr,
|
||||
command: val
|
||||
command: val,
|
||||
task_type
|
||||
}
|
||||
}
|
||||
const cancelTask = (row: any, task_type: number) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue