mirror of
https://github.com/snailyp/gemini-balance.git
synced 2026-09-06 08:06:37 +08:00
check model before send request
This commit is contained in:
@@ -68,3 +68,17 @@ class ModelService:
|
||||
image_model["id"] = f"{settings.CREATE_IMAGE_MODEL}-chat"
|
||||
openai_format["data"].append(image_model)
|
||||
return openai_format
|
||||
|
||||
def check_model_support(self, model: str) -> bool:
|
||||
if not model or not isinstance(model, str):
|
||||
return False
|
||||
|
||||
model = model.strip()
|
||||
if model.endswith("-search"):
|
||||
model = model[:-7]
|
||||
return model in settings.MODEL_SEARCH
|
||||
if model.endswith("-image"):
|
||||
model = model[:-6]
|
||||
return model in settings.MODEL_IMAGE
|
||||
|
||||
return True
|
||||
Reference in New Issue
Block a user