diff --git a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/embedding.py index 32329f37b62..f8d527ff39d 100644 --- a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/10/16 17:01 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model: AliyunBaiLianEmbedding = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/image.py b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/image.py index a533e03c794..3f3caafa0fd 100644 --- a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/image.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:41 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/llm.py b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/llm.py index 4591a12a78c..f316a0c6d1c 100644 --- a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/llm.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from langchain_core.messages import HumanMessage @@ -48,6 +49,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/reranker.py b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/reranker.py index 1bbe6947c33..8386c562ef0 100644 --- a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/reranker.py +++ b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/reranker.py @@ -6,6 +6,7 @@ @date:2024/9/9 17:51 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model: AliyunBaiLianReranker = provider.get_model(model_type, model_name, model_credential) model.compress_documents([Document(page_content=_('Hello'))], _('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/stt.py b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/stt.py index e2316986f58..e659b31af92 100644 --- a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/stt.py +++ b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/stt.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -30,6 +30,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tti.py b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tti.py index 74b47ee1e53..cc904fe226f 100644 --- a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tti.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:41 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -76,6 +77,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.check_auth() print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tts.py b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tts.py index eb6c42e09a6..6e2c64c84ee 100644 --- a/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tts.py +++ b/apps/setting/models_provider/impl/aliyun_bai_lian_model_provider/credential/tts.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -64,6 +64,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/anthropic_model_provider/credential/image.py b/apps/setting/models_provider/impl/anthropic_model_provider/credential/image.py index ffb085d5b7b..bf49c2c4578 100644 --- a/apps/setting/models_provider/impl/anthropic_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/anthropic_model_provider/credential/image.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -52,6 +53,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/anthropic_model_provider/credential/llm.py b/apps/setting/models_provider/impl/anthropic_model_provider/credential/llm.py index 1861a2f8644..350cd9414f7 100644 --- a/apps/setting/models_provider/impl/anthropic_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/anthropic_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:32 @desc: """ +import traceback from typing import Dict from langchain_core.messages import HumanMessage @@ -55,6 +56,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/embedding.py index c2a2ee36253..380335ce060 100644 --- a/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/embedding.py @@ -1,3 +1,4 @@ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje except AppApiException: raise except Exception as e: + traceback.print_exc() if raise_exception: raise AppApiException(ValidCode.valid_error.value, _('Verification failed, please check whether the parameters are correct: {error}').format( diff --git a/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/llm.py b/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/llm.py index 435e8784af8..cc8f81f43b3 100644 --- a/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/aws_bedrock_model_provider/credential/llm.py @@ -1,3 +1,4 @@ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -53,6 +54,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje except AppApiException: raise except Exception as e: + traceback.print_exc() if raise_exception: raise AppApiException(ValidCode.valid_error.value, gettext( diff --git a/apps/setting/models_provider/impl/azure_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/azure_model_provider/credential/embedding.py index f310dc72830..471e6c38400 100644 --- a/apps/setting/models_provider/impl/azure_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/azure_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/7/11 17:08 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/azure_model_provider/credential/image.py b/apps/setting/models_provider/impl/azure_model_provider/credential/image.py index 89b0071cb4b..ee8e7b850d6 100644 --- a/apps/setting/models_provider/impl/azure_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/azure_model_provider/credential/image.py @@ -1,6 +1,7 @@ # coding=utf-8 import base64 import os +import traceback from typing import Dict from langchain_core.messages import HumanMessage @@ -55,6 +56,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/azure_model_provider/credential/llm.py b/apps/setting/models_provider/impl/azure_model_provider/credential/llm.py index 77b3e703020..60fac810592 100644 --- a/apps/setting/models_provider/impl/azure_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/azure_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 17:08 @desc: """ +import traceback from typing import Dict from langchain_core.messages import HumanMessage @@ -55,6 +56,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/azure_model_provider/credential/stt.py b/apps/setting/models_provider/impl/azure_model_provider/credential/stt.py index b81e982227a..f1575dbefef 100644 --- a/apps/setting/models_provider/impl/azure_model_provider/credential/stt.py +++ b/apps/setting/models_provider/impl/azure_model_provider/credential/stt.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -31,6 +32,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/azure_model_provider/credential/tti.py b/apps/setting/models_provider/impl/azure_model_provider/credential/tti.py index f70bdceee5f..34d0c510622 100644 --- a/apps/setting/models_provider/impl/azure_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/azure_model_provider/credential/tti.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -67,6 +68,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.check_auth() print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/azure_model_provider/credential/tts.py b/apps/setting/models_provider/impl/azure_model_provider/credential/tts.py index bc47ad40576..a41365fecca 100644 --- a/apps/setting/models_provider/impl/azure_model_provider/credential/tts.py +++ b/apps/setting/models_provider/impl/azure_model_provider/credential/tts.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -49,6 +50,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/deepseek_model_provider/credential/llm.py b/apps/setting/models_provider/impl/deepseek_model_provider/credential/llm.py index 26f86554118..015deacee48 100644 --- a/apps/setting/models_provider/impl/deepseek_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/deepseek_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 17:51 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -55,6 +56,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/gemini_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/gemini_model_provider/credential/embedding.py index dc43961e952..22724ec08e9 100644 --- a/apps/setting/models_provider/impl/gemini_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/gemini_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/7/12 16:45 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -34,6 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/gemini_model_provider/credential/image.py b/apps/setting/models_provider/impl/gemini_model_provider/credential/image.py index 9a476bff323..87d667a61c8 100644 --- a/apps/setting/models_provider/impl/gemini_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/gemini_model_provider/credential/image.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -52,6 +52,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/gemini_model_provider/credential/llm.py b/apps/setting/models_provider/impl/gemini_model_provider/credential/llm.py index 272b85b4dc8..d02b9fdc356 100644 --- a/apps/setting/models_provider/impl/gemini_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/gemini_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 17:57 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.invoke([HumanMessage(content=gettext('Hello'))]) print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/gemini_model_provider/credential/stt.py b/apps/setting/models_provider/impl/gemini_model_provider/credential/stt.py index 13aa6647b61..0092d955e29 100644 --- a/apps/setting/models_provider/impl/gemini_model_provider/credential/stt.py +++ b/apps/setting/models_provider/impl/gemini_model_provider/credential/stt.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -29,6 +30,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/kimi_model_provider/credential/llm.py b/apps/setting/models_provider/impl/kimi_model_provider/credential/llm.py index c322ed6021d..9fbdc21f961 100644 --- a/apps/setting/models_provider/impl/kimi_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/kimi_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:06 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -55,6 +56,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/local_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/local_model_provider/credential/embedding.py index 16eb535c512..bbb431a6b3f 100644 --- a/apps/setting/models_provider/impl/local_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/local_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/7/11 11:06 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -34,6 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model: LocalEmbedding = provider.get_model(model_type, model_name, model_credential) model.embed_query(gettext('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/local_model_provider/credential/reranker.py b/apps/setting/models_provider/impl/local_model_provider/credential/reranker.py index 9320462a9cc..4c1715a72c9 100644 --- a/apps/setting/models_provider/impl/local_model_provider/credential/reranker.py +++ b/apps/setting/models_provider/impl/local_model_provider/credential/reranker.py @@ -6,6 +6,7 @@ @date:2024/9/3 14:33 @desc: """ +import traceback from typing import Dict from langchain_core.documents import Document @@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model: LocalBaseReranker = provider.get_model(model_type, model_name, model_credential) model.compress_documents([Document(page_content=gettext('Hello'))], gettext('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/openai_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/openai_model_provider/credential/embedding.py index 83252f9cfa1..31f18451864 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/openai_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/7/12 16:45 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -34,6 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/openai_model_provider/credential/image.py b/apps/setting/models_provider/impl/openai_model_provider/credential/image.py index 6b603cf089f..7cd7197f721 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/openai_model_provider/credential/image.py @@ -1,6 +1,7 @@ # coding=utf-8 import base64 import os +import traceback from typing import Dict from langchain_core.messages import HumanMessage @@ -54,6 +55,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/openai_model_provider/credential/llm.py b/apps/setting/models_provider/impl/openai_model_provider/credential/llm.py index f090f102345..13b70980dfb 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/openai_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:32 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/openai_model_provider/credential/stt.py b/apps/setting/models_provider/impl/openai_model_provider/credential/stt.py index a0647952909..e198238b123 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/credential/stt.py +++ b/apps/setting/models_provider/impl/openai_model_provider/credential/stt.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -30,6 +31,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/openai_model_provider/credential/tti.py b/apps/setting/models_provider/impl/openai_model_provider/credential/tti.py index 7752f4b340a..cd2e342cd22 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/openai_model_provider/credential/tti.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -70,6 +71,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.check_auth() print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/openai_model_provider/credential/tts.py b/apps/setting/models_provider/impl/openai_model_provider/credential/tts.py index 5c72bfc7c17..57059197501 100644 --- a/apps/setting/models_provider/impl/openai_model_provider/credential/tts.py +++ b/apps/setting/models_provider/impl/openai_model_provider/credential/tts.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -48,6 +49,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/qwen_model_provider/credential/image.py b/apps/setting/models_provider/impl/qwen_model_provider/credential/image.py index a533e03c794..3f3caafa0fd 100644 --- a/apps/setting/models_provider/impl/qwen_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/qwen_model_provider/credential/image.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:41 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/qwen_model_provider/credential/llm.py b/apps/setting/models_provider/impl/qwen_model_provider/credential/llm.py index 49324a5ab20..6aced3340a2 100644 --- a/apps/setting/models_provider/impl/qwen_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/qwen_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:41 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -54,6 +55,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/qwen_model_provider/credential/tti.py b/apps/setting/models_provider/impl/qwen_model_provider/credential/tti.py index 74b47ee1e53..cc904fe226f 100644 --- a/apps/setting/models_provider/impl/qwen_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/qwen_model_provider/credential/tti.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:41 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -76,6 +77,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.check_auth() print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/embedding.py index 51e5c3621ad..1a4f8d1d3ee 100644 --- a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/7/12 16:45 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -34,6 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/image.py b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/image.py index a3ae4025241..cb6c2ee9cd3 100644 --- a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/image.py @@ -1,6 +1,7 @@ # coding=utf-8 import base64 import os +import traceback from typing import Dict from langchain_core.messages import HumanMessage @@ -54,6 +55,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/llm.py b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/llm.py index 5c5888570b7..a7333eb4747 100644 --- a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:32 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/reranker.py b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/reranker.py index 5ed7d8e52c8..834aaf12034 100644 --- a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/reranker.py +++ b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/reranker.py @@ -6,6 +6,7 @@ @date:2024/9/9 17:51 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -35,6 +36,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model: SiliconCloudReranker = provider.get_model(model_type, model_name, model_credential) model.compress_documents([Document(page_content=_('Hello'))], _('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/stt.py b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/stt.py index db25ec6d1d5..cba2e5d8736 100644 --- a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/stt.py +++ b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/stt.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -30,6 +31,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tti.py b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tti.py index fbea6989017..860bad4b9e2 100644 --- a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tti.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -70,6 +71,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.check_auth() print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tts.py b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tts.py index b80bdc78861..ffe003e9a42 100644 --- a/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tts.py +++ b/apps/setting/models_provider/impl/siliconCloud_model_provider/credential/tts.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -48,6 +49,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/tencent_cloud_model_provider/credential/llm.py b/apps/setting/models_provider/impl/tencent_cloud_model_provider/credential/llm.py index f2ec4dc1b12..8d8e52d27ee 100644 --- a/apps/setting/models_provider/impl/tencent_cloud_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/tencent_cloud_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:32 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/tencent_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/tencent_model_provider/credential/embedding.py index 154599708c4..4c500005b15 100644 --- a/apps/setting/models_provider/impl/tencent_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/tencent_model_provider/credential/embedding.py @@ -1,3 +1,4 @@ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -21,6 +22,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/tencent_model_provider/credential/image.py b/apps/setting/models_provider/impl/tencent_model_provider/credential/image.py index 56842203d39..257be9f67bf 100644 --- a/apps/setting/models_provider/impl/tencent_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/tencent_model_provider/credential/image.py @@ -6,6 +6,7 @@ @date:2024/7/11 18:41 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/tencent_model_provider/credential/llm.py b/apps/setting/models_provider/impl/tencent_model_provider/credential/llm.py index e0dfeb5d732..4fa28ba3023 100644 --- a/apps/setting/models_provider/impl/tencent_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/tencent_model_provider/credential/llm.py @@ -1,4 +1,6 @@ # coding=utf-8 +import traceback + from django.utils.translation import gettext_lazy as _, gettext from langchain_core.messages import HumanMessage @@ -48,6 +50,7 @@ def is_valid(self, model_type, model_name, model_credential, model_params, provi model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if raise_exception: raise AppApiException(ValidCode.valid_error.value, gettext( diff --git a/apps/setting/models_provider/impl/tencent_model_provider/credential/tti.py b/apps/setting/models_provider/impl/tencent_model_provider/credential/tti.py index 6fa637da848..60fcfbfc9b0 100644 --- a/apps/setting/models_provider/impl/tencent_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/tencent_model_provider/credential/tti.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from django.utils.translation import gettext_lazy as _, gettext @@ -96,6 +97,7 @@ def is_valid(self, model_type, model_name, model_credential, model_params, provi model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if raise_exception: raise AppApiException(ValidCode.valid_error.value, gettext( diff --git a/apps/setting/models_provider/impl/vllm_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/vllm_model_provider/credential/embedding.py index 887d6f1837c..3ebccd20d53 100644 --- a/apps/setting/models_provider/impl/vllm_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/vllm_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/7/12 16:45 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -34,6 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/vllm_model_provider/credential/image.py b/apps/setting/models_provider/impl/vllm_model_provider/credential/image.py index c2bf6630cd7..68674fc0b5a 100644 --- a/apps/setting/models_provider/impl/vllm_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/vllm_model_provider/credential/image.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -52,6 +53,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/vllm_model_provider/credential/llm.py b/apps/setting/models_provider/impl/vllm_model_provider/credential/llm.py index 7c82505d6e1..6700b756d90 100644 --- a/apps/setting/models_provider/impl/vllm_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/vllm_model_provider/credential/llm.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -49,6 +49,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje try: res = model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() raise AppApiException(ValidCode.valid_error.value, gettext( 'Verification failed, please check whether the parameters are correct: {error}').format( diff --git a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/embedding.py index b06b2e96a03..40cb8baee38 100644 --- a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/7/12 16:45 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -34,6 +35,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/image.py b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/image.py index 7a35a1b60ea..23d22cf932c 100644 --- a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/image.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -52,6 +53,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/llm.py b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/llm.py index 959c54e2b22..3b7734da5b0 100644 --- a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/11 17:57 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +57,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.invoke([HumanMessage(content=gettext('Hello'))]) print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/stt.py b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/stt.py index d537246393a..6aae433c373 100644 --- a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/stt.py +++ b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/stt.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -34,6 +34,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tti.py b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tti.py index eb344749f2c..98c119e21cb 100644 --- a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tti.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -50,6 +50,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tts.py b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tts.py index 80299b536c8..15decad7a4f 100644 --- a/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tts.py +++ b/apps/setting/models_provider/impl/volcanic_engine_model_provider/credential/tts.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -62,6 +62,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/wenxin_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/wenxin_model_provider/credential/embedding.py index b807a29ddd7..85359511d33 100644 --- a/apps/setting/models_provider/impl/wenxin_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/wenxin_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/10/17 15:40 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -29,6 +30,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/wenxin_model_provider/credential/llm.py b/apps/setting/models_provider/impl/wenxin_model_provider/credential/llm.py index 66f6c0e2fcf..06ec94aae34 100644 --- a/apps/setting/models_provider/impl/wenxin_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/wenxin_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/12 10:19 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -58,6 +59,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model.invoke( [HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() raise e return True diff --git a/apps/setting/models_provider/impl/xf_model_provider/credential/embedding.py b/apps/setting/models_provider/impl/xf_model_provider/credential/embedding.py index 8e29418ae66..57f66d3ac88 100644 --- a/apps/setting/models_provider/impl/xf_model_provider/credential/embedding.py +++ b/apps/setting/models_provider/impl/xf_model_provider/credential/embedding.py @@ -6,6 +6,7 @@ @date:2024/10/17 15:40 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -29,6 +30,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.embed_query(_('Hello')) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/xf_model_provider/credential/image.py b/apps/setting/models_provider/impl/xf_model_provider/credential/image.py index cab4e5a2582..b68b84149be 100644 --- a/apps/setting/models_provider/impl/xf_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/xf_model_provider/credential/image.py @@ -1,6 +1,7 @@ # coding=utf-8 import base64 import os +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -41,6 +42,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje HumanMessage(_('Please outline this picture'))] model.stream(message_list) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/xf_model_provider/credential/llm.py b/apps/setting/models_provider/impl/xf_model_provider/credential/llm.py index fda2c1a5c42..f62a7164ced 100644 --- a/apps/setting/models_provider/impl/xf_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/xf_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/12 10:29 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -74,6 +75,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/xf_model_provider/credential/stt.py b/apps/setting/models_provider/impl/xf_model_provider/credential/stt.py index 8b46a5d4a74..44db3b15272 100644 --- a/apps/setting/models_provider/impl/xf_model_provider/credential/stt.py +++ b/apps/setting/models_provider/impl/xf_model_provider/credential/stt.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext as _ @@ -33,6 +33,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/xf_model_provider/credential/tts.py b/apps/setting/models_provider/impl/xf_model_provider/credential/tts.py index 8660cb9f9d6..39463886264 100644 --- a/apps/setting/models_provider/impl/xf_model_provider/credential/tts.py +++ b/apps/setting/models_provider/impl/xf_model_provider/credential/tts.py @@ -1,5 +1,5 @@ # coding=utf-8 - +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -56,6 +56,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.check_auth() except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/zhipu_model_provider/credential/image.py b/apps/setting/models_provider/impl/zhipu_model_provider/credential/image.py index 2c759bf922b..599526df7eb 100644 --- a/apps/setting/models_provider/impl/zhipu_model_provider/credential/image.py +++ b/apps/setting/models_provider/impl/zhipu_model_provider/credential/image.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -51,6 +52,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje for chunk in res: print(chunk) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/zhipu_model_provider/credential/llm.py b/apps/setting/models_provider/impl/zhipu_model_provider/credential/llm.py index af582d6dd03..e6dc74d6260 100644 --- a/apps/setting/models_provider/impl/zhipu_model_provider/credential/llm.py +++ b/apps/setting/models_provider/impl/zhipu_model_provider/credential/llm.py @@ -6,6 +6,7 @@ @date:2024/7/12 10:46 @desc: """ +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -54,6 +55,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje model = provider.get_model(model_type, model_name, model_credential, **model_params) model.invoke([HumanMessage(content=gettext('Hello'))]) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: diff --git a/apps/setting/models_provider/impl/zhipu_model_provider/credential/tti.py b/apps/setting/models_provider/impl/zhipu_model_provider/credential/tti.py index d2c21a0722e..38a88f26743 100644 --- a/apps/setting/models_provider/impl/zhipu_model_provider/credential/tti.py +++ b/apps/setting/models_provider/impl/zhipu_model_provider/credential/tti.py @@ -1,4 +1,5 @@ # coding=utf-8 +import traceback from typing import Dict from django.utils.translation import gettext_lazy as _, gettext @@ -49,6 +50,7 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje res = model.check_auth() print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: