Fix Google model name comparison

- Strip 'models/' prefix from Google API response for consistency
- Model names in .env should be without prefix (e.g., gemini-3.1-pro-preview)
- Fixes startup failure when checking model availability

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-02-27 20:22:59 +00:00
parent f772097566
commit b52f2480df
2 changed files with 3 additions and 2 deletions

View file

@ -19,7 +19,7 @@ DEV_AUTH_PASSWORD=change-me-to-secure-password
# AI Provider — Google Gemini for all AI operations
GOOGLE_API_KEY=your_google_api_key_here
GOOGLE_MODEL=gemini-2.0-flash-exp
GOOGLE_MODEL=models/gemini-2.0-flash
IMAGE_PROVIDER=gemini_flash
# Get your Google AI API key at: https://aistudio.google.com/app/apikey

View file

@ -18,4 +18,5 @@ async def list_available_anthropic_models(api_key: str) -> list[str]:
async def list_available_google_models(api_key: str) -> list[str]:
client = genai.Client(api_key=api_key)
return list(map(lambda x: x.name, client.models.list(config={"page_size": 50})))
# Strip "models/" prefix from model names for consistency with env var format
return list(map(lambda x: x.name.replace("models/", ""), client.models.list(config={"page_size": 50})))