fix(知识服务): 修复创建知识库时未检查视觉模型存在的错误

当租户下没有可用的视觉模型时,抛出明确异常提示
This commit is contained in:
wwq
2026-04-21 16:50:43 +08:00
parent 152a84aff3
commit eb98a69a84

View File

@@ -122,7 +122,8 @@ def create_knowledge(
ModelConfig.is_active == True,
ModelConfig.is_composite == False
).order_by(ModelConfig.created_at.desc()).first()
if model:
if not model:
raise Exception("租户下没有可用的视觉模型,创建知识库失败")
knowledge.image2text_id = model.id
business_logger.debug(f"Auto-bind image2text model: {model.id}")