update notification service

This commit is contained in:
MacRimi
2026-03-22 21:14:19 +01:00
parent 70871330d3
commit 3f24d55945
3 changed files with 15 additions and 8 deletions

View File

@@ -18,12 +18,12 @@
"gemini": {
"models": [
"gemini-2.5-flash",
"gemini-2.5-pro",
"gemini-1.5-flash"
"gemini-2.5-flash-lite",
"gemini-2.5-pro"
],
"recommended": "gemini-1.5-flash",
"_note": "gemini-2.5-* may have availability issues. gemini-1.5-flash is more stable.",
"_deprecated": ["gemini-2.0-flash", "gemini-2.0-flash-lite", "gemini-1.0-pro", "gemini-pro"]
"recommended": "gemini-2.5-flash",
"_note": "gemini-2.5-flash-lite is cheaper but may struggle with complex prompts. Use with simple/custom prompts.",
"_deprecated": ["gemini-2.0-flash", "gemini-2.0-flash-lite", "gemini-1.5-flash", "gemini-1.0-pro", "gemini-pro"]
},
"openai": {

View File

@@ -65,7 +65,7 @@ class AIProvider(ABC):
response = self.generate(
system_prompt="You are a test assistant. Respond with exactly: CONNECTION_OK",
user_message="Test connection",
max_tokens=20
max_tokens=50 # Some providers (Gemini) need more tokens to return any content
)
if response:
# Check if response contains our expected text

View File

@@ -166,8 +166,15 @@ class GeminiProvider(AIProvider):
if text:
return text
# No text content - provide detailed error
raise AIProviderError(f"No text in response (finishReason: {finish_reason})")
# No text content - check if it's a known issue
if finish_reason == 'MAX_TOKENS':
# MAX_TOKENS with no content means the prompt itself was too long
raise AIProviderError("Prompt too long - no space for response. Try a shorter system prompt or message.")
elif finish_reason == 'STOP':
# Normal stop but no content - unusual
raise AIProviderError("Model returned empty response")
else:
raise AIProviderError(f"No text in response (finishReason: {finish_reason})")
except AIProviderError:
raise
except (KeyError, IndexError) as e: