瀏覽代碼

fix: replicate text generation model validate (#923)

takatost 1 年之前
父節點
當前提交
95b179fb39
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      api/core/model_providers/providers/replicate_provider.py

+ 2 - 1
api/core/model_providers/providers/replicate_provider.py

@@ -116,7 +116,8 @@ class ReplicateProvider(BaseModelProvider):
                     and 'Embedding' not in rst.openapi_schema['components']['schemas']:
                 raise CredentialsValidateFailedError(f"Model {model_name}:{version} is not a Embedding model.")
             elif model_type == ModelType.TEXT_GENERATION \
-                    and ('type' not in rst.openapi_schema['components']['schemas']['Output']['items']
+                    and ('items' not in rst.openapi_schema['components']['schemas']['Output']
+                         or 'type' not in rst.openapi_schema['components']['schemas']['Output']['items']
                          or rst.openapi_schema['components']['schemas']['Output']['items']['type'] != 'string'):
                 raise CredentialsValidateFailedError(f"Model {model_name}:{version} is not a Text Generation model.")
         except ReplicateError as e: