fix(model):

1. create a basic model to check if the name and provider are duplicated.
2. The result shows error models because the provider created API Keys for all matching models.
This commit is contained in:
Timebomb2018
2026-01-30 14:23:35 +08:00
parent 8826a01d32
commit ffb7b0ba38
2 changed files with 11 additions and 4 deletions

View File

@@ -630,6 +630,13 @@ class ModelBaseRepository:
db.add(model_base)
return model_base
@staticmethod
def get_by_name_and_provider(db: Session, name: str, provider: str) -> Optional['ModelBase']:
return db.query(ModelBase).filter(
ModelBase.name == name,
ModelBase.provider == provider
).first()
@staticmethod
def update(db: Session, model_base_id: uuid.UUID, data: dict) -> Optional['ModelBase']:
model_base = db.query(ModelBase).filter(ModelBase.id == model_base_id).first()