From d276bc928fe93df3024e2633d20ac253270d938b Mon Sep 17 00:00:00 2001
From: wxg0103 <727495428@qq.com>
Date: Tue, 26 Nov 2024 11:41:47 +0800
Subject: [PATCH 1/6] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=E5=BC=95?=
=?UTF-8?q?=E7=94=A8=E7=9F=A5=E8=AF=86=E5=BA=93=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ui/src/components/ai-chat/KnowledgeSource.vue | 77 +++++++++----------
.../ai-chat/component/ParagraphCard.vue | 59 +-------------
2 files changed, 38 insertions(+), 98 deletions(-)
diff --git a/ui/src/components/ai-chat/KnowledgeSource.vue b/ui/src/components/ai-chat/KnowledgeSource.vue
index 4de9ce1cf..1c5369a3c 100644
--- a/ui/src/components/ai-chat/KnowledgeSource.vue
+++ b/ui/src/components/ai-chat/KnowledgeSource.vue
@@ -8,30 +8,31 @@
>
@@ -59,7 +60,7 @@ import { computed, ref } from 'vue'
import ParagraphSourceDialog from './ParagraphSourceDialog.vue'
import ExecutionDetailDialog from './ExecutionDetailDialog.vue'
import { isWorkFlow } from '@/utils/application'
-
+import { getImgUrl } from '@/utils/utils'
const props = defineProps({
data: {
type: Object,
@@ -70,15 +71,6 @@ const props = defineProps({
default: ''
}
})
-const iconMap: { [key: string]: string } = {
- doc: '../../assets/doc-icon.svg',
- docx: '../../assets/docx-icon.svg',
- pdf: '../../assets/pdf-icon.svg',
- md: '../../assets/md-icon.svg',
- txt: '../../assets/txt-icon.svg',
- xls: '../../assets/xls-icon.svg',
- xlsx: '../../assets/xlsx-icon.svg'
-}
const ParagraphSourceDialogRef = ref()
const ExecutionDetailDialogRef = ref()
@@ -106,15 +98,16 @@ const uniqueParagraphList = computed(() => {
}) || []
)
})
-
-function getIconPath(documentName: string) {
- const extension = documentName.split('.').pop()?.toLowerCase()
- if (!documentName || !extension) return new URL(`${iconMap['doc']}`, import.meta.url).href
- if (iconMap && extension && iconMap[extension]) {
- return new URL(`${iconMap[extension]}`, import.meta.url).href
- }
- return new URL(`${iconMap['doc']}`, import.meta.url).href
+function fileType(name: string) {
+ const suffix = name.split('.')
+ return suffix[suffix.length - 1]
}
+const typeList: any = {
+ txt: ['txt', 'pdf', 'docx', 'csv', 'md', 'html'],
+ table: ['xlsx', 'xls', 'csv'],
+ QA: ['xlsx', 'csv', 'xls']
+}
+
function openLink(url: string) {
// 如果url不是以/结尾,加上/
if (url && !url.endsWith('/')) {
diff --git a/ui/src/components/ai-chat/component/ParagraphCard.vue b/ui/src/components/ai-chat/component/ParagraphCard.vue
index 1a566c149..4fb785e67 100644
--- a/ui/src/components/ai-chat/component/ParagraphCard.vue
+++ b/ui/src/components/ai-chat/component/ParagraphCard.vue
@@ -18,45 +18,8 @@
-
- 成功
-
-
- 失败
-
-
- 索引中
-
-
- 排队中
-
-
- 生成问题中
-
+
@@ -249,7 +235,7 @@
-
+
@@ -298,7 +284,22 @@
-
+
+
+
+
+
+
+
@@ -315,9 +316,18 @@
设置
-
+
- 生成关联问题
+ 取消生成问题
+
+
+
+ 生成问题
@@ -360,7 +370,9 @@ import { datetimeFormat } from '@/utils/time'
import { hitHandlingMethod } from '@/enums/document'
import { MsgSuccess, MsgConfirm, MsgError } from '@/utils/message'
import useStore from '@/stores'
+import StatusVlue from '@/views/document/component/Status.vue'
import GenerateRelatedDialog from '@/views/document/component/GenerateRelatedDialog.vue'
+import { TaskType, State } from '@/utils/status'
const router = useRouter()
const route = useRoute()
const {
@@ -368,9 +380,11 @@ const {
} = route as any
const { common, dataset, document } = useStore()
-
const storeKey = 'documents'
-
+const getTaskState = (status, taskType) => {
+ const statusList = status.split('').reverse()
+ return taskType - 1 > statusList.length + 1 ? 'n' : statusList[taskType - 1]
+}
onBeforeRouteUpdate(() => {
common.savePage(storeKey, null)
common.saveCondition(storeKey, null)
@@ -441,7 +455,11 @@ function beforeCommand(attr: string, val: any) {
command: val
}
}
-
+const cancelTask = (row: any, task_type: number) => {
+ documentApi.cancelTask(row.dataset_id, row.id, { type: task_type }).then(() => {
+ MsgSuccess('发送成功')
+ })
+}
function syncDataset() {
SyncWebDialogRef.value.open(id)
}
From 98f25c99f2e635950362b137b29fc81c73050fd5 Mon Sep 17 00:00:00 2001
From: shaohuzhang1 <80892890+shaohuzhang1@users.noreply.github.com>
Date: Tue, 26 Nov 2024 13:29:46 +0800
Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E5=8E=86=E5=8F=B2?=
=?UTF-8?q?=E6=95=B0=E6=8D=AE=20(#1692)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/common/event/listener_manage.py | 8 +++-----
...tatus_meta_paragraph_status_meta_and_more.py | 17 +++++++++++++++--
.../dataset/sql/update_document_status_meta.sql | 2 +-
ui/src/utils/status.ts | 2 +-
ui/src/views/document/index.vue | 2 +-
5 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/apps/common/event/listener_manage.py b/apps/common/event/listener_manage.py
index 5e52aa1ef..a98b29bf1 100644
--- a/apps/common/event/listener_manage.py
+++ b/apps/common/event/listener_manage.py
@@ -170,8 +170,7 @@ class ListenerManagement:
def aggregation_document_status():
sql = get_file_content(
os.path.join(PROJECT_DIR, "apps", "dataset", 'sql', 'update_document_status_meta.sql'))
- native_update({'document_custom_sql': QuerySet(Document).filter(id=document_id),
- 'default_sql': QuerySet(Document).filter(id=document_id)}, sql, with_table_name=True)
+ native_update({'document_custom_sql': QuerySet(Document).filter(id=document_id)}, sql, with_table_name=True)
return aggregation_document_status
@@ -180,8 +179,7 @@ class ListenerManagement:
def aggregation_document_status():
sql = get_file_content(
os.path.join(PROJECT_DIR, "apps", "dataset", 'sql', 'update_document_status_meta.sql'))
- native_update({'document_custom_sql': QuerySet(Document).filter(dataset_id=dataset_id),
- 'default_sql': QuerySet(Document).filter(dataset_id=dataset_id)}, sql)
+ native_update({'document_custom_sql': QuerySet(Document).filter(dataset_id=dataset_id)}, sql)
return aggregation_document_status
@@ -190,7 +188,7 @@ class ListenerManagement:
def aggregation_document_status():
sql = get_file_content(
os.path.join(PROJECT_DIR, "apps", "dataset", 'sql', 'update_document_status_meta.sql'))
- native_update({'document_custom_sql': queryset, 'default_sql': queryset}, sql)
+ native_update({'document_custom_sql': queryset}, sql)
return aggregation_document_status
diff --git a/apps/dataset/migrations/0011_document_status_meta_paragraph_status_meta_and_more.py b/apps/dataset/migrations/0011_document_status_meta_paragraph_status_meta_and_more.py
index 02c9addd0..c64a4db20 100644
--- a/apps/dataset/migrations/0011_document_status_meta_paragraph_status_meta_and_more.py
+++ b/apps/dataset/migrations/0011_document_status_meta_paragraph_status_meta_and_more.py
@@ -1,11 +1,23 @@
# Generated by Django 4.2.15 on 2024-11-22 14:44
+from django.db.models import QuerySet
-import dataset.models.data_set
from django.db import migrations, models
+import dataset
+from common.event import ListenerManagement
+from dataset.models import State, TaskType
+
+
+def updateDocumentStatus(apps, schema_editor):
+ ParagraphModel = apps.get_model('dataset', 'Paragraph')
+ DocumentModel = apps.get_model('dataset', 'Document')
+ success_list = QuerySet(DocumentModel).filter(status='2')
+ ListenerManagement.update_status(QuerySet(ParagraphModel).filter(document_id__in=[d.id for d in success_list]),
+ TaskType.EMBEDDING, State.SUCCESS)
+ ListenerManagement.get_aggregation_document_status_by_query_set(QuerySet(DocumentModel))()
+
class Migration(migrations.Migration):
-
dependencies = [
('dataset', '0010_file_meta'),
]
@@ -31,4 +43,5 @@ class Migration(migrations.Migration):
name='status',
field=models.CharField(default=dataset.models.data_set.Status.__str__, max_length=20, verbose_name='状态'),
),
+ migrations.RunPython(updateDocumentStatus)
]
diff --git a/apps/dataset/sql/update_document_status_meta.sql b/apps/dataset/sql/update_document_status_meta.sql
index ced642b83..6065931ff 100644
--- a/apps/dataset/sql/update_document_status_meta.sql
+++ b/apps/dataset/sql/update_document_status_meta.sql
@@ -22,4 +22,4 @@ FROM
GROUP BY
document_id
) tmp
-${default_sql}
\ No newline at end of file
+WHERE "document".id="tmp".document_id
\ No newline at end of file
diff --git a/ui/src/utils/status.ts b/ui/src/utils/status.ts
index abfbd2e4e..16f98599e 100644
--- a/ui/src/utils/status.ts
+++ b/ui/src/utils/status.ts
@@ -65,4 +65,4 @@ class Status {
return r.reverse().join('')
}
}
-export { Status, State, TaskType, TaskTypeInterface, StateInterface }
+export { Status, State, TaskType, type TaskTypeInterface, type StateInterface }
diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue
index 86042a3fa..4777dd106 100644
--- a/ui/src/views/document/index.vue
+++ b/ui/src/views/document/index.vue
@@ -381,7 +381,7 @@ const {
const { common, dataset, document } = useStore()
const storeKey = 'documents'
-const getTaskState = (status, taskType) => {
+const getTaskState = (status: string, taskType: number) => {
const statusList = status.split('').reverse()
return taskType - 1 > statusList.length + 1 ? 'n' : statusList[taskType - 1]
}
From 6a24d2eb8d6ab89f19179e4e84556112f66de1d6 Mon Sep 17 00:00:00 2001
From: wxg0103 <727495428@qq.com>
Date: Tue, 26 Nov 2024 14:07:47 +0800
Subject: [PATCH 5/6] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89=E6=97=A0?=
=?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ui/src/components/ai-chat/KnowledgeSource.vue | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/ui/src/components/ai-chat/KnowledgeSource.vue b/ui/src/components/ai-chat/KnowledgeSource.vue
index 1c5369a3c..cb8bf66db 100644
--- a/ui/src/components/ai-chat/KnowledgeSource.vue
+++ b/ui/src/components/ai-chat/KnowledgeSource.vue
@@ -98,15 +98,6 @@ const uniqueParagraphList = computed(() => {
}) || []
)
})
-function fileType(name: string) {
- const suffix = name.split('.')
- return suffix[suffix.length - 1]
-}
-const typeList: any = {
- txt: ['txt', 'pdf', 'docx', 'csv', 'md', 'html'],
- table: ['xlsx', 'xls', 'csv'],
- QA: ['xlsx', 'csv', 'xls']
-}
function openLink(url: string) {
// 如果url不是以/结尾,加上/
From 6f24a02213f1dff739b6120a9d3de874292ab16d Mon Sep 17 00:00:00 2001
From: CaptainB
Date: Tue, 26 Nov 2024 14:20:56 +0800
Subject: [PATCH 6/6] =?UTF-8?q?refactor:=20=E4=B8=8A=E4=BC=A0=E9=99=84?=
=?UTF-8?q?=E4=BB=B6tooltip=E5=B1=95=E7=A4=BA=E5=A4=A7=E5=86=99=E5=90=8E?=
=?UTF-8?q?=E7=BC=80=E4=BB=A5=E3=80=81=E5=88=86=E5=89=B2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/ai-chat/component/chat-input-operate/index.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 d5d1a7481..60b474a30 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
@@ -89,7 +89,7 @@
props.applicationDetails.file_upload_setting.maxFiles
}}个,每个文件限制
{{ props.applicationDetails.file_upload_setting.fileLimit }}MB
文件类型:{{
- getAcceptList()
+ getAcceptList().replace(/\./g, '').replace(/,/g, '、').toUpperCase()
}}