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55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>AnyCoder AI Code Generator</title>
  <meta name="description" content="Generate, modify, and understand code with the most advanced AI models." />
  <style>
    :root {
      --bg: #0d1117;
      --bg-secondary: #161b22;
      --border: #30363d;
      --text: #c9d1d9;
      --text-muted: #8b949e;
      --accent: #58a6ff;
      --accent-hover: #79c0ff;
      --danger: #f85149;
      --success: #56d364;
      --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
      --radius: 8px;
      --transition: 0.2s ease;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.6;
      padding: 1rem;
    }

    header {
      text-align: center;
      margin-bottom: 2rem;
    }

    header h1 {
      font-size: 2.5rem;
      margin-bottom: 0.5rem;
    }

    header p {
      color: var(--text-muted);
      font-size: 1.1rem;
    }

    main {
      max-width: 900px;
      margin: 0 auto;
      display: grid;
      gap: 2rem;
    }

    section {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.5rem;
    }

    h2 {
      font-size: 1.25rem;
      margin-bottom: 1rem;
    }

    label {
      display: block;
      margin-bottom: 0.5rem;
      font-weight: 600;
    }

    select,
    input[type="file"],
    input[type="url"],
    textarea {
      width: 100%;
      padding: 0.75rem;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: var(--bg);
      color: var(--text);
      font-size: 1rem;
      transition: border-color var(--transition);
    }

    select:focus,
    input:focus,
    textarea:focus {
      outline: none;
      border-color: var(--accent);
    }

    textarea {
      resize: vertical;
      min-height: 120px;
      font-family: var(--font-mono);
    }

    .tabs {
      display: flex;
      gap: 0.5rem;
      margin-bottom: 1rem;
    }

    .tabs button {
      background: transparent;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 0.5rem 1rem;
      color: var(--text-muted);
      cursor: pointer;
      transition: background var(--transition), color var(--transition);
    }

    .tabs button[aria-selected="true"] {
      background: var(--accent);
      color: var(--bg);
      border-color: var(--accent);
    }

    .tabs button:hover:not([aria-selected="true"]) {
      background: var(--border);
      color: var(--text);
    }

    .search-toggle {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-top: 1rem;
    }

    .actions {
      display: flex;
      gap: 1rem;
      justify-content: flex-end;
    }

    button {
      padding: 0.75rem 1.5rem;
      border: none;
      border-radius: var(--radius);
      font-size: 1rem;
      cursor: pointer;
      transition: background var(--transition);
    }

    #clear {
      background: var(--border);
      color: var(--text);
    }

    #clear:hover {
      background: var(--text-muted);
    }

    #generate {
      background: var(--accent);
      color: var(--bg);
    }

    #generate:hover {
      background: var(--accent-hover);
    }

    pre {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1rem;
      overflow-x: auto;
      font-family: var(--font-mono);
      font-size: 0.9rem;
    }

    iframe {
      width: 100%;
      height: 400px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      background: #fff;
    }

    .visually-hidden {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip: rect(0 0 0 0);
      white-space: nowrap;
    }

    @media (max-width: 600px) {
      body {
        padding: 0.5rem;
      }

      header h1 {
        font-size: 2rem;
      }

      .actions {
        flex-direction: column;
      }
    }
  </style>
