From 4badd3ab6e551a6dda31ab58ace47074ecb6b0b6 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 21 Nov 2024 11:35:49 +0800 Subject: [PATCH 01/21] =?UTF-8?q?fix(=E7=9F=A5=E8=AF=86=E5=BA=93):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9F=A5=E8=AF=86=E5=BA=93=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=9C=AA=E6=9B=B4=E6=96=B0=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049232 --user=王孝刚 【应用】对话日志-添加到知识库后,文档字符数未同步更新 https://www.tapd.cn/57709429/s/1614059 --- apps/application/serializers/chat_serializers.py | 4 +++- ui/src/components/ai-chat/ExecutionDetailDialog.vue | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/application/serializers/chat_serializers.py b/apps/application/serializers/chat_serializers.py index f3710fe00..f7bb11f24 100644 --- a/apps/application/serializers/chat_serializers.py +++ b/apps/application/serializers/chat_serializers.py @@ -38,7 +38,7 @@ from common.util.field_message import ErrMessage from common.util.file_util import get_file_content from common.util.lock import try_lock, un_lock from dataset.models import Document, Problem, Paragraph, ProblemParagraphMapping -from dataset.serializers.common_serializers import get_embedding_model_id_by_dataset_id +from dataset.serializers.common_serializers import get_embedding_model_id_by_dataset_id, update_document_char_length from dataset.serializers.paragraph_serializers import ParagraphSerializers from embedding.task import embedding_by_paragraph, embedding_by_paragraph_list from setting.models import Model @@ -620,6 +620,7 @@ class ChatRecordSerializer(serializers.Serializer): # 插入关联问题 problem_paragraph_mapping.save() chat_record.improve_paragraph_id_list.append(paragraph.id) + update_document_char_length(document_id) # 添加标注 chat_record.save() return ChatRecordSerializerModel(chat_record).data, paragraph.id, dataset_id @@ -718,5 +719,6 @@ class ChatRecordSerializer(serializers.Serializer): # 批量保存聊天记录 ChatRecord.objects.bulk_update(chat_record_list, ['improve_paragraph_id_list']) + update_document_char_length(document_id) return paragraph_ids, dataset_id diff --git a/ui/src/components/ai-chat/ExecutionDetailDialog.vue b/ui/src/components/ai-chat/ExecutionDetailDialog.vue index dd403b15d..4c71b3232 100644 --- a/ui/src/components/ai-chat/ExecutionDetailDialog.vue +++ b/ui/src/components/ai-chat/ExecutionDetailDialog.vue @@ -175,7 +175,7 @@
- {{ item.type == WorkflowType.Application ? '应用回答' : 'AI 回答' }} + {{ item.type == WorkflowType.Application ? '参数输出' : 'AI 回答' }}
Date: Thu, 21 Nov 2024 12:54:43 +0800 Subject: [PATCH 02/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E8=AF=A6=E6=83=85=E4=B8=AD=E6=B2=A1=E6=9C=89=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=B1=95=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049251 --user=刘瑞斌 【应用编排】上传文件后,执行详情里没显示文件信息 https://www.tapd.cn/57709429/s/1614098 --- .../step_node/start_node/impl/base_start_node.py | 1 + .../ai-chat/component/question-content/index.vue | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/application/flow/step_node/start_node/impl/base_start_node.py b/apps/application/flow/step_node/start_node/impl/base_start_node.py index 6388e4dfd..4f95656d2 100644 --- a/apps/application/flow/step_node/start_node/impl/base_start_node.py +++ b/apps/application/flow/step_node/start_node/impl/base_start_node.py @@ -77,5 +77,6 @@ class BaseStartStepNode(IStarNode): 'status': self.status, 'err_message': self.err_message, 'image_list': self.context.get('image'), + 'document_list': self.context.get('document'), 'global_fields': global_fields } diff --git a/ui/src/components/ai-chat/component/question-content/index.vue b/ui/src/components/ai-chat/component/question-content/index.vue index 031d24706..6c0bd3915 100644 --- a/ui/src/components/ai-chat/component/question-content/index.vue +++ b/ui/src/components/ai-chat/component/question-content/index.vue @@ -81,12 +81,12 @@ const image_list = computed(() => { }) onMounted(() => { - console.log(props.chatRecord.execution_details) - if (props.chatRecord.execution_details?.length > 0) { - props.chatRecord.execution_details[0].image_list?.forEach((image: any) => { - console.log('image', image.name, image.url) - }) - } + // console.log(props.chatRecord.execution_details) + // if (props.chatRecord.execution_details?.length > 0) { + // props.chatRecord.execution_details[0].image_list?.forEach((image: any) => { + // console.log('image', image.name, image.url) + // }) + // } }) From b8670fa27ac91ccbb224a402254f214e0cae5430 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 21 Nov 2024 15:03:08 +0800 Subject: [PATCH 03/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=8F=90=E5=8F=96=E6=96=87=E6=A1=A3=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=9D=A5=E6=BA=90=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049269 --user=刘瑞斌 【应用编排】文档内容提取节点,选择图片变量后保存不生效 https://www.tapd.cn/57709429/s/1614310 --- ui/src/workflow/nodes/document-extract-node/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/workflow/nodes/document-extract-node/index.vue b/ui/src/workflow/nodes/document-extract-node/index.vue index b888f5052..e9fa5e333 100644 --- a/ui/src/workflow/nodes/document-extract-node/index.vue +++ b/ui/src/workflow/nodes/document-extract-node/index.vue @@ -22,7 +22,7 @@ :nodeModel="nodeModel" class="w-full" placeholder="请选择文档" - v-model="form.document_list" + v-model="form_data.document_list" /> From 179666e00f93037820b86fbd0547c387450d6ba4 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 21 Nov 2024 15:55:17 +0800 Subject: [PATCH 04/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A8=A1?= =?UTF-8?q?=E5=9E=8Bcard=E4=B8=8A=E6=B2=A1=E6=98=BE=E7=A4=BA=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=90=86=E8=A7=A3=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049276 --user=刘瑞斌 [系统管理]模型设置-添加的OpenAI图片理解模型后,模型类型显示为空 https://www.tapd.cn/57709429/s/1614428 --- ui/src/enums/model.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/src/enums/model.ts b/ui/src/enums/model.ts index 9219f457e..0605e9186 100644 --- a/ui/src/enums/model.ts +++ b/ui/src/enums/model.ts @@ -12,5 +12,6 @@ export enum modelType { LLM = '大语言模型', STT = '语音识别', TTS = '语音合成', + IMAGE = '图片理解', RERANKER = '重排模型' } From fe1ca9987ac5712533a883c9fa1aa450c5d14729 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 21 Nov 2024 17:13:28 +0800 Subject: [PATCH 05/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=90=86=E8=A7=A3=E7=BB=93=E6=9E=9C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E6=8F=90=E5=8F=96=E5=88=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049298 --user=刘瑞斌 【应用编排】引用图片理解参数输出变量,没有输出内容 https://www.tapd.cn/57709429/s/1614589 --- ui/src/workflow/common/data.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/workflow/common/data.ts b/ui/src/workflow/common/data.ts index 67f1f2723..c509520da 100644 --- a/ui/src/workflow/common/data.ts +++ b/ui/src/workflow/common/data.ts @@ -221,7 +221,7 @@ export const imageUnderstandNode = { fields: [ { label: 'AI 回答内容', - value: 'content' + value: 'answer' } ] } From 044e71ac440213a6e444c8c8337bf728efd2fa93 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 21 Nov 2024 17:28:23 +0800 Subject: [PATCH 06/21] =?UTF-8?q?fix:=20=E6=89=A7=E8=A1=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=A1=A8=E5=8D=95=E6=94=B6=E9=9B=86=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/ai-chat/ExecutionDetailDialog.vue | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui/src/components/ai-chat/ExecutionDetailDialog.vue b/ui/src/components/ai-chat/ExecutionDetailDialog.vue index 4c71b3232..aa6d35b0b 100644 --- a/ui/src/components/ai-chat/ExecutionDetailDialog.vue +++ b/ui/src/components/ai-chat/ExecutionDetailDialog.vue @@ -313,6 +313,19 @@
+ + + + +

提示词:

- {{ item.prompt || '-' }} + {{ item.question || '-' }} From 1b87f98874484cbee618434284b501676e44fb32 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 22 Nov 2024 11:12:49 +0800 Subject: [PATCH 09/21] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=96=87?= =?UTF-8?q?=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/application/index.vue | 2 +- ui/src/views/dataset/index.vue | 2 +- ui/src/views/function-lib/index.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/views/application/index.vue b/ui/src/views/application/index.vue index 643ae8a8b..6f0461071 100644 --- a/ui/src/views/application/index.vue +++ b/ui/src/views/application/index.vue @@ -81,7 +81,7 @@ diff --git a/ui/src/views/dataset/index.vue b/ui/src/views/dataset/index.vue index 9075316b2..5163c95d1 100644 --- a/ui/src/views/dataset/index.vue +++ b/ui/src/views/dataset/index.vue @@ -64,7 +64,7 @@ diff --git a/ui/src/views/function-lib/index.vue b/ui/src/views/function-lib/index.vue index 6ead54f04..0358406d7 100644 --- a/ui/src/views/function-lib/index.vue +++ b/ui/src/views/function-lib/index.vue @@ -69,7 +69,7 @@ From 91633b58b871e76e5c5983011bf41bb582d04048 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 22 Nov 2024 15:16:51 +0800 Subject: [PATCH 10/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8D=95?= =?UTF-8?q?=E6=AC=A1=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049382 --user=刘瑞斌 【应用编排】文件上传,单词上传最多文件数没限制住 https://www.tapd.cn/57709429/s/1615405 --- .../components/ai-chat/component/chat-input-operate/index.vue | 4 +++- 1 file changed, 3 insertions(+), 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 d4524fde2..16e03c0b3 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 @@ -209,7 +209,9 @@ const getAcceptList = () => { const uploadFile = async (file: any, fileList: any) => { const { maxFiles, fileLimit } = props.applicationDetails.file_upload_setting - if (fileList.length > maxFiles) { + // 单次上传文件数量限制 + const file_limit_once = uploadImageList.value.length + uploadDocumentList.value.length + if (file_limit_once >= maxFiles) { MsgWarning('最多上传' + maxFiles + '个文件') return } From cfb8e837fffd8e67cded0a918d1e895801dfb466 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 22 Nov 2024 15:23:11 +0800 Subject: [PATCH 11/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8D=95?= =?UTF-8?q?=E6=AC=A1=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049382 --user=刘瑞斌 【应用编排】文件上传,单词上传最多文件数没限制住 https://www.tapd.cn/57709429/s/1615405 --- ui/src/components/ai-chat/component/chat-input-operate/index.vue | 1 + 1 file changed, 1 insertion(+) 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 16e03c0b3..24aac0c1d 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 @@ -213,6 +213,7 @@ const uploadFile = async (file: any, fileList: any) => { const file_limit_once = uploadImageList.value.length + uploadDocumentList.value.length if (file_limit_once >= maxFiles) { MsgWarning('最多上传' + maxFiles + '个文件') + fileList.splice(0, fileList.length) return } if (fileList.filter((f: any) => f.size > fileLimit * 1024 * 1024).length > 0) { From 1f88ee266daef1c32150a8a25010570e65839dac Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Fri, 22 Nov 2024 16:27:43 +0800 Subject: [PATCH 12/21] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=98=BE=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/assets/icon_file-doc.svg | 5 ++ ui/src/assets/icon_file-image.svg | 6 ++ .../component/chat-input-operate/index.vue | 22 +++++-- ui/src/components/card-checkbox/index.vue | 2 +- .../views/application/ApplicationSetting.vue | 2 + ui/src/views/application/index.vue | 2 +- ui/src/views/dataset/index.vue | 2 +- ui/src/views/function-lib/index.vue | 2 +- ui/src/workflow/nodes/ai-chat-node/index.vue | 2 + .../component/FileUploadSettingDialog.vue | 65 +++++++++++++------ .../workflow/nodes/image-understand/index.vue | 3 +- ui/src/workflow/nodes/question-node/index.vue | 2 + 12 files changed, 85 insertions(+), 30 deletions(-) create mode 100644 ui/src/assets/icon_file-doc.svg create mode 100644 ui/src/assets/icon_file-image.svg diff --git a/ui/src/assets/icon_file-doc.svg b/ui/src/assets/icon_file-doc.svg new file mode 100644 index 000000000..86ac2d3f1 --- /dev/null +++ b/ui/src/assets/icon_file-doc.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/ui/src/assets/icon_file-image.svg b/ui/src/assets/icon_file-image.svg new file mode 100644 index 000000000..4511c36f5 --- /dev/null +++ b/ui/src/assets/icon_file-image.svg @@ -0,0 +1,6 @@ + + + + + + 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 24aac0c1d..bb29ba29f 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 @@ -83,18 +83,29 @@ :accept="getAcceptList()" :on-change="(file: any, fileList: any) => uploadFile(file, fileList)" > - - - + + + + + + - + +
00:{{ recorderTime < 10 ? `0${recorderTime}` : recorderTime }} { z-index: 1; } } +.upload-tooltip-width { + width: 300px; +} diff --git a/ui/src/components/card-checkbox/index.vue b/ui/src/components/card-checkbox/index.vue index e5d7282e3..d8f2176c9 100644 --- a/ui/src/components/card-checkbox/index.vue +++ b/ui/src/components/card-checkbox/index.vue @@ -60,7 +60,7 @@ function checkboxChange() { emit('change') } - \ No newline at end of file + diff --git a/ui/src/workflow/nodes/image-understand/index.vue b/ui/src/workflow/nodes/image-understand/index.vue index 6ca722d29..c3f1184ad 100644 --- a/ui/src/workflow/nodes/image-understand/index.vue +++ b/ui/src/workflow/nodes/image-understand/index.vue @@ -7,7 +7,6 @@ :model="form_data" label-position="top" require-asterisk-position="right" - class="mb-24" label-width="auto" ref="aiChatNodeFormRef" hide-required-asterisk @@ -132,7 +131,7 @@ @@ -359,7 +374,7 @@
本次对话
-

文件:

+

图片:

-

提示词:

{{ item.question || '-' }}
From b931fbd7abedfc4fc04a4d474d7e00e7eeacad6a Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 22 Nov 2024 17:05:18 +0800 Subject: [PATCH 14/21] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/authentication/component/LDAP.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/views/authentication/component/LDAP.vue b/ui/src/views/authentication/component/LDAP.vue index f4c26926b..6eb5f21e1 100644 --- a/ui/src/views/authentication/component/LDAP.vue +++ b/ui/src/views/authentication/component/LDAP.vue @@ -48,12 +48,12 @@ $t('login.ldap.enableAuthentication') }} - - {{ $t('login.ldap.test') }}
+ + {{ $t('login.ldap.test') }} {{ $t('login.ldap.save') }} From a96b0c166aa053ca97cca7a2cbb551aad56281c4 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 22 Nov 2024 17:54:23 +0800 Subject: [PATCH 15/21] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=89=93?= =?UTF-8?q?=E5=8C=85=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/workflow/common/edge.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/workflow/common/edge.ts b/ui/src/workflow/common/edge.ts index cf4fdc154..8093e0ac1 100644 --- a/ui/src/workflow/common/edge.ts +++ b/ui/src/workflow/common/edge.ts @@ -71,7 +71,11 @@ class CustomEdge2 extends BezierEdge { delete style.stroke return h('g', {}, [ - h('style', { type: 'text/css' }, '.lf-edge{stroke:#afafaf}.lf-edge:hover{stroke: #3370FF;}'), + h( + 'style' as any, + { type: 'text/css' }, + '.lf-edge{stroke:#afafaf}.lf-edge:hover{stroke: #3370FF;}' + ), h('path', { d: path, ...style, From 98db08d2638ed8c1bad84a7acc96bda38dffb2c2 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Fri, 22 Nov 2024 17:53:39 +0800 Subject: [PATCH 16/21] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=AF=B9=E8=AF=9D=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/chat-input-operate/index.vue | 2 +- .../component/question-content/index.vue | 49 ++++++++++++++----- ui/src/utils/utils.ts | 11 +++++ 3 files changed, 48 insertions(+), 14 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 bb29ba29f..4ca225bd9 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 @@ -24,7 +24,7 @@
-
+
{{ item && item?.name }}
diff --git a/ui/src/components/ai-chat/component/question-content/index.vue b/ui/src/components/ai-chat/component/question-content/index.vue index 6c0bd3915..28355a6e5 100644 --- a/ui/src/components/ai-chat/component/question-content/index.vue +++ b/ui/src/components/ai-chat/component/question-content/index.vue @@ -18,10 +18,13 @@
- + diff --git a/ui/src/utils/utils.ts b/ui/src/utils/utils.ts index b4a87f38c..066399032 100644 --- a/ui/src/utils/utils.ts +++ b/ui/src/utils/utils.ts @@ -88,3 +88,14 @@ export function getAttrsArray(array: Array, attr: string) { export function getSum(array: Array) { return array.reduce((total, item) => total + item, 0) } + +// 下载 +export function downloadByURL(url: string, name: string) { + const a = document.createElement('a') + a.setAttribute('href', url) + a.setAttribute('target', '_blank') + a.setAttribute('download', name) + document.body.appendChild(a) + a.click() + document.body.removeChild(a) +} From 64e8f4dc9fe34f9f329477e718ec90117e101097 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 22 Nov 2024 17:54:06 +0800 Subject: [PATCH 17/21] =?UTF-8?q?chore:=20=E6=96=87=E6=A1=A3=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=97=A0=E6=B3=95=E6=8F=90=E5=8F=96=E7=9A=84=E6=97=B6?= =?UTF-8?q?=E5=80=99=E8=BE=93=E5=87=BA=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/table/csv_parse_table_handle.py | 2 +- .../impl/table/xls_parse_table_handle.py | 35 ++++++++------ .../impl/table/xlsx_parse_table_handle.py | 46 ++++++++++--------- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/apps/common/handle/impl/table/csv_parse_table_handle.py b/apps/common/handle/impl/table/csv_parse_table_handle.py index c3a85db86..dcd971839 100644 --- a/apps/common/handle/impl/table/csv_parse_table_handle.py +++ b/apps/common/handle/impl/table/csv_parse_table_handle.py @@ -41,4 +41,4 @@ class CsvSplitHandle(BaseParseTableHandle): return buffer.decode(detect(buffer)['encoding']) except BaseException as e: max_kb.error(f'csv split handle error: {e}') - return [{'name': file.name, 'paragraphs': []}] \ No newline at end of file + return f'error: {e}' \ No newline at end of file diff --git a/apps/common/handle/impl/table/xls_parse_table_handle.py b/apps/common/handle/impl/table/xls_parse_table_handle.py index a3ef14443..0fee4e35b 100644 --- a/apps/common/handle/impl/table/xls_parse_table_handle.py +++ b/apps/common/handle/impl/table/xls_parse_table_handle.py @@ -63,21 +63,26 @@ class XlsSplitHandle(BaseParseTableHandle): def get_content(self, file): # 打开 .xls 文件 - workbook = xlrd.open_workbook(file_contents=file.read(), formatting_info=True) - sheets = workbook.sheets() - md_tables = '' - for sheet in sheets: + try: + workbook = xlrd.open_workbook(file_contents=file.read(), formatting_info=True) + sheets = workbook.sheets() + md_tables = '' + for sheet in sheets: - # 获取表头和内容 - headers = sheet.row_values(0) - data = [sheet.row_values(row_idx) for row_idx in range(1, sheet.nrows)] + # 获取表头和内容 + headers = sheet.row_values(0) + data = [sheet.row_values(row_idx) for row_idx in range(1, sheet.nrows)] - # 构建 Markdown 表格 - md_table = '| ' + ' | '.join(headers) + ' |\n' - md_table += '| ' + ' | '.join(['---'] * len(headers)) + ' |\n' - for row in data: - # 将每个单元格中的内容替换换行符为
以保留原始格式 - md_table += '| ' + ' | '.join([str(cell).replace('\n', '
') if cell else '' for cell in row]) + ' |\n' - md_tables += md_table + '\n\n' + # 构建 Markdown 表格 + md_table = '| ' + ' | '.join(headers) + ' |\n' + md_table += '| ' + ' | '.join(['---'] * len(headers)) + ' |\n' + for row in data: + # 将每个单元格中的内容替换换行符为
以保留原始格式 + md_table += '| ' + ' | '.join( + [str(cell).replace('\n', '
') if cell else '' for cell in row]) + ' |\n' + md_tables += md_table + '\n\n' - return md_tables + return md_tables + except Exception as e: + max_kb.error(f'excel split handle error: {e}') + return f'error: {e}' diff --git a/apps/common/handle/impl/table/xlsx_parse_table_handle.py b/apps/common/handle/impl/table/xlsx_parse_table_handle.py index e92d3c11a..3fd40b2d1 100644 --- a/apps/common/handle/impl/table/xlsx_parse_table_handle.py +++ b/apps/common/handle/impl/table/xlsx_parse_table_handle.py @@ -75,28 +75,32 @@ class XlsxSplitHandle(BaseParseTableHandle): def get_content(self, file): - # 加载 Excel 文件 - workbook = load_workbook(file) - md_tables = '' - # 如果未指定 sheet_name,则使用第一个工作表 - for sheetname in workbook.sheetnames: - sheet = workbook[sheetname] if sheetname else workbook.active + try: + # 加载 Excel 文件 + workbook = load_workbook(file) + md_tables = '' + # 如果未指定 sheet_name,则使用第一个工作表 + for sheetname in workbook.sheetnames: + sheet = workbook[sheetname] if sheetname else workbook.active - # 获取工作表的所有行 - rows = list(sheet.iter_rows(values_only=True)) - if not rows: - continue + # 获取工作表的所有行 + rows = list(sheet.iter_rows(values_only=True)) + if not rows: + continue - # 提取表头和内容 - headers = rows[0] - data = rows[1:] + # 提取表头和内容 + headers = rows[0] + data = rows[1:] - # 构建 Markdown 表格 - md_table = '| ' + ' | '.join(headers) + ' |\n' - md_table += '| ' + ' | '.join(['---'] * len(headers)) + ' |\n' - for row in data: - md_table += '| ' + ' | '.join( - [str(cell).replace('\n', '
') if cell is not None else '' for cell in row]) + ' |\n' + # 构建 Markdown 表格 + md_table = '| ' + ' | '.join(headers) + ' |\n' + md_table += '| ' + ' | '.join(['---'] * len(headers)) + ' |\n' + for row in data: + md_table += '| ' + ' | '.join( + [str(cell).replace('\n', '
') if cell is not None else '' for cell in row]) + ' |\n' - md_tables += md_table + '\n\n' - return md_tables \ No newline at end of file + md_tables += md_table + '\n\n' + return md_tables + except Exception as e: + max_kb.error(f'excel split handle error: {e}') + return f'error: {e}' From 8133821e1937dca44ec195f3cbb448a58ee974c8 Mon Sep 17 00:00:00 2001 From: Qiyuan Jiao Date: Fri, 22 Nov 2024 22:03:46 +0800 Subject: [PATCH 18/21] =?UTF-8?q?style:=20=E8=AE=BE=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E8=87=AA=E5=8A=A8=E6=8D=A2=E8=A1=8C=20(#1673)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/dataset/component/SetRules.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/dataset/component/SetRules.vue b/ui/src/views/dataset/component/SetRules.vue index 593ac67ce..066549618 100644 --- a/ui/src/views/dataset/component/SetRules.vue +++ b/ui/src/views/dataset/component/SetRules.vue @@ -82,7 +82,7 @@
- + 导入时添加分段标题为关联问题(适用于标题为问题的问答对)
From ebfadf2b6cf985839a4b08764a457bcb49cb8e50 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 25 Nov 2024 10:21:57 +0800 Subject: [PATCH 19/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E9=A1=B5=E9=9D=A2pdf=E4=B8=8D=E8=83=BD=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E4=B8=8A=E4=BC=A0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1049431 --user=刘瑞斌 【应用编排】应用对话,上传文档无法选择pdf文档 https://www.tapd.cn/57709429/s/1616013 --- .../ai-chat/component/chat-input-operate/index.vue | 13 +++++++------ 1 file changed, 7 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 4ca225bd9..d5d1a7481 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 @@ -202,20 +202,21 @@ const audioExtensions = ['mp3', 'wav', 'aac', 'flac'] const getAcceptList = () => { const { image, document, audio, video } = props.applicationDetails.file_upload_setting - let accepts = '' + let accepts: any = [] if (image) { - accepts += imageExtensions.map((ext) => '.' + ext).join(',') + accepts = [...imageExtensions] } if (document) { - accepts += documentExtensions.map((ext) => '.' + ext).join(',') + accepts = [...accepts, ...documentExtensions] } if (audio) { - accepts += audioExtensions.map((ext) => '.' + ext).join(',') + accepts = [...accepts, ...audioExtensions] } if (video) { - accepts += videoExtensions.map((ext) => '.' + ext).join(',') + accepts = [...accepts, ...videoExtensions] } - return accepts + // console.log(accepts) + return accepts.map((ext: any) => '.' + ext).join(',') } const uploadFile = async (file: any, fileList: any) => { From 639e1d7b6d47b8a33f51231a6d7f966ccc06b7a3 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 25 Nov 2024 11:30:46 +0800 Subject: [PATCH 20/21] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E8=AF=A6=E6=83=85=E6=97=B6=E6=B2=A1=E6=9C=89=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E5=9B=BE=E7=89=87=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E8=AF=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/ai-chat/ExecutionDetailDialog.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/src/components/ai-chat/ExecutionDetailDialog.vue b/ui/src/components/ai-chat/ExecutionDetailDialog.vue index 1667d6439..2b8de6545 100644 --- a/ui/src/components/ai-chat/ExecutionDetailDialog.vue +++ b/ui/src/components/ai-chat/ExecutionDetailDialog.vue @@ -386,6 +386,9 @@ /> +
+
+

提示词:

{{ item.question || '-' }}
From ce7b1d941b668b590d8e4ae73a2e45c72a06848e Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 25 Nov 2024 11:37:21 +0800 Subject: [PATCH 21/21] =?UTF-8?q?refactor:=20=E5=A4=9A=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E5=88=86=E5=89=B2=E7=BA=BF=E5=B1=95=E7=A4=BA=E4=B8=BA=E5=A4=9A?= =?UTF-8?q?=E4=B8=AA=E2=80=98-=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/base_document_extract_node.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py index 2663af097..f450a1dd0 100644 --- a/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py +++ b/apps/application/flow/step_node/document_extract_node/impl/base_document_extract_node.py @@ -14,8 +14,8 @@ class BaseDocumentExtractNode(IDocumentExtractNode): get_buffer = FileBufferHandle().get_buffer self.context['document_list'] = document - content = '' - splitter = '\n-----------------------------------\n' + content = [] + splitter = '\n`-----------------------------------`\n' if document is None: return NodeResult({'content': content}, {}) @@ -29,10 +29,10 @@ class BaseDocumentExtractNode(IDocumentExtractNode): # 回到文件头 buffer.seek(0) file_content = split_handle.get_content(buffer) - content += splitter + '## ' + doc['name'] + '\n' + file_content + content.append( '## ' + doc['name'] + '\n' + file_content) break - return NodeResult({'content': content}, {}) + return NodeResult({'content': splitter.join(content)}, {}) def get_details(self, index: int, **kwargs): return {