fix(model): The custom models in the model list can batch add APIkeys through the provider

This commit is contained in:
Timebomb2018
2026-02-28 16:51:56 +08:00
parent 5f211620c5
commit 1037729fb3

View File

@@ -428,19 +428,17 @@ class ModelConfigRepository:
try: try:
# 查询ModelConfig关联的ModelApiKey筛选出匹配的model_config_id # 查询ModelConfig关联的ModelApiKey筛选出匹配的model_config_id
model_config_ids = db.query(ModelConfig.id).join( model_config_ids = db.query(ModelConfig.id).filter(
ModelBase, ModelConfig.model_id == ModelBase.id
).filter(
and_( and_(
or_( or_(
ModelConfig.tenant_id == tenant_id, ModelConfig.tenant_id == tenant_id,
ModelConfig.is_public ModelConfig.is_public
), ),
ModelBase.provider == provider, ModelConfig.provider == provider,
ModelConfig.is_active, ModelConfig.is_active,
~ModelConfig.is_composite ~ModelConfig.is_composite
) )
).distinct().all() ).all()
db_logger.debug(f"查询成功: 数量={len(model_config_ids)}") db_logger.debug(f"查询成功: 数量={len(model_config_ids)}")
return [row[0] for row in model_config_ids] return [row[0] for row in model_config_ids]