mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-05 20:03:48 +00:00
update notification service
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user