Selaa lähdekoodia

Merge branch 'main' into feat/plugin

Yeuoly 10 kuukautta sitten
vanhempi
commit
db8bf2a85e

+ 5 - 2
api/commands.py

@@ -559,8 +559,9 @@ def add_qdrant_doc_id_index(field: str):
 
 @click.command("create-tenant", help="Create account and tenant.")
 @click.option("--email", prompt=True, help="The email address of the tenant account.")
+@click.option("--name", prompt=True, help="The workspace name of the tenant account.")
 @click.option("--language", prompt=True, help="Account language, default: en-US.")
-def create_tenant(email: str, language: Optional[str] = None):
+def create_tenant(email: str, language: Optional[str] = None, name: Optional[str] = None):
     """
     Create tenant account
     """
@@ -580,13 +581,15 @@ def create_tenant(email: str, language: Optional[str] = None):
     if language not in languages:
         language = "en-US"
 
+    name = name.strip()
+
     # generate random password
     new_password = secrets.token_urlsafe(16)
 
     # register account
     account = RegisterService.register(email=email, name=account_name, password=new_password, language=language)
 
-    TenantService.create_owner_tenant_if_not_exist(account)
+    TenantService.create_owner_tenant_if_not_exist(account, name)
 
     click.echo(
         click.style(

+ 1 - 0
api/controllers/console/explore/installed_app.py

@@ -35,6 +35,7 @@ class InstalledAppsListApi(Resource):
                 "uninstallable": current_tenant_id == installed_app.app_owner_tenant_id,
             }
             for installed_app in installed_apps
+            if installed_app.app is not None
         ]
         installed_apps.sort(
             key=lambda app: (

+ 2 - 2
api/core/model_runtime/model_providers/openai_api_compatible/llm/llm.py

@@ -150,9 +150,9 @@ class OAIAPICompatLargeLanguageModel(_CommonOAI_API_Compat, LargeLanguageModel):
             except json.JSONDecodeError as e:
                 raise CredentialsValidateFailedError('Credentials validation failed: JSON decode error')
 
-            if (completion_type is LLMMode.CHAT and json_result['object'] == ''):
+            if (completion_type is LLMMode.CHAT and json_result.get('object','') == ''):
                 json_result['object'] = 'chat.completion'
-            elif (completion_type is LLMMode.COMPLETION and json_result['object'] == ''):
+            elif (completion_type is LLMMode.COMPLETION and json_result.get('object','') == ''):
                 json_result['object'] = 'text_completion'
 
             if (completion_type is LLMMode.CHAT

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 39 - 0
api/core/model_runtime/model_providers/zhipuai/llm/glm_4_plus.yaml


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 37 - 0
api/core/model_runtime/model_providers/zhipuai/llm/glm_4v_plus.yaml


+ 5 - 4
api/core/model_runtime/model_providers/zhipuai/llm/llm.py

@@ -153,7 +153,8 @@ class ZhipuAILargeLanguageModel(_CommonZhipuaiAI, LargeLanguageModel):
         :return: full response or stream response chunk generator result
         """
         extra_model_kwargs = {}
-        if stop:
+        # request to glm-4v-plus with stop words will always response "finish_reason":"network_error"
+        if stop and model!= 'glm-4v-plus':
             extra_model_kwargs['stop'] = stop
 
         client = ZhipuAI(
@@ -174,7 +175,7 @@ class ZhipuAILargeLanguageModel(_CommonZhipuaiAI, LargeLanguageModel):
             if copy_prompt_message.role in [PromptMessageRole.USER, PromptMessageRole.SYSTEM, PromptMessageRole.TOOL]:
                 if isinstance(copy_prompt_message.content, list):
                     # check if model is 'glm-4v'
-                    if model != 'glm-4v':
+                    if model not in ('glm-4v', 'glm-4v-plus'):
                         # not support list message
                         continue
                     # get image and 
@@ -207,7 +208,7 @@ class ZhipuAILargeLanguageModel(_CommonZhipuaiAI, LargeLanguageModel):
                 else:
                     new_prompt_messages.append(copy_prompt_message)
 
-        if model == 'glm-4v':
+        if model == 'glm-4v' or model == 'glm-4v-plus':
             params = self._construct_glm_4v_parameter(model, new_prompt_messages, model_parameters)
         else:
             params = {
@@ -304,7 +305,7 @@ class ZhipuAILargeLanguageModel(_CommonZhipuaiAI, LargeLanguageModel):
 
         return params
 
-    def _construct_glm_4v_messages(self, prompt_message: Union[str | list[PromptMessageContent]]) -> list[dict]:
+    def _construct_glm_4v_messages(self, prompt_message: Union[str, list[PromptMessageContent]]) -> list[dict]:
         if isinstance(prompt_message, str):
             return [{'type': 'text', 'text': prompt_message}]
 

+ 5 - 2
api/services/account_service.py

@@ -265,7 +265,7 @@ class TenantService:
         return tenant
 
     @staticmethod
-    def create_owner_tenant_if_not_exist(account: Account):
+    def create_owner_tenant_if_not_exist(account: Account, name: Optional[str] = None):
         """Create owner tenant if not exist"""
         available_ta = (
             TenantAccountJoin.query.filter_by(account_id=account.id).order_by(TenantAccountJoin.id.asc()).first()
@@ -274,7 +274,10 @@ class TenantService:
         if available_ta:
             return
 
-        tenant = TenantService.create_tenant(f"{account.name}'s Workspace")
+        if name:
+            tenant = TenantService.create_tenant(name)
+        else:
+            tenant = TenantService.create_tenant(f"{account.name}'s Workspace")
         TenantService.create_tenant_member(tenant, account, role="owner")
         account.current_tenant = tenant
         db.session.commit()

+ 1 - 1
web/app/components/datasets/common/retrieval-param-config/index.tsx

@@ -191,7 +191,7 @@ const RetrievalParamConfig: FC<Props> = ({
                     <div className='truncate'>{option.label}</div>
                     <Tooltip
                       popupContent={<div className='w-[200px]'>{option.tips}</div>}
-                      triggerClassName='ml-0.5 w-3.5 h-4.5'
+                      triggerClassName='ml-0.5 w-3.5 h-3.5'
                     />
                   </div>
                 ))

+ 5 - 8
web/app/components/header/account-setting/model-provider-page/system-model-selector/index.tsx

@@ -148,7 +148,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
                     {t('common.modelProvider.systemReasoningModel.tip')}
                   </div>
                 }
-                triggerClassName='ml-0.5'
+                triggerClassName='ml-0.5 w-4 h-4 shrink-0'
               />
             </div>
             <div>
@@ -168,8 +168,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
                     {t('common.modelProvider.embeddingModel.tip')}
                   </div>
                 }
-                needsDelay={false}
-                triggerClassName='ml-0.5'
+                triggerClassName='ml-0.5 w-4 h-4 shrink-0'
               />
             </div>
             <div>
@@ -189,8 +188,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
                     {t('common.modelProvider.rerankModel.tip')}
                   </div>
                 }
-                needsDelay={false}
-                triggerClassName='ml-0.5'
+                triggerClassName='ml-0.5 w-4 h-4 shrink-0'
               />
             </div>
             <div>
@@ -210,8 +208,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
                     {t('common.modelProvider.speechToTextModel.tip')}
                   </div>
                 }
-                needsDelay={false}
-                triggerClassName='ml-0.5'
+                triggerClassName='ml-0.5 w-4 h-4 shrink-0'
               />
             </div>
             <div>
@@ -231,7 +228,7 @@ const SystemModel: FC<SystemModelSelectorProps> = ({
                     {t('common.modelProvider.ttsModel.tip')}
                   </div>
                 }
-                triggerClassName='ml-0.5'
+                triggerClassName='ml-0.5 w-4 h-4 shrink-0'
               />
             </div>
             <div>

+ 1 - 1
web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx

@@ -114,7 +114,7 @@ const ConfigCredential: FC<Props> = ({
                           {t('tools.createTool.authMethod.keyTooltip')}
                         </div>
                       }
-                      triggerClassName='ml-0.5'
+                      triggerClassName='ml-0.5 w-4 h-4'
                     />
                   </div>
                   <input

+ 1 - 1
web/i18n/zh-Hans/workflow.ts

@@ -80,7 +80,7 @@ const translation = {
   },
   env: {
     envPanelTitle: '环境变量',
-    envDescription: '环境变量是一种存储敏感信息的方法,如 API 密钥、数据库密码等。它们被存储在工作流程中,而不是代码中,以便在不同环中共享。',
+    envDescription: '环境变量是一种存储敏感信息的方法,如 API 密钥、数据库密码等。它们被存储在工作流程中,而不是代码中,以便在不同环中共享。',
     envPanelButton: '添加环境变量',
     modal: {
       title: '添加环境变量',