UntilDot commited on
Commit
acbdb83
·
verified ·
1 Parent(s): a7878ab

Update templates/docs.html

Browse files
Files changed (1) hide show
  1. templates/docs.html +94 -110
templates/docs.html CHANGED
@@ -14,110 +14,97 @@
14
  <button id="themeToggle" class="bg-blue px-3 py-1 rounded text-fg0 hover:bg-purple transition">🌙</button>
15
  <button id="langToggle" class="bg-blue px-3 py-1 rounded text-fg0 hover:bg-purple transition">🌐</button>
16
  </div>
17
- <a href="/" class="bg-blue px-4 py-1 rounded text-fg0 hover:bg-purple transition">← Back to Chat</a>
18
  </header>
19
 
20
- <main class="p-8 max-w-4xl w-full flex flex-col space-y-8 items-center text-center overflow-y-auto">
21
 
22
- <section id="en" class="space-y-8">
23
- <h1 class="text-3xl font-bold">MoA Chat - Documentation</h1>
24
 
25
- <p><strong>MoA Chat</strong> is an experimental project inspired by the MoA (Mixture of Agents) technique where multiple AI models collaborate to produce better answers.</p>
26
-
27
- <img src="https://github.com/togethercomputer/MoA/blob/main/assets/moa-explained.png?raw=true" alt="MoA Architecture" class="w-full max-w-2xl rounded shadow">
 
 
 
 
 
 
28
 
29
- <h2 class="text-2xl font-semibold">🚀 Features</h2>
30
  <ul class="list-disc list-inside text-left">
31
- <li>Connects multiple LLMs simultaneously</li>
32
- <li>Uses a fourth LLM as an aggregator</li>
33
- <li>Fully open source and self-hostable</li>
34
- <li>Built using Python and Flask</li>
35
- <li>Deployed easily on Hugging Face Spaces</li>
 
 
36
  </ul>
37
 
38
- <h2 class="text-2xl font-semibold">⚙️ How to Self-Host</h2>
39
- <p>To clone this project and run it manually:</p>
40
- <pre><code>git clone https://huggingface.co/spaces/UntilDot/Flask
41
- cd Flask
42
- python3 -m venv venv
43
- source venv/bin/activate
44
- pip install -r requirements.txt
45
- python app.py</code></pre>
46
-
47
- <p>If you wish to use Docker (advanced users):</p>
48
- <pre><code>docker build -t moa-chat .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  docker run -d -p 7860:7860 --env-file .env moa-chat</code></pre>
 
 
 
 
 
50
 
51
- <h2 class="text-2xl font-semibold">🔑 API Keys</h2>
52
- <p>The system uses secrets for security. You must define these keys in your Hugging Face Space settings or your .env file:</p>
53
- <pre><code>OPENROUTER_API_KEY=your-openrouter-key
54
- GROK_API_KEY=your-grok-key
55
  TOGETHER_API_KEY=your-together-key
 
56
  GROQ_API_KEY=your-groq-key</code></pre>
57
-
58
- <h2 class="text-2xl font-semibold">🛠️ Adding More Models</h2>
59
- <p>To add new models, edit <code>llm/model_config.json</code> like this:</p>
60
- <pre><code>{
61
- "providers": {
62
- "openrouter": {
63
- "url": "https://openrouter.ai/api/v1/chat/completions",
64
- "key_env": "OPENROUTER_API_KEY"
65
- }
66
- },
67
- "models": {
68
- "deepseek/deepseek-chat-v3-0324:free": "openrouter"
69
- }
70
- }</code></pre>
71
-
72
- <p>Each model must point to a provider. Each provider defines its own endpoint and required secret.</p>
73
-
74
- <h2 class="text-2xl font-semibold">📖 License</h2>
75
- <p>This project is licensed under <strong>Apache 2.0</strong>.</p>
76
-
77
- <footer class="text-sm opacity-70 pt-8">
78
- Made with ❤️ in Panamá
79
- </footer>
80
- </section>
81
-
82
- <section id="es" class="space-y-8 hidden">
83
- <h1 class="text-3xl font-bold">MoA Chat - Documentación</h1>
84
-
85
- <p><strong>MoA Chat</strong> es un proyecto experimental inspirado en la técnica MoA (Mixture of Agents), donde varios modelos de IA colaboran para generar mejores respuestas.</p>
86
-
87
- <img src="https://github.com/togethercomputer/MoA/blob/main/assets/moa-explained.png?raw=true" alt="Arquitectura MoA" class="w-full max-w-2xl rounded shadow">
88
-
89
- <h2 class="text-2xl font-semibold">🚀 Características</h2>
90
  <ul class="list-disc list-inside text-left">
