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 fffdf4662..2386be4fe 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 @@ class BaseResetProblemStep(IResetProblemStep):
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
diff --git a/apps/application/serializers/chat_serializers.py b/apps/application/serializers/chat_serializers.py
index d48e4c899..0d7f4a103 100644
--- a/apps/application/serializers/chat_serializers.py
+++ b/apps/application/serializers/chat_serializers.py
@@ -32,7 +32,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 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 @@ class ChatRecordSerializer(serializers.Serializer):
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()
diff --git a/apps/application/template/embed.js b/apps/application/template/embed.js
index bef116318..047f94b90 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{
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 3436fdb0e..2d8097a70 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)
diff --git a/apps/users/serializers/user_serializers.py b/apps/users/serializers/user_serializers.py
index 7a1aa3da1..6672a4cb5 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 UserManageSerializer(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 @@ class UserManageSerializer(serializers.Serializer):
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个字符,必须字母、数字、特殊字符组合")]
)
diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue
index e126adcc6..1330f4814 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 {
diff --git a/ui/src/views/applicaiton-overview/index.vue b/ui/src/views/applicaiton-overview/index.vue
index 9e000a857..6b0d82561 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 = {
diff --git a/ui/src/views/template/component/ModelCard.vue b/ui/src/views/template/component/ModelCard.vue
index 07c5312ed..184fbcbe4 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)
}