Spaces:
Sleeping
Sleeping
fix(gemini): upgrade model to gemini-2.5-flash and remove debug route
Browse files- routes/chat.py +0 -29
- services/genai_service.py +1 -1
routes/chat.py
CHANGED
|
@@ -74,32 +74,3 @@ def chat(user_id):
|
|
| 74 |
response=formatted_response,
|
| 75 |
history=history
|
| 76 |
)
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
@chat_bp.route('/debug/models', methods=['GET'])
|
| 80 |
-
def list_models():
|
| 81 |
-
"""
|
| 82 |
-
Rota de debug para listar modelos disponíveis na API.
|
| 83 |
-
"""
|
| 84 |
-
try:
|
| 85 |
-
import google.generativeai as genai
|
| 86 |
-
import os
|
| 87 |
-
|
| 88 |
-
api_key = os.getenv("GOOGLE_API_KEY")
|
| 89 |
-
if not api_key:
|
| 90 |
-
return "<h1>Erro: API Key não encontrada</h1>"
|
| 91 |
-
|
| 92 |
-
genai.configure(api_key=api_key)
|
| 93 |
-
|
| 94 |
-
models_info = []
|
| 95 |
-
for m in genai.list_models():
|
| 96 |
-
if 'generateContent' in m.supported_generation_methods:
|
| 97 |
-
models_info.append(f"<li><b>{m.name}</b> (Display Name: {m.display_name})</li>")
|
| 98 |
-
|
| 99 |
-
if not models_info:
|
| 100 |
-
return "<h1>Nenhum modelo encontrado com suporte a 'generateContent'</h1>"
|
| 101 |
-
|
| 102 |
-
return f"<h1>Modelos Disponíveis:</h1><ul>{''.join(models_info)}</ul>"
|
| 103 |
-
|
| 104 |
-
except Exception as e:
|
| 105 |
-
return f"<h1>Erro ao listar modelos:</h1><pre>{e}</pre>"
|
|
|
|
| 74 |
response=formatted_response,
|
| 75 |
history=history
|
| 76 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services/genai_service.py
CHANGED
|
@@ -18,7 +18,7 @@ def configure_genai():
|
|
| 18 |
|
| 19 |
try:
|
| 20 |
genai.configure(api_key=api_key)
|
| 21 |
-
model = genai.GenerativeModel("gemini-
|
| 22 |
print("✅ Chave da API configurada com sucesso.")
|
| 23 |
return model
|
| 24 |
|
|
|
|
| 18 |
|
| 19 |
try:
|
| 20 |
genai.configure(api_key=api_key)
|
| 21 |
+
model = genai.GenerativeModel("gemini-2.5-flash")
|
| 22 |
print("✅ Chave da API configurada com sucesso.")
|
| 23 |
return model
|
| 24 |
|