Nuevo Asistente Nutricional con IA#22
Merged
ComputingVictor merged 13 commits intomainfrom Nov 1, 2025
Merged
Conversation
- Introduced a new state for showing discounts in the MercadonaApp. - Implemented functionality to filter and display discounted products. - Added event listeners for the new discounts button in the UI. - Updated product card to show discount badges and adjusted price display. - Enhanced UI with new styles for discount badges and buttons. - Updated mobile menu to include discounts option and styling. - Added utility functions to manage discounts display and counts.
- Added chat UI styles in chat.css for a floating action button, chat container, header, messages area, and input area. - Developed chat functionality in chat.js, including message handling, AI response fetching, and chat history management. - Created a secure configuration system in config-secure.js to manage API keys and chat model preferences without exposing sensitive information. - Added a setup script (setup-chat.sh) for easy configuration and local server setup.
- Changed from recipe assistant to nutrition/diet planning assistant - Updated system prompt to focus on diets (bulk, cut, maintenance, etc.) - Simplified to use only GitHub Secrets API key (no localStorage) - Updated UI labels and icons (chef -> dumbbell) - Ready to use with MiniMax M2 model from secrets - Users can now get diet recommendations based on fitness goals
- Products mentioned in chat are now automatically converted to clickable links - Clicking a product link closes the chat and opens the product detail modal - Added CSS styling for product links with hover effects - Links work for both user and assistant messages - Intelligent matching: longest product names matched first to avoid partial matches
- Chat button now always visible (not hidden) - Shows yellow warning badge (!) if API key not configured - Clicking without API key shows helpful message - Better UX for both local development and production
…configurar la API key
- Added clear warning that ONLY products in the database can be mentioned - Increased product list from 150 to 200 items for better coverage - Added explicit examples of correct vs incorrect responses - Emphasized that products NOT in the list DO NOT EXIST - Added rule to suggest alternatives when exact product not found - More emojis for visual emphasis (✅❌⚠️ ) - Clearer structure with REGLAS ESTRICTAS section
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 Nuevo Asistente Nutricional con IA
Este PR añade un chat inteligente con IA que ayuda a los usuarios a planificar sus dietas usando exclusivamente productos de Mercadona.
✨ Características Principales
💬 Chat Inteligente
🔗 Enlaces a Productos
🔒 Seguridad
config.jsgenerado automáticamente en cada deploy🎯 Prompt Estricto
🗂️ Archivos Nuevos
chat.js- Lógica del asistente de chatchat.css- Estilos responsive del chatconfig-secure.js- Sistema de configuración segura.github/workflows/deploy.yml- Workflow de deployment automático📝 Archivos Modificados
index.html- Añadido botón flotante y container del chatscript.js- Integración del chat en la app principalstyle.css- Ajustes de estilos.gitignore- Ignorarconfig.jslocal🚀 Cómo Funciona
Para Desarrollo Local
config.jsy añade tu API key.gitignore(no se sube a GitHub)Para Producción (GitHub Pages)
OPENROUTER_API_KEY: Tu API key de OpenRouterCHAT_MODEL: Modelo a usar (ej:deepseek/deepseek-chat)config.jsautomáticamente con los secrets🎨 Interfaz
📊 Commits Incluidos
055795f- feat: Strengthen system prompt to ONLY use products from databasef4f6388- feat: Implementar modo DEMO en el chat139405b- fix: Configure workflow to deploy only from dev branch2ea772c- fix: Always show chat button, add warning badge if no API key69c2b5e- feat: Add clickable product links in chat messagesffae312- fix: Enable workflow on dev branch60cde02- feat: Transform chat into nutrition assistant with diet planning5e8e619- feat: Añadir configuración de despliegue en GitHub Pages con secretos de GitHub0a5d135- feat: Implement Recipe Assistant Chat with OpenRouter API integration✅ Testing
config.js🔧 Configuración Requerida
Antes de mergear, asegúrate de:
GitHub Pages configurado a "GitHub Actions"
Secrets configurados
OPENROUTER_API_KEYCHAT_MODEL(opcional)💰 Costos
OpenRouter tiene modelos gratuitos:
meta-llama/llama-3.1-70b-instruct(gratis)google/gemini-flash-1.5(gratis con límites)También soporta modelos de pago como Claude, GPT-4, etc.
📚 Documentación
Todo está documentado en el código con comentarios JSDoc.
Ready to merge! 🎉