Quellcode durchsuchen

fix: 修复SSO回调、样本中心对话框和用户序列化器的小问题

mengboxin137-blip vor 5 Tagen
Ursprung
Commit
de315d8256

+ 7 - 11
apps/users/serializers/user.py

@@ -160,9 +160,7 @@ class UserManageSerializer(serializers.Serializer):
             validators=[
                 validators.RegexValidator(
                     regex=PASSWORD_REGEX,
-                    message=_(
-                        "The password must be 6-20 characters long and must be a combination of letters, numbers, and special characters."
-                    )
+                    message=_("密码必须为6-20个字符,且必须包含字母、数字和特殊字符。")
                 )
             ]
         )
@@ -404,9 +402,7 @@ class UserManageSerializer(serializers.Serializer):
             validators=[
                 validators.RegexValidator(
                     regex=PASSWORD_REGEX,
-                    message=_(
-                        "The password must be 6-20 characters long and must be a combination of letters, numbers, and special characters."
-                    )
+                    message=_("密码必须为6-20个字符,且必须包含字母、数字和特殊字符。")
                 )
             ]
         )
@@ -417,7 +413,7 @@ class UserManageSerializer(serializers.Serializer):
                 validators.RegexValidator(
                     regex=PASSWORD_REGEX,
                     message=_(
-                        "The confirmation password must be 6-20 characters long and must be a combination of letters, numbers, and special characters."
+                        "确认密码必须为6-20个字符,且必须包含字母、数字和特殊字符。"
                     )
                 )
             ]
@@ -937,7 +933,7 @@ class RePasswordSerializer(serializers.Serializer):
             validators.RegexValidator(
                 regex=PASSWORD_REGEX,
                 message=_(
-                    "The password must be 6-20 characters long and must be a combination of letters, numbers, and special characters."
+                    "密码必须为6-20个字符,且必须包含字母、数字和特殊字符。"
                 )
             )
         ]
@@ -949,7 +945,7 @@ class RePasswordSerializer(serializers.Serializer):
             validators.RegexValidator(
                 regex=PASSWORD_REGEX,
                 message=_(
-                    "The confirmation password must be 6-20 characters long and must be a combination of letters, numbers, and special characters."
+                    "确认密码必须为6-20个字符,且必须包含字母、数字和特殊字符。"
                 )
             )
         ]
@@ -995,7 +991,7 @@ class ResetCurrentUserPassword(serializers.Serializer):
             validators.RegexValidator(
                 regex=PASSWORD_REGEX,
                 message=_(
-                    "The password must be 6-20 characters long and must be a combination of letters, numbers, and special characters."
+                    "密码必须为6-20个字符,且必须包含字母、数字和特殊字符。"
                 )
             )
         ]
@@ -1007,7 +1003,7 @@ class ResetCurrentUserPassword(serializers.Serializer):
             validators.RegexValidator(
                 regex=PASSWORD_REGEX,
                 message=_(
-                    "The confirmation password must be 6-20 characters long and must be a combination of letters, numbers, and special characters."
+                    "确认密码必须为6-20个字符,且必须包含字母、数字和特殊字符。"
                 )
             )
         ]

+ 2 - 0
ui/src/api/knowledge/sample-center.ts

@@ -34,6 +34,8 @@ export interface ImportTask {
     succeeded: number
     failed: number
   }
+  error?: string
+  failures?: Array<{ index: number; error: string }>
   created_at?: string
   completed_at?: string
 }

+ 8 - 0
ui/src/views/document/component/SyncToSampleCenterDialog.vue

@@ -178,6 +178,14 @@ const submitSync = async () => {
   try {
     const documentIds = documents.value.map((doc) => doc.id)
     const workspaceId = user.getWorkspaceId()
+    if (!workspaceId) {
+      ElMessage.error('工作空间ID不能为空')
+      return
+    }
+    if (!knowledgeId.value) {
+      ElMessage.error('知识库ID不能为空')
+      return
+    }
 
     const res = await syncDocumentsToSampleCenter(
       workspaceId,

+ 3 - 3
ui/src/views/knowledge/create-component/CreateSampleCenterKnowledgeDialog.vue

@@ -77,8 +77,8 @@
             placeholder="请选择向量模型"
             :options="modelOptions"
             @submit-model="loadEmbeddingModels"
-            :model-type="'EMBEDDING'"
-            showFooter
+            :model-type="'EMBEDDING' as any"
+            :showFooter="true as any"
           ></ModelSelect>
         </el-form-item>
       </el-form>
@@ -185,7 +185,7 @@ const loadEmbeddingModels = () => {
   loadSharedApi({ type: 'model', systemType: 'workspace' })
     .getSelectModelList({ model_type: 'EMBEDDING' })
     .then((res: any) => {
-      modelOptions.value = groupBy(res?.data, 'provider')
+      modelOptions.value = Object.values(groupBy(res?.data, 'provider')) as any[]
     })
 }
 

+ 1 - 1
ui/src/views/sso/SSOCallback.vue

@@ -37,7 +37,7 @@ onMounted(async () => {
   try {
     const res = await exchangeSSOCode(code)
 
-    const data = res.data?.data || res.data
+    const data = res.data
     if (data?.token) {
       // 保存 Token(与 login store 使用相同的 key)
       localStorage.setItem('token', data.token)