</head>
<body>
  <header>
    <h1>🚀 AnyCoder AI</h1>
    <p>Your AI partner for generating, modifying, and understanding code.</p>
  </header>

  <main>
    <section aria-labelledby="model-selection">
      <h2 id="model-selection">1. Select Model</h2>
      <label for="model" class="visually-hidden">AI Model</label>
      <select id="model" name="model">
        <!-- options populated by script -->
      </select>
    </section>

    <section aria-labelledby="context-input">
      <h2 id="context-input">2. Provide Context</h2>
      <div class="tabs" role="tablist">
        <button role="tab" aria-selected="true" id="tab-prompt" aria-controls="panel-prompt">Prompt</button>
        <button role="tab" aria-selected="false" id="tab-file" aria-controls="panel-file">File</button>
        <button role="tab" aria-selected="false" id="tab-website" aria-controls="panel-website">Website</button>
      </div>

      <div role="tabpanel" id="panel-prompt">
        <textarea id="prompt" placeholder="Describe what you want to build…" aria-label="Prompt input"></textarea>
      </div>
      <div role="tabpanel" id="panel-file" hidden>
        <label for="reference-file">Reference File</label>
        <input type="file" id="reference-file" accept=".pdf,.docx,.txt" />
      </div>
      <div role="tabpanel" id="panel-website" hidden>
        <label for="website-url">Website URL</label>
        <input type="url" id="website-url" placeholder="https://example.com" />
      </div>
    </section>

    <section aria-labelledby="output-config">
      <h2 id="output-config">3. Configure Output</h2>
      <label for="language">Target Language</label>
      <select id="language">
        <option value="html">HTML</option>
        <option value="python">Python</option>
        <option value="javascript">JavaScript</option>
        <option value="transformers.js">Transformers.js</option>
      </select>
      <div class="search-toggle">
        <input type="checkbox" id="web-search" />
        <label for="web-search">Enable Web Search</label>
      </div>
    </section>

    <section class="actions">
      <button id="clear" type="button">Clear Session</button>
      <button id="generate" type="button">Generate Code</button>
    </section>

    <section aria-labelledby="output-tabs">
      <h2 id="output-tabs" class="visually-hidden">Output</h2>
      <div class="tabs" role="tablist">
        <button role="tab" aria-selected="true" id="tab-code" aria-controls="panel-code">Code</button>
        <button role="tab" aria-selected="false" id="tab-preview" aria-controls="panel-preview">Live Preview</button>
        <button role="tab" aria-selected="false" id="tab-history" aria-controls="panel-history">History</button>
      </div>

      <div role="tabpanel" id="panel-code">
        <pre><code id="code-output" class="language-html">&lt;/&gt;</code></pre>
      </div>
      <div role="tabpanel" id="panel-preview" hidden>
        <iframe id="preview" title="Live preview" sandbox="allow-scripts allow-same-origin"></iframe>
      </div>
      <div role="tabpanel" id="panel-history" hidden>
        <ul id="history-list" aria-live="polite"></ul>
      </div>
    </section>
  </main>

  <script>
    // Model definitions
    const AVAILABLE_MODELS = [
      {
        name: "Qwen/Qwen3-32B",
        id: "Qwen/Qwen3-32B",
        description: "Qwen3-32B model for code generation and general tasks"
      },
      {
        name: "Moonshot Kimi-K2",
        id: "moonshotai/Kimi-K2-Instruct",
        description: "Moonshot AI Kimi-K2-Instruct model for code generation and general tasks",
        default_provider: "groq"
      },
      {
        name: "DeepSeek V3",
        id: "deepseek-ai/DeepSeek-V3-0324",
        description: "DeepSeek V3 model for code generation"
      },
      {
        name: "DeepSeek R1",
        id: "deepseek-ai/DeepSeek-R1-0528",
        description: "DeepSeek R1 model for code generation"
      },
      {
        name: "ERNIE-4.5-VL",
        id: "baidu/ERNIE-4.5-VL-424B-A47B-Base-PT",
        description: "ERNIE-4.5-VL model for multimodal code generation with image support"
      },
      {
        name: "MiniMax M1",
        id: "MiniMaxAI/MiniMax-M1-80k",
        description: "MiniMax M1 model for code generation and general tasks"
      },
      {
        name: "Qwen3-235B-A22B",
        id: "Qwen/Qwen3-235B-A22B",
        description: "Qwen3-235B-A22B model for code generation and general tasks"
      },
      {
        name: "SmolLM3-3B",
        id: "HuggingFaceTB/SmolLM3-3B",
        description: "SmolLM3-3B model for code generation and general tasks"
      },
      {
        name: "GLM-4.1V-9B-Thinking",
        id: "THUDM/GLM-4.1V-9B-Thinking",
        description: "GLM-4.1V-9B-Thinking model for multimodal code generation with image support"
      },
      {
        name: "OpenAI GPT-4",
        id: "openai/gpt-4",
        description: "OpenAI GPT-4 model via HF Inference Providers",
        default_provider: "openai"
      },
      {
        name: "Gemini Pro",
        id: "gemini/pro",
        description: "Google Gemini Pro model via HF Inference Providers",
        default_provider: "gemini"
      },
      {
        name: "Fireworks AI",
        id: "fireworks-ai/fireworks-v1",
        description: "Fireworks AI model via HF Inference Providers",
        default_provider: "fireworks"
      }
    ];

    // Populate model dropdown
    const modelSelect = document.getElementById('model');
    AVAILABLE_MODELS.forEach(model => {
      const option = document.createElement('option');
      option.value = model.id;
      option.textContent = model.name;
      option.title = model.description;
      modelSelect.appendChild(option);
    });

    // Tab functionality
    function setupTabs(tabContainerSelector) {
      const tabContainer = document.querySelector(tabContainerSelector);
      const tabs = tabContainer.querySelectorAll('[role="tab"]');
      const panels = tabContainer.parentElement.querySelectorAll('[role="tabpanel"]');

      tabs.forEach(tab => {
        tab.addEventListener('click', () => {
          tabs.forEach(t => {
            t.setAttribute('aria-selected', 'false');
            t.tabIndex = -1;
          });
          tab.setAttribute('aria-selected', 'true');
          tab.tabIndex = 0;

          panels.forEach(panel => {
            panel.hidden = true;
            if (panel.id === tab.getAttribute('aria-controls')) {
              panel.hidden = false;
            }
          });
        });
      });
    }

    setupTabs('.tabs[role="tablist"]');

    // Clear session
    document.getElementById('clear').addEventListener('click', () => {
      document.getElementById('prompt').value = '';
      document.getElementById('reference-file').value = '';
      document.getElementById('website-url').value = '';
      document.getElementById('code-output').textContent = '</>';
      document.getElementById('preview').srcdoc = '';
      document.getElementById('history-list').innerHTML = '';
    });

    // Generate code (stub)
    document.getElementById('generate').addEventListener('click', () => {
      const prompt = document.getElementById('prompt').value.trim();
      const language = document.getElementById('language').value;
      if (!prompt) {
        alert('Please provide a prompt.');
        return;
      }
      // Simulate generation
      const code = `// Generated ${language} code\n// Prompt: ${prompt}\n\nconsole.log('Hello, AnyCoder AI!');`;
      document.getElementById('code-output').textContent = code;
      document.getElementById('preview').srcdoc = `<pre>${code}</pre>`;
      const li = document.createElement('li');
      li.textContent = new Date().toLocaleTimeString() + ' - ' + prompt.substring(0, 30) + '...';
      document.getElementById('history-list').prepend(li);
    });
  </script>
</body>
</html>