fix: 处理校验图片模型的报错

This commit is contained in:
CaptainB 2024-11-19 16:53:32 +08:00
parent b91d9fdaf0
commit 4fd6884ad6
3 changed files with 9 additions and 3 deletions

View File

@ -29,7 +29,9 @@ class OpenAIImageModelCredential(BaseForm, BaseModelCredential):
return False
try:
model = provider.get_model(model_type, model_name, model_credential)
model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
res = model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
for chunk in res:
print(chunk)
except Exception as e:
if isinstance(e, AppApiException):
raise e

View File

@ -50,7 +50,9 @@ class QwenVLModelCredential(BaseForm, BaseModelCredential):
return False
try:
model = provider.get_model(model_type, model_name, model_credential)
model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
res = model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
for chunk in res:
print(chunk)
except Exception as e:
if isinstance(e, AppApiException):
raise e

View File

@ -50,7 +50,9 @@ class TencentVisionModelCredential(BaseForm, BaseModelCredential):
return False
try:
model = provider.get_model(model_type, model_name, model_credential)
model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
res = model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
for chunk in res:
print(chunk)
except Exception as e:
if isinstance(e, AppApiException):
raise e