91
- <li>Conecta múltiples LLMs simultáneamente</li>
92
- <li>Utiliza un cuarto LLM como agregador</li>
93
- <li>Completamente open source y autohospedable</li>
94
- <li>Construido con Python y Flask</li>
95
- <li>Desplegado fácilmente en Hugging Face Spaces</li>
96
  </ul>
97
 
98
- <h2 class="text-2xl font-semibold">⚙️ Cómo Autohospedar</h2>
99
- <p>Para clonar y ejecutar este proyecto manualmente:</p>
100
- <pre><code>git clone https://huggingface.co/spaces/UntilDot/Flask
101
- cd Flask
102
- python3 -m venv venv
103
- source venv/bin/activate
104
- pip install -r requirements.txt
105
- python app.py</code></pre>
106
-
107
- <p>O si deseas usar Docker (usuarios avanzados):</p>
108
- <pre><code>docker build -t moa-chat .
109
- docker run -d -p 7860:7860 --env-file .env moa-chat</code></pre>
110
-
111
- <h2 class="text-2xl font-semibold">🔑 Llaves API</h2>
112
- <p>Debes definir las llaves API en la configuración del espacio o en tu archivo <code>.env</code>:</p>
113
- <pre><code>OPENROUTER_API_KEY=tu-clave-openrouter
114
- GROK_API_KEY=tu-clave-grok
115
- TOGETHER_API_KEY=tu-clave-together
116
- GROQ_API_KEY=tu-clave-groq</code></pre>
117
-
118
- <h2 class="text-2xl font-semibold">🛠️ Agregar Modelos</h2>
119
- <p>Para agregar modelos, edita <code>llm/model_config.json</code> así:</p>
120
- <pre><code>{
121
  "providers": {
122
  "openrouter": {
123
  "url": "https://openrouter.ai/api/v1/chat/completions",
@@ -128,34 +115,31 @@ GROQ_API_KEY=tu-clave-groq</code></pre>
128
  "deepseek/deepseek-chat-v3-0324:free": "openrouter"
129
  }
130
  }</code></pre>
 
 
 
 
 
 
 
131
 
132
- <p>Cada modelo debe apuntar a un proveedor que define el endpoint y la clave secreta necesaria.</p>
 
133
 
134
- <h2 class="text-2xl font-semibold">📖 Licencia</h2>
135
- <p>Este proyecto está licenciado bajo <strong>Apache 2.0</strong>.</p>
136
 
137
- <footer class="text-sm opacity-70 pt-8">
138
- Hecho con ❤️ en Panamá
 
 
 
 
139
  </footer>
140
  </section>
141
 
142
  </main>
143
 
144
- <script>
145
- const themeToggle = document.getElementById('themeToggle');
146
- themeToggle.addEventListener('click', () => {
147
- document.documentElement.classList.toggle('dark');
148
- themeToggle.textContent = document.documentElement.classList.contains('dark') ? '🌙' : '☀️';
149
- });
150
-
151
- const langToggle = document.getElementById('langToggle');
152
- const en = document.getElementById('en');
153
- const es = document.getElementById('es');
154
- langToggle.addEventListener('click', () => {
155
- en.classList.toggle('hidden');
156
- es.classList.toggle('hidden');
157
- });
158
- </script>
159
 
160
  </body>
161
- </html>
 
14
  <button id="themeToggle" class="bg-blue px-3 py-1 rounded text-fg0 hover:bg-purple transition">🌙</button>
15
  <button id="langToggle" class="bg-blue px-3 py-1 rounded text-fg0 hover:bg-purple transition">🌐</button>
16
  </div>
17
+ <a href="/" class="bg-blue px-3 py-1 rounded text-fg0 hover:bg-purple transition duration-300" style="background-color: var(--blue) !important; color: var(--fg1) !important; font-weight: 700; letter-spacing: 0.25px;">← Back to Chat</a>
18
  </header>
19
 
20
+ <main class="p-8 max-w-6xl w-full flex flex-col space-y-8 items-center text-justify overflow-y-auto mx-auto">
21
 
22
+ <section id="content" class="space-y-8 mt-0">
23
+ <h1 class="text-3xl font-bold text-center pt-4" data-i18n="title">MoA Chat - Documentation</h1>
24
 
25
+ <h2 class="text-2xl font-bold border-b-2 pb-2" style="border-color: var(--blue);" data-i18n="what_is_title">📖 What is MoA Chat?</h2>
26
+ <p data-i18n="intro"><strong>MoA Chat</strong> 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.</p>
27
+ <ul class="list-disc list-inside text-left">
28
+ <li data-i18n="tech_1">Built in <strong>Python 3</strong>.</li>
29
+ <li data-i18n="tech_2">Web framework: <strong>Flask</strong>.</li>
30
+ <li data-i18n="tech_3">Frontend: HTML, JavaScript, TailwindCSS (optionally removable).</li>
31
+ <li data-i18n="tech_4">Designed to work <strong>first on Hugging Face Spaces</strong>, but can also be <strong>self-hosted</strong>.</li>
32
+ </ul>
33
+ <img src="https://github.com/togethercomputer/MoA/blob/main/assets/moa-explained.png?raw=true" alt="MoA Architecture" class="mx-auto w-full max-w-2xl rounded shadow block" data-i18n-alt="architecture_alt">
34
 
35
+ <h2 class="text-2xl font-bold border-b-2 pb-2" style="border-color: var(--blue);" data-i18n="features_title">⚙️ Features</h2>
36
  <ul class="list-disc list-inside text-left">
37
+ <li data-i18n="feature_1">Send your question once — multiple AI models answer simultaneously.</li>
38
+ <li data-i18n="feature_2">Aggregator model (LLM-D) summarizes all responses.</li>
39
+ <li data-i18n="feature_3">Fully configurable: choose which models you want to use.</li>
40
+ <li data-i18n="feature_4">Modern minimal UI with light/dark theme toggle.</li>
41
+ <li data-i18n="feature_5">Spanish/English documentation switch.</li>
42
+ <li data-i18n="feature_6"><strong>Free models</strong> supported through <strong>OpenRouter</strong> and others.</li>
43
+ <li data-i18n="feature_7"><strong>No API keys exposed</strong> in the frontend (safe backend request).</li>
44
  </ul>
45
 
46
+ <h2 class="text-2xl font-bold border-b-2 pb-2" style="border-color: var(--blue);" data-i18n="self_host_title">🛠️ Self Hosting</h2>
47
+ <p data-i18n="self_host_intro">You can clone the project like this (includes the Dockerfile for containerization):</p>
48
+ <pre class="code-block"><code>git clone https://huggingface.co/spaces/UntilDot/Flask</code></pre>
49
+ <h3 data-i18n="requirements_title">Requirements:</h3>
50
+ <ul class="list-disc list-inside text-left">
51
+ <li data-i18n="req_1">Python 3.11+</li>
52
+ <li data-i18n="req_2">Pip</li>
53
+ <li data-i18n="req_3">Create a <code>.env</code> file and add your API keys.</li>
54
+ </ul>
55
+ <h3 data-i18n="install_title">Install dependencies:</h3>
56
+ <pre class="code-block"><code>pip install -r requirements.txt</code></pre>
57
+ <h3 data-i18n="run_title">Run locally:</h3>
58
+ <pre class="code-block"><code>python app.py</code></pre>
59
+ <p data-i18n="port_note">Default port is <strong>7860</strong> (to match Hugging Face standard).</p>
60
+ <h3 class="text-xl font-semibold underline" data-i18n="docker_title">🐳 Docker support:</h3>
61
+ <p data-i18n="docker_intro">Your repository includes a <code>Dockerfile</code> for easy containerization when you clone it. Here's the content:</p>
62
+ <pre class="code-block"><code># Use a slim Python base
63
+ FROM python:3.11-slim
64
+
65
+ # Set working directory
66
+ WORKDIR /app
67
+
68
+ # Install dependencies
69
+ COPY requirements.txt ./
70
+ RUN pip install --no-cache-dir -r requirements.txt
71
+
72
+ # Copy source code
73
+ COPY . .
74
+
75
+ # Expose the default Hugging Face Spaces port
76
+ EXPOSE 7860
77
+
78
+ # Run the app
79
+ CMD ["python", "app.py"]</code></pre>
80
+ <p data-i18n="docker_alt_option">Alternatively, you can manually create your own <code>Dockerfile</code> with the above content if you prefer to customize it.</p>
81
+ <p data-i18n="docker_build">To build and run the Docker container after cloning the repository:</p>
82
+ <pre class="code-block"><code>docker build -t moa-chat .
83
  docker run -d -p 7860:7860 --env-file .env moa-chat</code></pre>
84
+ <p data-i18n="docker_secrets_note">Docker will NOT automatically inject secrets unless you:</p>
85
+ <ul class="list-disc list-inside text-left">
86
+ <li data-i18n="docker_secret_env">Use a <code>.env</code> file with <code>--env-file .env</code></li>
87
+ <li data-i18n="docker_secret_manual">Manually use <code>-e VAR=VALUE</code> flags in <code>docker run</code></li>
88
+ </ul>
89
 
90
+ <h2 class="text-2xl font-bold border-b-2 pb-2" style="border-color: var(--blue);" data-i18n="api_keys_title">🔑 Environment Variables (Secrets)</h2>
91
+ <p data-i18n="api_keys_intro">To use this app, you must set your API keys in <strong>secrets</strong> or <strong>environment variables</strong>.</p>
92
+ <p data-i18n="api_keys_syntax">Follow this syntax:</p>
93
+ <pre class="code-block"><code data-i18n="api_keys_code">OPENROUTER_API_KEY=your-openrouter-key
94
  TOGETHER_API_KEY=your-together-key
95
+ GROK_API_KEY=your-grok-key
96
  GROQ_API_KEY=your-groq-key</code></pre>
97
+ <p data-i18n="api_keys_location">You can set these in:</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  <ul class="list-disc list-inside text-left">
99
+ <li data-i18n="api_loc_1">Hugging Face <strong>Secrets</strong> section (recommended if on Spaces)</li>
100
+ <li data-i18n="api_loc_2"><code>.env</code> file (only for self-hosting)</li>
 
 
 
101
  </ul>
102
 
103
+ <h2 class="text-2xl font-bold border-b-2 pb-2" style="border-color: var(--blue);" data-i18n="add_models_title">🧩 How to Add More Models</h2>
104
+ <p data-i18n="add_models_intro">All models and providers are declared inside:</p>
105
+ <pre class="code-block"><code>llm/model_config.json</code></pre>
106
+ <p data-i18n="add_models_structure">The structure looks like this:</p>
107
+ <pre class="code-block"><code>{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  "providers": {
109
  "openrouter": {
110
  "url": "https://openrouter.ai/api/v1/chat/completions",
 
115
  "deepseek/deepseek-chat-v3-0324:free": "openrouter"
116
  }
117
  }</code></pre>
118
+ <p data-i18n="add_models_steps_title"><strong>To add a new model:</strong></p>
119
+ <ul class="list-disc list-inside text-left">
120
+ <li data-i18n="add_step_1">Find the right provider (OpenRouter, Together, Grok, Groq, etc).</li>
121
+ <li data-i18n="add_step_2">Add its endpoint URL under "providers" if not already listed.</li>
122
+ <li data-i18n="add_step_3">Add your model name under "models" section, linking it to the provider.</li>
123
+ </ul>
124
+ <p data-i18n="add_models_note">Make sure your environment variables (secrets) are correctly configured.</p>
125
 
126
+ <h2 class="text-2xl font-bold border-b-2 pb-2" style="border-color: var(--blue);" data-i18n="license_title">🏷️ Licensing</h2>
127
+ <p data-i18n="license_text">This project is licensed under <strong>Apache 2.0</strong> — You are free to use, modify, and distribute, even commercially.</p>
128
 
129
+
 
130
 
131
+ <footer class="text-sm opacity-70 pt-8 text-center" data-i18n="footer">
132
+ Made with ❤️ in Panamá<br>by UntilDot
133
+ <div class="mt-2 flex justify-center">
134
+ <span class="mx-2">✨</span>
135
+ <span class="mx-2">✨</span>
136
+ </div>
137
  </footer>
138
  </section>
139
 
140
  </main>
141
 
142
+ <script src="/static/docs.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
  </body>
145
+ </html>