From 44523da4186956620bd3cc062709a8b06f00b835 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 29 Mar 2024 14:28:57 +0800 Subject: [PATCH 01/17] =?UTF-8?q?fix:=20Ollama=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9C=AA=E4=B8=8B=E8=BD=BD=E7=9A=84=E6=A8=A1=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E8=BF=9B=E5=BA=A6=E4=BC=9A=E7=94=B1=20100-0-?= =?UTF-8?q?100?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ollama_model_provider/ollama_model_provider.py | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py b/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py index 3436fdb0e0..2d8097a700 100644 --- a/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py +++ b/apps/setting/models_provider/impl/ollama_model_provider/ollama_model_provider.py @@ -94,6 +94,7 @@ def convert_to_down_model_chunk(row_str: str, chunk_index: int): if row.get('status') == 'success': status = DownModelChunkStatus.success if row.get('status').__contains__("pulling"): + progress = 0 status = DownModelChunkStatus.pulling if 'total' in row and 'completed' in row: progress = (row.get('completed') / row.get('total') * 100) From c893cd17ff06b1a3e4f5a228ca5450482d775bd2 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 29 Mar 2024 14:29:15 +0800 Subject: [PATCH 02/17] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=97=AE=E9=A2=98=E4=B8=BA=E7=A9=BA=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B,=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=8E=9F=E5=A7=8B=E9=97=AE=E9=A2=98=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E9=97=AE=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../step/reset_problem_step/impl/base_reset_problem_step.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py b/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py index fffdf46629..2386be4fe2 100644 --- a/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py +++ b/apps/application/chat_pipeline/step/reset_problem_step/impl/base_reset_problem_step.py @@ -31,7 +31,10 @@ def execute(self, problem_text: str, history_chat_record: List[ChatRecord] = Non response = chat_model.invoke(message_list) padding_problem = problem_text if response.content.__contains__("") and response.content.__contains__(''): - padding_problem = response.content[response.content.index('') + 6:response.content.index('')] + padding_problem_data = response.content[ + response.content.index('') + 6:response.content.index('')] + if padding_problem_data is not None and len(padding_problem_data.strip()) > 0: + padding_problem = padding_problem_data self.context['message_tokens'] = chat_model.get_num_tokens_from_messages(message_list) self.context['answer_tokens'] = chat_model.get_num_tokens(padding_problem) return padding_problem From 8f4fb8176733a1c107e66b976c31ffa43f5ccf47 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 29 Mar 2024 14:38:11 +0800 Subject: [PATCH 03/17] =?UTF-8?q?fix:=20=E5=88=9B=E5=BB=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=20=E7=99=BB=E5=BD=95=E5=AF=86=E7=A0=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=BB=98=E8=AE=A4=E5=AF=86=E7=A0=81MaxKB@123..=20?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=A7=84=E5=88=99=E4=B8=8D=E5=AF=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/serializers/user_serializers.py | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/users/serializers/user_serializers.py b/apps/users/serializers/user_serializers.py index 7a1aa3da18..6672a4cb54 100644 --- a/apps/users/serializers/user_serializers.py +++ b/apps/users/serializers/user_serializers.py @@ -133,15 +133,15 @@ class RegisterSerializer(ApiMixin, serializers.Serializer): ]) password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"), validators=[validators.RegexValidator(regex=re.compile( - "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" - "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~()-+=]{6,20}$") + "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~.()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" + "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~.()-+=]{6,20}$") , message="密码长度6-20个字符,必须字母、数字、特殊字符组合")]) re_password = serializers.CharField(required=True, error_messages=ErrMessage.char("确认密码"), validators=[validators.RegexValidator(regex=re.compile( - "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" - "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~()-+=]{6,20}$") + "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~.()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" + "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~.()-+=]{6,20}$") , message="确认密码长度6-20个字符,必须字母、数字、特殊字符组合")]) code = serializers.CharField(required=True, error_messages=ErrMessage.char("验证码")) @@ -263,14 +263,14 @@ class RePasswordSerializer(ApiMixin, serializers.Serializer): password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"), validators=[validators.RegexValidator(regex=re.compile( - "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" - "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~()-+=]{6,20}$") + "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~.()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" + "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~.()-+=]{6,20}$") , message="确认密码长度6-20个字符,必须字母、数字、特殊字符组合")]) re_password = serializers.CharField(required=True, error_messages=ErrMessage.char("确认密码"), validators=[validators.RegexValidator(regex=re.compile( - "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" - "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~()-+=]{6,20}$") + "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~.()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" + "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~.()-+=]{6,20}$") , message="确认密码长度6-20个字符,必须字母、数字、特殊字符组合")] ) @@ -586,8 +586,8 @@ class UserInstance(ApiMixin, serializers.Serializer): ]) password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"), validators=[validators.RegexValidator(regex=re.compile( - "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" - "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~()-+=]{6,20}$") + "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~.()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" + "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~.()-+=]{6,20}$") , message="密码长度6-20个字符,必须字母、数字、特殊字符组合")]) nick_name = serializers.CharField(required=False, error_messages=ErrMessage.char("姓名"), max_length=64, @@ -653,13 +653,13 @@ def get_request_body_api(): class RePasswordInstance(ApiMixin, serializers.Serializer): password = serializers.CharField(required=True, error_messages=ErrMessage.char("密码"), validators=[validators.RegexValidator(regex=re.compile( - "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" - "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~()-+=]{6,20}$") + "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~.()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" + "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~.()-+=]{6,20}$") , message="密码长度6-20个字符,必须字母、数字、特殊字符组合")]) re_password = serializers.CharField(required=True, error_messages=ErrMessage.char("确认密码"), validators=[validators.RegexValidator(regex=re.compile( - "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" - "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~()-+=]{6,20}$") + "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z_!@#$%^&*`~.()-+=]+$)(?![a-z0-9]+$)(?![a-z_!@#$%^&*`~()-+=]+$)" + "(?![0-9_!@#$%^&*`~()-+=]+$)[a-zA-Z0-9_!@#$%^&*`~.()-+=]{6,20}$") , message="确认密码长度6-20个字符,必须字母、数字、特殊字符组合")] ) From 68f6d834beab0f40f2311340f56ca152b481b7e0 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 29 Mar 2024 14:45:27 +0800 Subject: [PATCH 04/17] =?UTF-8?q?fix:=20=E3=80=90=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E3=80=91=E4=BB=8E=E5=BA=94=E7=94=A8=E4=B8=AD=E7=9A=84=E3=80=90?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=97=A5=E5=BF=97=E3=80=91=E5=A4=84=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=86=85=E5=AE=B9=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/application/serializers/chat_serializers.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/application/serializers/chat_serializers.py b/apps/application/serializers/chat_serializers.py index d48e4c899a..0d7f4a1032 100644 --- a/apps/application/serializers/chat_serializers.py +++ b/apps/application/serializers/chat_serializers.py @@ -32,7 +32,7 @@ from common.util.file_util import get_file_content from common.util.lock import try_lock, un_lock from common.util.rsa_util import decrypt -from dataset.models import Document, Problem, Paragraph +from dataset.models import Document, Problem, Paragraph, ProblemParagraphMapping from dataset.serializers.paragraph_serializers import ParagraphSerializers from setting.models import Model from setting.models_provider.constants.model_provider_constants import ModelProvideConstants @@ -405,12 +405,17 @@ def improve(self, instance: Dict, with_valid=True): dataset_id=dataset_id, title=instance.get("title") if 'title' in instance else '') - problem = Problem(id=uuid.uuid1(), content=chat_record.problem_text, paragraph_id=paragraph.id, - document_id=document_id, dataset_id=dataset_id) + problem = Problem(id=uuid.uuid1(), content=chat_record.problem_text, dataset_id=dataset_id) + problem_paragraph_mapping = ProblemParagraphMapping(id=uuid.uuid1(), dataset_id=dataset_id, + document_id=document_id, + problem_id=problem.id, + paragraph_id=paragraph.id) # 插入问题 problem.save() # 插入段落 paragraph.save() + # 插入关联问题 + problem_paragraph_mapping.save() chat_record.improve_paragraph_id_list.append(paragraph.id) # 添加标注 chat_record.save() From c6f28a8c1bcc33dcc45f1d5c5558269745a772cb Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Fri, 29 Mar 2024 16:01:02 +0800 Subject: [PATCH 05/17] =?UTF-8?q?fix:=20=E5=88=B7=E6=96=B0=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E9=93=BE=E6=8E=A5=E5=A2=9E=E5=8A=A0=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/applicaiton-overview/index.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ui/src/views/applicaiton-overview/index.vue b/ui/src/views/applicaiton-overview/index.vue index 9e000a8574..6b0d825611 100644 --- a/ui/src/views/applicaiton-overview/index.vue +++ b/ui/src/views/applicaiton-overview/index.vue @@ -196,11 +196,21 @@ function getAppStatistics() { } function refreshAccessToken() { - const obj = { - access_token_reset: true - } - const str = '刷新成功' - updateAccessToken(obj, str) + MsgConfirm( + `是否重新生成公共访问链接?`, + `重新生成公共访问链接会影响嵌入第三方脚本变更,需要将新脚本重新嵌入第三方,请谨慎操作!`, + { + confirmButtonText: '确认' + } + ) + .then(() => { + const obj = { + access_token_reset: true + } + const str = '刷新成功' + updateAccessToken(obj, str) + }) + .catch(() => {}) } function changeState(bool: Boolean) { const obj = { From 1d3f6fb178544627faabe384fe8dc3b59a273d90 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 29 Mar 2024 17:39:52 +0800 Subject: [PATCH 06/17] =?UTF-8?q?fix:=20=E3=80=90=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E3=80=91=E6=B5=AE=E7=AA=97=E6=A8=A1=E5=BC=8F=E7=9A=84=20?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E6=8C=89=E9=92=AE=E4=B8=8E=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=9C=AA=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/application/template/embed.js | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/apps/application/template/embed.js b/apps/application/template/embed.js index bef116318e..047f94b906 100644 --- a/apps/application/template/embed.js +++ b/apps/application/template/embed.js @@ -50,14 +50,15 @@ const chatButtonHtml= const getChatContainerHtml=(protocol,host,token)=>{ return `
-
+
-
` +
+` } /** * 初始化引导 @@ -247,22 +248,24 @@ function initMaxkbStyle(root){ box-shadow: 0px 4px 8px 0px rgba(31, 35, 41, 0.10); position: fixed;bottom: 20px;right: 45px;overflow: hidden; } - #maxkb #maxkb-chat-container .maxkb-chat-close{ - position: absolute; - top: 15px; - right: 10px; + + #maxkb #maxkb-chat-container .maxkb-operate{ + top: 15px; + right: 10px; + position: absolute; + display: flex; + align-items: center; + } + #maxkb #maxkb-chat-container .maxkb-operate .maxkb-chat-close{ + margin-left:15px; cursor: pointer; } - #maxkb #maxkb-chat-container .maxkb-openviewport{ - position: absolute; - top: 15px; - right: 50px; + #maxkb #maxkb-chat-container .maxkb-operate .maxkb-openviewport{ + cursor: pointer; } - #maxkb #maxkb-chat-container .maxkb-closeviewport{ - position: absolute; - top: 15px; - right: 50px; + #maxkb #maxkb-chat-container .maxkb-operate .maxkb-closeviewport{ + cursor: pointer; } #maxkb #maxkb-chat-container .maxkb-viewportnone{ From 8afece91f0f0bed39350f1aac4a33402ec61936d Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Fri, 29 Mar 2024 17:46:01 +0800 Subject: [PATCH 07/17] =?UTF-8?q?fix:=20merge=E6=97=B6=E8=A2=AB=E8=AF=AF?= =?UTF-8?q?=E5=88=A0=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/template/component/ModelCard.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/views/template/component/ModelCard.vue b/ui/src/views/template/component/ModelCard.vue index 07c5312edf..184fbcbe4d 100644 --- a/ui/src/views/template/component/ModelCard.vue +++ b/ui/src/views/template/component/ModelCard.vue @@ -150,7 +150,10 @@ const initInterval = () => { downModel.value = ok.data }) } else { - downModel.value = undefined + if (downModel.value) { + props.updateModelById(props.model.id, downModel.value) + downModel.value = undefined + } } }, 6000) } From e4ed28cb1a9ddd4ab2dffd10179c04c87892216a Mon Sep 17 00:00:00 2001 From: zhangshaohu Date: Fri, 29 Mar 2024 18:14:29 +0800 Subject: [PATCH 08/17] =?UTF-8?q?fix:=20mac=E7=94=B5=E8=84=91=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=B3=95=E7=8A=B6=E6=80=81=E4=B8=8B=E6=8C=89=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=E4=BC=9A=E5=8F=91=E9=80=81=E5=AF=B9=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/ai-chat/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index e126adcc65..1330f48147 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -285,7 +285,7 @@ function sendChatHandle(event: any) { if (!event.ctrlKey) { // 如果没有按下组合键ctrl,则会阻止默认事件 event.preventDefault() - if (!isDisabledChart.value && !loading.value) { + if (!isDisabledChart.value && !loading.value&&!event.isComposing) { chatMessage() } } else { From 89a1f3a74b45517849b61395eb0101fa061b0e20 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Mon, 1 Apr 2024 10:41:08 +0800 Subject: [PATCH 09/17] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/views/dataset/component/UploadComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/views/dataset/component/UploadComponent.vue b/ui/src/views/dataset/component/UploadComponent.vue index d4d3fc4ac8..93ce9d1086 100644 --- a/ui/src/views/dataset/component/UploadComponent.vue +++ b/ui/src/views/dataset/component/UploadComponent.vue @@ -27,7 +27,7 @@ 选择文件上传

-

支持格式:TXT、Markdown,每次最多上传50个文件,每个文件不超过 10MB

+

支持格式:TXT、Markdown、PDF、DOC、DOCX,每次最多上传50个文件,每个文件不超过 10MB

若使用【高级分段】建议上传前规范文件的分段标识

From e7ada00c923a48e34c1991d9490a9ebae5cc7a59 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 1 Apr 2024 12:06:43 +0800 Subject: [PATCH 10/17] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96word=E5=88=86?= =?UTF-8?q?=E6=AE=B5=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/handle/impl/doc_split_handle.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/common/handle/impl/doc_split_handle.py b/apps/common/handle/impl/doc_split_handle.py index 50addb32cd..d3d5ee6c7a 100644 --- a/apps/common/handle/impl/doc_split_handle.py +++ b/apps/common/handle/impl/doc_split_handle.py @@ -22,11 +22,25 @@ class DocSplitHandle(BaseSplitHandle): + @staticmethod + def paragraph_to_md(paragraph): + psn = paragraph.style.name + if psn.startswith('Heading'): + try: + return "".join(["#" for i in range(int(psn.replace("Heading ", '')))]) + " " + paragraph.text + except Exception as e: + return paragraph.text + return paragraph.text + + def to_md(self, doc): + ps = doc.paragraphs + return "\n".join([self.paragraph_to_md(para) for para in ps]) + def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer): try: buffer = get_buffer(file) doc = Document(io.BytesIO(buffer)) - content = "\n".join([para.text for para in doc.paragraphs]) + content = self.to_md(doc) if pattern_list is not None and len(pattern_list) > 0: split_model = SplitModel(pattern_list, with_filter, limit) else: From a261f3db9fe344097d225283cca83e30bb05db38 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 1 Apr 2024 14:31:46 +0800 Subject: [PATCH 11/17] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/util/split_model.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/common/util/split_model.py b/apps/common/util/split_model.py index 00184f3c18..60ddaac2f5 100644 --- a/apps/common/util/split_model.py +++ b/apps/common/util/split_model.py @@ -351,9 +351,15 @@ def sub_title(paragraph: Dict): @staticmethod def filter_title_special_characters(paragraph: Dict): - return {**paragraph, 'title': paragraph.get('title').replace("#", '') if 'title' in paragraph else ''} + title = paragraph.get('title') if 'title' in paragraph else '' + for title_special_characters in title_special_characters_list: + title = title.replace(title_special_characters, '') + return {**paragraph, + 'title': title} +title_special_characters_list = ['#', '\n', '\r', '\\s'] + default_split_pattern = { 'md': [re.compile('(?<=^)# .*|(?<=\\n)# .*'), re.compile('(? Date: Mon, 1 Apr 2024 14:35:34 +0800 Subject: [PATCH 12/17] =?UTF-8?q?fix:=20=E5=AF=B9=E8=AF=9D=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/api/application.ts | 10 ++++------ ui/src/components/ai-chat/index.vue | 12 ++++++++---- ui/src/views/applicaiton-overview/index.vue | 4 ++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ui/src/api/application.ts b/ui/src/api/application.ts index 1a3631d366..7cc99fabca 100644 --- a/ui/src/api/application.ts +++ b/ui/src/api/application.ts @@ -166,14 +166,12 @@ const getChatOpen: (applicaiton_id: String) => Promise> = (applicait } /** * 对话 - * @param 参数 + * @param 参数 * chat_id: string - * { - "message": "string", - } + * data */ -const postChatMessage: (chat_id: string, message: string) => Promise = (chat_id, message) => { - return postStream(`/api${prefix}/chat_message/${chat_id}`, { message }) +const postChatMessage: (chat_id: string, data: any) => Promise = (chat_id, message) => { + return postStream(`/api${prefix}/chat_message/${chat_id}`, data) } /** diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index 1330f48147..2d3d4d7530 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -285,7 +285,7 @@ function sendChatHandle(event: any) { if (!event.ctrlKey) { // 如果没有按下组合键ctrl,则会阻止默认事件 event.preventDefault() - if (!isDisabledChart.value && !loading.value&&!event.isComposing) { + if (!isDisabledChart.value && !loading.value && !event.isComposing) { chatMessage() } } else { @@ -418,7 +418,7 @@ const errorWrite = (chat: any, message?: string) => { ChatManagement.append(chat.id, message || '抱歉,当前正在维护,无法提供服务,请稍后再试!') ChatManagement.close(chat.id) } -function chatMessage(chat?: any, problem?: string) { +function chatMessage(chat?: any, problem?: string, re_chat?: boolean) { loading.value = true if (!chat) { chat = reactive({ @@ -443,9 +443,13 @@ function chatMessage(chat?: any, problem?: string) { errorWrite(chat) }) } else { + const obj = { + message: chat.problem_text, + re_chat: re_chat || false + } // 对话 applicationApi - .postChatMessage(chartOpenId.value, chat.problem_text) + .postChatMessage(chartOpenId.value, obj) .then((response) => { if (response.status === 401) { application @@ -491,7 +495,7 @@ function chatMessage(chat?: any, problem?: string) { function regenerationChart(item: chatType) { inputValue.value = item.problem_text - chatMessage() + chatMessage(null, '', true) } function getSourceDetail(row: any) { diff --git a/ui/src/views/applicaiton-overview/index.vue b/ui/src/views/applicaiton-overview/index.vue index 6b0d825611..d981e50630 100644 --- a/ui/src/views/applicaiton-overview/index.vue +++ b/ui/src/views/applicaiton-overview/index.vue @@ -197,8 +197,8 @@ function getAppStatistics() { function refreshAccessToken() { MsgConfirm( - `是否重新生成公共访问链接?`, - `重新生成公共访问链接会影响嵌入第三方脚本变更,需要将新脚本重新嵌入第三方,请谨慎操作!`, + `是否重新生成公开访问链接?`, + `重新生成公开访问链接会影响嵌入第三方脚本变更,需要将新脚本重新嵌入第三方,请谨慎操作!`, { confirmButtonText: '确认' } From c985cc32e77e5ac844fe64edd7633af7a151cfa8 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Mon, 1 Apr 2024 15:48:10 +0800 Subject: [PATCH 13/17] =?UTF-8?q?fix:=20=E6=95=B0=E5=AD=97=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app-charts/components/LineCharts.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ui/src/components/app-charts/components/LineCharts.vue b/ui/src/components/app-charts/components/LineCharts.vue index 5c236e2cbb..1f37db54e9 100644 --- a/ui/src/components/app-charts/components/LineCharts.vue +++ b/ui/src/components/app-charts/components/LineCharts.vue @@ -4,6 +4,7 @@