Skip to content

Commit 4fd6884

Browse files
committed
fix: 处理校验图片模型的报错
1 parent b91d9fd commit 4fd6884

File tree

3 files changed

+9
-3
lines changed
  • apps/setting/models_provider/impl

3 files changed

+9
-3
lines changed

apps/setting/models_provider/impl/openai_model_provider/credential/image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
2929
return False
3030
try:
3131
model = provider.get_model(model_type, model_name, model_credential)
32-
model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
32+
res = model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
33+
for chunk in res:
34+
print(chunk)
3335
except Exception as e:
3436
if isinstance(e, AppApiException):
3537
raise e

apps/setting/models_provider/impl/qwen_model_provider/credential/image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5050
return False
5151
try:
5252
model = provider.get_model(model_type, model_name, model_credential)
53-
model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
53+
res = model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
54+
for chunk in res:
55+
print(chunk)
5456
except Exception as e:
5557
if isinstance(e, AppApiException):
5658
raise e

apps/setting/models_provider/impl/tencent_model_provider/credential/image.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ def is_valid(self, model_type: str, model_name, model_credential: Dict[str, obje
5050
return False
5151
try:
5252
model = provider.get_model(model_type, model_name, model_credential)
53-
model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
53+
res = model.stream([HumanMessage(content=[{"type": "text", "text": "你好"}])])
54+
for chunk in res:
55+
print(chunk)
5456
except Exception as e:
5557
if isinstance(e, AppApiException):
5658
raise e

0 commit comments

Comments
 (0)