feat(app.py): eliminados prints y añadida configuración de la API Key

parent 08904e1b
Showing with 4 additions and 4 deletions
import re, json, uuid
import re, os, json, uuid
from flask import Flask, request, jsonify
from dotenv import load_dotenv
import google.generativeai as genai
......@@ -6,6 +6,9 @@ import google.generativeai as genai
# Cargar variables de entorno
load_dotenv()
# Configurar API KEY
genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
# Modelo generativo
model = genai.GenerativeModel('gemini-1.5-flash')
......@@ -97,9 +100,7 @@ def search_more_recipes():
if auth_header and auth_header.startswith("Bearer "):
token = auth_header[len("Bearer "):]
print("ANTES DEL IF--------------")
if not token or token != CHAT_SESSIONS[session_id]["token"]:
print(f"TOKEN : {token} ----- GUARDADO : {CHAT_SESSIONS[session_id]["token"]}")
return jsonify({"error": "Token inválido para esta sesión"}), 401
chat = CHAT_SESSIONS[session_id]["chat"]
......@@ -143,7 +144,6 @@ def get_recipe_detail(index: int):
session_recipes = session_data.get("recipes", [])
if index < 0 or index >= len(session_recipes):
print(f"INDEX : {index} ------ LONGITUD : {len(session_recipes)}")
return jsonify({"error": "Índice de receta fuera de rango"}), 400
# Comprobar si ya tenemos el detalle
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment