Skip to content

Commit 751c54f

Browse files
committed
fix: simplify check_auth method by removing OpenAI client initialization
1 parent 0095287 commit 751c54f

File tree

1 file changed

+1
-16
lines changed
  • apps/models_provider/impl/aliyun_bai_lian_model_provider/model

1 file changed

+1
-16
lines changed

apps/models_provider/impl/aliyun_bai_lian_model_provider/model/image.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,7 @@ def new_instance(model_type, model_name, model_credential: Dict[str, object], **
3636
return chat_tong_yi
3737

3838
def check_auth(self, api_key):
39-
from openai import OpenAI
40-
41-
client = OpenAI(
42-
# 若没有配置环境变量,请用百炼API Key将下行替换为:api_key="sk-xxx"
43-
api_key=api_key,
44-
base_url=self.openai_api_base,
45-
)
46-
client.chat.completions.create(
47-
# 模型列表:https://help.aliyun.com/zh/model-studio/getting-started/models
48-
model="qwen-max",
49-
messages=[
50-
{"role": "system", "content": "You are a helpful assistant."},
51-
{"role": "user", "content": gettext('Hello')},
52-
]
53-
54-
)
39+
return True
5540

5641
def get_upload_policy(self, api_key, model_name):
5742
"""获取文件上传凭证"""

0 commit comments

Comments
 (0)