Merge branch 'main' of https://github.com/maxkb-dev/maxkb
This commit is contained in:
commit
997771744f
@ -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, \
|
delete_embedding_by_document, update_embedding_dataset_id, delete_embedding_by_paragraph_ids, \
|
||||||
embedding_by_document_list
|
embedding_by_document_list
|
||||||
from smartdoc.conf import PROJECT_DIR
|
from smartdoc.conf import PROJECT_DIR
|
||||||
from django.db import models
|
|
||||||
|
|
||||||
parse_qa_handle_list = [XlsParseQAHandle(), CsvParseQAHandle(), XlsxParseQAHandle()]
|
parse_qa_handle_list = [XlsParseQAHandle(), CsvParseQAHandle(), XlsxParseQAHandle()]
|
||||||
parse_table_handle_list = [CsvSplitHandle(), XlsSplitHandle(), XlsxSplitHandle()]
|
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("命中处理方式"))
|
hit_handling_method = serializers.CharField(required=False, error_messages=ErrMessage.char("命中处理方式"))
|
||||||
is_active = serializers.BooleanField(required=False, error_messages=ErrMessage.boolean("文档是否可用"))
|
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("文档状态"))
|
status = serializers.CharField(required=False, error_messages=ErrMessage.char("文档状态"))
|
||||||
|
|
||||||
def get_query_set(self):
|
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')})
|
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:
|
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')})
|
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:
|
if 'status' in self.data and self.data.get(
|
||||||
query_set = query_set.filter(**{'status': self.data.get('status')})
|
'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')
|
query_set = query_set.order_by('-create_time', 'id')
|
||||||
return query_set
|
return query_set
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,12 @@
|
|||||||
<div
|
<div
|
||||||
class="p-8-12"
|
class="p-8-12"
|
||||||
v-loading="localLoading"
|
v-loading="localLoading"
|
||||||
v-if="uploadDocumentList.length || uploadImageList.length || uploadAudioList.length || uploadVideoList.length"
|
v-if="
|
||||||
|
uploadDocumentList.length ||
|
||||||
|
uploadImageList.length ||
|
||||||
|
uploadAudioList.length ||
|
||||||
|
uploadVideoList.length
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<el-space wrap>
|
<el-space wrap>
|
||||||
<template v-for="(item, index) in uploadDocumentList" :key="index">
|
<template v-for="(item, index) in uploadDocumentList" :key="index">
|
||||||
@ -248,14 +253,21 @@ const getAcceptList = () => {
|
|||||||
const checkMaxFilesLimit = () => {
|
const checkMaxFilesLimit = () => {
|
||||||
return (
|
return (
|
||||||
props.applicationDetails.file_upload_setting.maxFiles <=
|
props.applicationDetails.file_upload_setting.maxFiles <=
|
||||||
uploadImageList.value.length + uploadDocumentList.value.length + uploadAudioList.value.length + uploadVideoList.value.length
|
uploadImageList.value.length +
|
||||||
|
uploadDocumentList.value.length +
|
||||||
|
uploadAudioList.value.length +
|
||||||
|
uploadVideoList.value.length
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadFile = async (file: any, fileList: any) => {
|
const uploadFile = async (file: any, fileList: any) => {
|
||||||
const { maxFiles, fileLimit } = props.applicationDetails.file_upload_setting
|
const { maxFiles, fileLimit } = props.applicationDetails.file_upload_setting
|
||||||
// 单次上传文件数量限制
|
// 单次上传文件数量限制
|
||||||
const file_limit_once = uploadImageList.value.length + uploadDocumentList.value.length + uploadAudioList.value.length + uploadVideoList.value.length
|
const file_limit_once =
|
||||||
|
uploadImageList.value.length +
|
||||||
|
uploadDocumentList.value.length +
|
||||||
|
uploadAudioList.value.length +
|
||||||
|
uploadVideoList.value.length
|
||||||
if (file_limit_once >= maxFiles) {
|
if (file_limit_once >= maxFiles) {
|
||||||
MsgWarning('最多上传' + maxFiles + '个文件')
|
MsgWarning('最多上传' + maxFiles + '个文件')
|
||||||
fileList.splice(0, fileList.length)
|
fileList.splice(0, fileList.length)
|
||||||
@ -283,7 +295,6 @@ const uploadFile = async (file: any, fileList: any) => {
|
|||||||
uploadAudioList.value.push(file)
|
uploadAudioList.value.push(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!chatId_context.value) {
|
if (!chatId_context.value) {
|
||||||
const res = await props.openChatId()
|
const res = await props.openChatId()
|
||||||
chatId_context.value = res
|
chatId_context.value = res
|
||||||
@ -332,6 +343,9 @@ const uploadFile = async (file: any, fileList: any) => {
|
|||||||
file.file_id = f[0].file_id
|
file.file_id = f[0].file_id
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (!inputValue.value && uploadImageList.value.length > 0) {
|
||||||
|
inputValue.value = '请解析图片内容'
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const recorderTime = ref(0)
|
const recorderTime = ref(0)
|
||||||
@ -471,7 +485,7 @@ function sendChatHandle(event: any) {
|
|||||||
image_list: uploadImageList.value,
|
image_list: uploadImageList.value,
|
||||||
document_list: uploadDocumentList.value,
|
document_list: uploadDocumentList.value,
|
||||||
audio_list: uploadAudioList.value,
|
audio_list: uploadAudioList.value,
|
||||||
video_list: uploadVideoList.value,
|
video_list: uploadVideoList.value
|
||||||
})
|
})
|
||||||
inputValue.value = ''
|
inputValue.value = ''
|
||||||
uploadImageList.value = []
|
uploadImageList.value = []
|
||||||
|
|||||||
@ -171,7 +171,7 @@ const applicationList = ref<any[]>([])
|
|||||||
|
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 20,
|
page_size: 30,
|
||||||
total: 0
|
total: 0
|
||||||
})
|
})
|
||||||
interface UserOption {
|
interface UserOption {
|
||||||
|
|||||||
@ -99,33 +99,43 @@
|
|||||||
>全部</el-dropdown-item
|
>全部</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:class="filterMethod['status'] === '1' ? 'is-active' : ''"
|
:class="filterMethod['status'] === State.SUCCESS ? 'is-active' : ''"
|
||||||
class="justify-center"
|
class="justify-center"
|
||||||
:command="beforeCommand('status', '1')"
|
:command="beforeCommand('status', State.SUCCESS)"
|
||||||
>成功</el-dropdown-item
|
>成功</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:class="filterMethod['status'] === '2' ? 'is-active' : ''"
|
:class="filterMethod['status'] === State.FAILURE ? 'is-active' : ''"
|
||||||
class="justify-center"
|
class="justify-center"
|
||||||
:command="beforeCommand('status', '2')"
|
:command="beforeCommand('status', State.FAILURE)"
|
||||||
>失败</el-dropdown-item
|
>失败</el-dropdown-item
|
||||||
>
|
>
|
||||||
<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"
|
class="justify-center"
|
||||||
:command="beforeCommand('status', '0')"
|
:command="beforeCommand('status', State.STARTED, TaskType.EMBEDDING)"
|
||||||
>索引中</el-dropdown-item
|
>索引中</el-dropdown-item
|
||||||
>
|
>
|
||||||
<el-dropdown-item
|
<el-dropdown-item
|
||||||
:class="filterMethod['status'] === '3' ? 'is-active' : ''"
|
:class="filterMethod['status'] === State.PENDING ? 'is-active' : ''"
|
||||||
class="justify-center"
|
class="justify-center"
|
||||||
:command="beforeCommand('status', '3')"
|
:command="beforeCommand('status', State.PENDING)"
|
||||||
>排队中</el-dropdown-item
|
>排队中</el-dropdown-item
|
||||||
>
|
>
|
||||||
<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"
|
class="justify-center"
|
||||||
:command="beforeCommand('status', '4')"
|
:command="beforeCommand('status', State.STARTED, TaskType.GENERATE_PROBLEM)"
|
||||||
>生成问题中</el-dropdown-item
|
>生成问题中</el-dropdown-item
|
||||||
>
|
>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
@ -481,13 +491,18 @@ function openDatasetDialog(row?: any) {
|
|||||||
|
|
||||||
function dropdownHandle(obj: any) {
|
function dropdownHandle(obj: any) {
|
||||||
filterMethod.value[obj.attr] = obj.command
|
filterMethod.value[obj.attr] = obj.command
|
||||||
|
if (obj.attr == 'status') {
|
||||||
|
filterMethod.value['task_type'] = obj.task_type
|
||||||
|
}
|
||||||
|
|
||||||
getList()
|
getList()
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeCommand(attr: string, val: any) {
|
function beforeCommand(attr: string, val: any, task_type?: number) {
|
||||||
return {
|
return {
|
||||||
attr: attr,
|
attr: attr,
|
||||||
command: val
|
command: val,
|
||||||
|
task_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const cancelTask = (row: any, task_type: number) => {
|
const cancelTask = (row: any, task_type: number) => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user