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 32329f37b..f8d527ff3 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 @@ class AliyunBaiLianEmbeddingCredential(BaseForm, BaseModelCredential): 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 a533e03c7..3f3caafa0 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 @@ class QwenVLModelCredential(BaseForm, BaseModelCredential): 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 4591a12a7..f316a0c6d 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 @@ class BaiLianLLMModelCredential(BaseForm, BaseModelCredential): 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 1bbe6947c..8386c562e 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 @@ class AliyunBaiLianRerankerCredential(BaseForm, BaseModelCredential): 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 e2316986f..e659b31af 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 @@ class AliyunBaiLianSTTModelCredential(BaseForm, BaseModelCredential): 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 74b47ee1e..cc904fe22 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 @@ class QwenTextToImageModelCredential(BaseForm, BaseModelCredential): 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 eb6c42e09..6e2c64c84 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 @@ class AliyunBaiLianTTSModelCredential(BaseForm, BaseModelCredential): 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 ffb085d5b..bf49c2c45 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 @@ class AnthropicImageModelCredential(BaseForm, BaseModelCredential): 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 1861a2f86..350cd9414 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 @@ class AnthropicLLMModelCredential(BaseForm, BaseModelCredential): 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 c2a2ee362..380335ce0 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 @@ class BedrockEmbeddingCredential(BaseForm, BaseModelCredential): 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 435e8784a..cc8f81f43 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 @@ class BedrockLLMModelCredential(BaseForm, BaseModelCredential): 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 f310dc728..471e6c384 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 @@ class AzureOpenAIEmbeddingCredential(BaseForm, BaseModelCredential): 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 89b0071cb..ee8e7b850 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 @@ class AzureOpenAIImageModelCredential(BaseForm, BaseModelCredential): 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 77b3e7030..60fac8105 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 @@ class AzureLLMModelCredential(BaseForm, BaseModelCredential): 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 b81e98222..f1575dbef 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 @@ class AzureOpenAISTTModelCredential(BaseForm, BaseModelCredential): 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 f70bdceee..34d0c5106 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 @@ class AzureOpenAITextToImageModelCredential(BaseForm, BaseModelCredential): 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 bc47ad405..a41365fec 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 @@ class AzureOpenAITTSModelCredential(BaseForm, BaseModelCredential): 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 26f865541..015deacee 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 @@ class DeepSeekLLMModelCredential(BaseForm, BaseModelCredential): 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 dc43961e9..22724ec08 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 @@ class GeminiEmbeddingCredential(BaseForm, BaseModelCredential): 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 9a476bff3..87d667a61 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 @@ class GeminiImageModelCredential(BaseForm, BaseModelCredential): 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 272b85b4d..d02b9fdc3 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 @@ class GeminiLLMModelCredential(BaseForm, BaseModelCredential): 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 13aa6647b..0092d955e 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 @@ class GeminiSTTModelCredential(BaseForm, BaseModelCredential): 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 c322ed602..9fbdc21f9 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 @@ class KimiLLMModelCredential(BaseForm, BaseModelCredential): 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 16eb535c5..bbb431a6b 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 @@ class LocalEmbeddingCredential(BaseForm, BaseModelCredential): 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 9320462a9..4c1715a72 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 @@ class LocalRerankerCredential(BaseForm, BaseModelCredential): 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 83252f9cf..31f184518 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 @@ class OpenAIEmbeddingCredential(BaseForm, BaseModelCredential): 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 6b603cf08..7cd7197f7 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 @@ class OpenAIImageModelCredential(BaseForm, BaseModelCredential): 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 f090f1023..13b70980d 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 @@ class OpenAILLMModelCredential(BaseForm, BaseModelCredential): 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 a06479529..e198238b1 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 @@ class OpenAISTTModelCredential(BaseForm, BaseModelCredential): 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 7752f4b34..cd2e342cd 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 @@ class OpenAITextToImageModelCredential(BaseForm, BaseModelCredential): 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 5c72bfc7c..570591975 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 @@ class OpenAITTSModelCredential(BaseForm, BaseModelCredential): 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 a533e03c7..3f3caafa0 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 @@ class QwenVLModelCredential(BaseForm, BaseModelCredential): 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 49324a5ab..6aced3340 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 @@ class OpenAILLMModelCredential(BaseForm, BaseModelCredential): 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 74b47ee1e..cc904fe22 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 @@ class QwenTextToImageModelCredential(BaseForm, BaseModelCredential): 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 51e5c3621..1a4f8d1d3 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 @@ class SiliconCloudEmbeddingCredential(BaseForm, BaseModelCredential): 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 a3ae40252..cb6c2ee9c 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 @@ class SiliconCloudImageModelCredential(BaseForm, BaseModelCredential): 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 5c5888570..a7333eb47 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 @@ class SiliconCloudLLMModelCredential(BaseForm, BaseModelCredential): 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 5ed7d8e52..834aaf120 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 @@ class SiliconCloudRerankerCredential(BaseForm, BaseModelCredential): 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 db25ec6d1..cba2e5d87 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 @@ class SiliconCloudSTTModelCredential(BaseForm, BaseModelCredential): 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 fbea69890..860bad4b9 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 @@ class SiliconCloudTextToImageModelCredential(BaseForm, BaseModelCredential): 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 b80bdc788..ffe003e9a 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 @@ class SiliconCloudTTSModelCredential(BaseForm, BaseModelCredential): 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 f2ec4dc1b..8d8e52d27 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 @@ class TencentCloudLLMModelCredential(BaseForm, BaseModelCredential): 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 154599708..4c500005b 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 @@ class TencentEmbeddingCredential(BaseForm, BaseModelCredential): 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 56842203d..257be9f67 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 @@ class TencentVisionModelCredential(BaseForm, BaseModelCredential): 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 e0dfeb5d7..4fa28ba30 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 @@ class TencentLLMModelCredential(BaseForm, BaseModelCredential): 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 6fa637da8..60fcfbfc9 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 @@ class TencentTTIModelCredential(BaseForm, BaseModelCredential): 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 887d6f183..3ebccd20d 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 @@ class VllmEmbeddingCredential(BaseForm, BaseModelCredential): 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 c2bf6630c..68674fc0b 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 @@ class VllmImageModelCredential(BaseForm, BaseModelCredential): 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 7c82505d6..6700b756d 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 @@ class VLLMModelCredential(BaseForm, BaseModelCredential): 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 b06b2e96a..40cb8baee 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 @@ class VolcanicEmbeddingCredential(BaseForm, BaseModelCredential): 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 7a35a1b60..23d22cf93 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 @@ class VolcanicEngineImageModelCredential(BaseForm, BaseModelCredential): 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 959c54e2b..3b7734da5 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 @@ class VolcanicEngineLLMModelCredential(BaseForm, BaseModelCredential): 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 d53724639..6aae433c3 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 @@ class VolcanicEngineSTTModelCredential(BaseForm, BaseModelCredential): 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 eb344749f..98c119e21 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 @@ class VolcanicEngineTTIModelCredential(BaseForm, BaseModelCredential): 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 80299b536..15decad7a 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 @@ class VolcanicEngineTTSModelCredential(BaseForm, BaseModelCredential): 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 b807a29dd..85359511d 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 @@ class QianfanEmbeddingCredential(BaseForm, BaseModelCredential): 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 66f6c0e2f..06ec94aae 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 @@ class WenxinLLMModelCredential(BaseForm, BaseModelCredential): 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 8e29418ae..57f66d3ac 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 @@ class XFEmbeddingCredential(BaseForm, BaseModelCredential): 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 cab4e5a25..b68b84149 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 @@ class XunFeiImageModelCredential(BaseForm, BaseModelCredential): 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 fda2c1a5c..f62a7164c 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 @@ class XunFeiLLMModelCredential(BaseForm, BaseModelCredential): 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 8b46a5d4a..44db3b152 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 @@ class XunFeiSTTModelCredential(BaseForm, BaseModelCredential): 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 8660cb9f9..394638862 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 @@ class XunFeiTTSModelCredential(BaseForm, BaseModelCredential): 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 2c759bf92..599526df7 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 @@ class ZhiPuImageModelCredential(BaseForm, BaseModelCredential): 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 af582d6dd..e6dc74d62 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 @@ class ZhiPuLLMModelCredential(BaseForm, BaseModelCredential): 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 d2c21a072..38a88f267 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 @@ class ZhiPuTextToImageModelCredential(BaseForm, BaseModelCredential): res = model.check_auth() print(res) except Exception as e: + traceback.print_exc() if isinstance(e, AppApiException): raise e if raise_exception: