From aa94f66492edc134868c0d73ffaf125457bd49fa Mon Sep 17 00:00:00 2001
From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com>
Date: Tue, 10 Dec 2024 11:00:44 +0800
Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E6=A1=A3?=
=?UTF-8?q?=E7=8A=B6=E6=80=81=E6=97=A0=E6=B3=95=E8=BF=87=E6=BB=A4=20(#1800?=
=?UTF-8?q?)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../serializers/document_serializers.py | 20 ++++++++--
ui/src/views/document/index.vue | 39 +++++++++++++------
2 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/apps/dataset/serializers/document_serializers.py b/apps/dataset/serializers/document_serializers.py
index 62f4c90bd..677251eae 100644
--- a/apps/dataset/serializers/document_serializers.py
+++ b/apps/dataset/serializers/document_serializers.py
@@ -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
diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue
index 809ea6090..c3e6052ef 100644
--- a/ui/src/views/document/index.vue
+++ b/ui/src/views/document/index.vue
@@ -99,33 +99,43 @@
>全部
成功
失败
索引中
排队中
生成问题中
@@ -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) => {
From cacdfbcb62e75fdafe45c4cd3a57b9121328f179 Mon Sep 17 00:00:00 2001
From: wangdan-fit2cloud
Date: Tue, 10 Dec 2024 11:01:35 +0800
Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E5=9B=BE=E7=89=87=E5=AF=B9=E8=AF=9D=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../component/chat-input-operate/index.vue | 24 +++++++++++++++----
ui/src/views/application/index.vue | 2 +-
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/ui/src/components/ai-chat/component/chat-input-operate/index.vue b/ui/src/components/ai-chat/component/chat-input-operate/index.vue
index 3670b8537..0c557bbfb 100644
--- a/ui/src/components/ai-chat/component/chat-input-operate/index.vue
+++ b/ui/src/components/ai-chat/component/chat-input-operate/index.vue
@@ -6,7 +6,12 @@
@@ -248,14 +253,21 @@ const getAcceptList = () => {
const checkMaxFilesLimit = () => {
return (
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 { 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) {
MsgWarning('最多上传' + maxFiles + '个文件')
fileList.splice(0, fileList.length)
@@ -283,7 +295,6 @@ const uploadFile = async (file: any, fileList: any) => {
uploadAudioList.value.push(file)
}
-
if (!chatId_context.value) {
const res = await props.openChatId()
chatId_context.value = res
@@ -332,6 +343,9 @@ const uploadFile = async (file: any, fileList: any) => {
file.file_id = f[0].file_id
}
})
+ if (!inputValue.value && uploadImageList.value.length > 0) {
+ inputValue.value = '请解析图片内容'
+ }
})
}
const recorderTime = ref(0)
@@ -471,7 +485,7 @@ function sendChatHandle(event: any) {
image_list: uploadImageList.value,
document_list: uploadDocumentList.value,
audio_list: uploadAudioList.value,
- video_list: uploadVideoList.value,
+ video_list: uploadVideoList.value
})
inputValue.value = ''
uploadImageList.value = []
diff --git a/ui/src/views/application/index.vue b/ui/src/views/application/index.vue
index 3b2df8f21..97eba9c05 100644
--- a/ui/src/views/application/index.vue
+++ b/ui/src/views/application/index.vue
@@ -171,7 +171,7 @@ const applicationList = ref([])
const paginationConfig = reactive({
current_page: 1,
- page_size: 20,
+ page_size: 30,
total: 0
})
interface UserOption {