const themeToggle = document.getElementById('themeToggle'); themeToggle.addEventListener('click', () => { document.documentElement.classList.toggle('dark'); themeToggle.textContent = document.documentElement.classList.contains('dark') ? '🌙' : '☀️'; }); const langToggle = document.getElementById('langToggle'); let currentLang = 'en'; const translations = { en: { title: "MoA Chat - Documentation", what_is_title: "📖 What is MoA Chat?", intro: "MoA Chat is a simple but powerful chat platform where multiple AI models answer the same question at the same time, and an aggregator model combines their outputs into one final answer.", tech_1: "Built in Python 3.", tech_2: "Web framework: Flask.", tech_3: "Frontend: HTML, JavaScript, TailwindCSS (optionally removable).", tech_4: "Designed to work first on Hugging Face Spaces, but can also be self-hosted.", architecture_alt: "MoA Architecture", features_title: "⚙️ Features", feature_1: "Send your question once — multiple AI models answer simultaneously.", feature_2: "Aggregator model (LLM-D) summarizes all responses.", feature_3: "Fully configurable: choose which models you want to use.", feature_4: "Modern minimal UI with light/dark theme toggle.", feature_5: "Spanish/English documentation switch.", feature_6: "Free models supported through OpenRouter and others.", feature_7: "No API keys exposed in the frontend (safe backend request).", self_host_title: "🛠️ Self Hosting", self_host_intro: "You can clone the project like this:", requirements_title: "Requirements:", req_1: "Python 3.11+", req_2: "Pip", req_3: "Create a .env file and add your API keys.", install_title: "Install dependencies:", run_title: "Run locally:", port_note: "Default port is 7860 (to match Hugging Face standard).", docker_title: "🐳 Docker support:", docker_intro: "Your repository includes a Dockerfile for easy containerization when you clone it. Here's the content:", docker_alt_option: "Alternatively, you can manually create your own Dockerfile with the above content if you prefer to customize it.", docker_build: "To build and run the Docker container after cloning the repository:", docker_secrets_note: "Docker will NOT automatically inject secrets unless you:", docker_secret_env: "Use a .env file with --env-file .env", docker_secret_manual: "Manually use -e VAR=VALUE flags in docker run", api_keys_title: "🔑 Environment Variables (Secrets)", api_keys_intro: "To use this app, you must set your API keys in secrets or environment variables.", api_keys_syntax: "Follow this syntax:", api_keys_code: "OPENROUTER_API_KEY=your-openrouter-key\nTOGETHER_API_KEY=your-together-key\nGROK_API_KEY=your-grok-key\nGROQ_API_KEY=your-groq-key", api_keys_location: "You can set these in:", api_loc_1: "Hugging Face Secrets section (recommended if on Spaces)", api_loc_2: ".env file (only for self-hosting)", add_models_title: "🧩 How to Add More Models", add_models_intro: "All models and providers are declared inside:", add_models_structure: "The structure looks like this:", add_models_steps_title: "To add a new model:", add_step_1: "Find the right provider (OpenRouter, Together, Grok, Groq, etc).", add_step_2: "Add its endpoint URL under \"providers\" if not already listed.", add_step_3: "Add your model name under \"models\" section, linking it to the provider.", add_models_note: "Make sure your environment variables (secrets) are correctly configured.", license_title: "🏷️ Licensing", license_text: "This project is licensed under Apache 2.0 — You are free to use, modify, and distribute, even commercially.", footer: "Made with ❤️ in Panamá
by UntilDot\n
\n \n \n
" }, es: { title: "MoA Chat - Documentación", what_is_title: "📖 ¿Qué es MoA Chat?", intro: "MoA Chat es una plataforma de chat simple pero poderosa donde múltiples modelos de IA responden la misma pregunta al mismo tiempo, y un modelo agregador combina sus resultados en una respuesta final.", tech_1: "Construido en Python 3.", tech_2: "Framework web: Flask.", tech_3: "Frontend: HTML, JavaScript, TailwindCSS (opcionalmente removible).", tech_4: "Diseñado para funcionar primero en Hugging Face Spaces, pero también puede ser autohospedado.", architecture_alt: "Arquitectura MoA", features_title: "⚙️ Características", feature_1: "Envía tu pregunta una vez — múltiples modelos de IA responden simultáneamente.", feature_2: "Modelo agregador (LLM-D) resume todas las respuestas.", feature_3: "Completamente configurable: elige qué modelos deseas usar.", feature_4: "Interfaz de usuario minimalista moderna con cambio de tema claro/oscuro.", feature_5: "Cambio de documentación entre español/inglés.", feature_6: "Modelos gratuitos soportados a través de OpenRouter y otros.", feature_7: "Sin claves API expuestas en el frontend (solicitud segura al backend).", self_host_title: "🛠️ Autohospedaje", self_host_intro: "Puedes clonar el proyecto así:", requirements_title: "Requisitos:", req_1: "Python 3.11+", req_2: "Pip", req_3: "Crea un archivo .env y agrega tus claves API.", install_title: "Instalar dependencias:", run_title: "Ejecutar localmente:", port_note: "El puerto predeterminado es 7860 (para coincidir con el estándar de Hugging Face).", docker_title: "🐳 Soporte para Docker:", docker_intro: "Tu repositorio incluye un Dockerfile para una fácil containerización cuando lo clonas. Aquí está el contenido:", docker_alt_option: "Alternativamente, puedes crear manualmente tu propio Dockerfile con el contenido anterior si prefieres personalizarlo.", docker_build: "Para construir y ejecutar el contenedor Docker después de clonar el repositorio:", docker_secrets_note: "Docker NO inyectará automáticamente los secretos a menos que:", docker_secret_env: "Uses un archivo .env con --env-file .env", docker_secret_manual: "Uses manualmente banderas -e VAR=VALUE en docker run", api_keys_title: "🔑 Variables de Entorno (Secretos)", api_keys_intro: "Para usar esta aplicación, debes configurar tus claves API en secretos o variables de entorno.", api_keys_syntax: "Sigue esta sintaxis:", api_keys_code: "OPENROUTER_API_KEY=tu-clave-openrouter\nTOGETHER_API_KEY=tu-clave-together\nGROK_API_KEY=tu-clave-grok\nGROQ_API_KEY=tu-clave-groq", api_keys_location: "Puedes configurarlas en:", api_loc_1: "Sección de Secretos de Hugging Face (recomendado si estás en Spaces)", api_loc_2: "Archivo .env (solo para autohospedaje)", add_models_title: "🧩 Cómo Agregar Más Modelos", add_models_intro: "Todos los modelos y proveedores se declaran dentro de:", add_models_structure: "La estructura se ve así:", add_models_steps_title: "Para agregar un nuevo modelo:", add_step_1: "Encuentra el proveedor adecuado (OpenRouter, Together, Grok, Groq, etc).", add_step_2: "Agrega su URL de endpoint bajo \"providers\" si no está ya listado.", add_step_3: "Agrega el nombre de tu modelo bajo la sección \"models\", vinculándolo al proveedor.", add_models_note: "Asegúrate de que tus variables de entorno (secretos) estén correctamente configuradas.", license_title: "🏷️ Licenciamiento", license_text: "Este proyecto está licenciado bajo Apache 2.0 — Eres libre de usar, modificar y distribuir, incluso comercialmente.", footer: "Hecho con ❤️ en Panamá
por UntilDot\n
\n \n \n
" } }; function updateLanguage(lang) { document.querySelectorAll('[data-i18n]').forEach(element => { const key = element.getAttribute('data-i18n'); if (translations[lang][key]) { element.innerHTML = translations[lang][key]; } }); document.querySelectorAll('[data-i18n-alt]').forEach(element => { const key = element.getAttribute('data-i18n-alt'); if (translations[lang][key]) { element.setAttribute('alt', translations[lang][key]); } }); document.querySelectorAll('code[data-i18n]').forEach(element => { const key = element.getAttribute('data-i18n'); if (translations[lang][key]) { element.textContent = translations[lang][key]; } }); } langToggle.addEventListener('click', () => { currentLang = currentLang === 'en' ? 'es' : 'en'; updateLanguage(currentLang); }); // Initialize language on load updateLanguage(currentLang);