Update index.html
Browse files- index.html +407 -18
index.html
CHANGED
|
@@ -1,30 +1,419 @@
|
|
| 1 |
-
--- index.html ---
|
| 2 |
-
```html
|
| 3 |
<!DOCTYPE html>
|
| 4 |
<html lang="en">
|
| 5 |
<head>
|
| 6 |
-
<meta charset="UTF-8"
|
| 7 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0"
|
| 8 |
-
<title>
|
| 9 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<header>
|
| 13 |
-
<h1
|
|
|
|
| 14 |
</header>
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
<
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
<
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
</main>
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
</body>
|
| 30 |
</html>
|
|
|
|
|
|
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>AnyCoder AI Code Generator</title>
|
| 7 |
+
<meta name="description" content="Generate, modify, and understand code with the most advanced AI models." />
|
| 8 |
+
<style>
|
| 9 |
+
:root {
|
| 10 |
+
--bg: #0d1117;
|
| 11 |
+
--bg-secondary: #161b22;
|
| 12 |
+
--border: #30363d;
|
| 13 |
+
--text: #c9d1d9;
|
| 14 |
+
--text-muted: #8b949e;
|
| 15 |
+
--accent: #58a6ff;
|
| 16 |
+
--accent-hover: #79c0ff;
|
| 17 |
+
--danger: #f85149;
|
| 18 |
+
--success: #56d364;
|
| 19 |
+
--font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
| 20 |
+
--radius: 8px;
|
| 21 |
+
--transition: 0.2s ease;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
* {
|
| 25 |
+
box-sizing: border-box;
|
| 26 |
+
margin: 0;
|
| 27 |
+
padding: 0;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
body {
|
| 31 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
| 32 |
+
background: var(--bg);
|
| 33 |
+
color: var(--text);
|
| 34 |
+
line-height: 1.6;
|
| 35 |
+
padding: 1rem;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
header {
|
| 39 |
+
text-align: center;
|
| 40 |
+
margin-bottom: 2rem;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
header h1 {
|
| 44 |
+
font-size: 2.5rem;
|
| 45 |
+
margin-bottom: 0.5rem;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
header p {
|
| 49 |
+
color: var(--text-muted);
|
| 50 |
+
font-size: 1.1rem;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
main {
|
| 54 |
+
max-width: 900px;
|
| 55 |
+
margin: 0 auto;
|
| 56 |
+
display: grid;
|
| 57 |
+
gap: 2rem;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
section {
|
| 61 |
+
background: var(--bg-secondary);
|
| 62 |
+
border: 1px solid var(--border);
|
| 63 |
+
border-radius: var(--radius);
|
| 64 |
+
padding: 1.5rem;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
h2 {
|
| 68 |
+
font-size: 1.25rem;
|
| 69 |
+
margin-bottom: 1rem;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
label {
|
| 73 |
+
display: block;
|
| 74 |
+
margin-bottom: 0.5rem;
|
| 75 |
+
font-weight: 600;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
select,
|
| 79 |
+
input[type="file"],
|
| 80 |
+
input[type="url"],
|
| 81 |
+
textarea {
|
| 82 |
+
width: 100%;
|
| 83 |
+
padding: 0.75rem;
|
| 84 |
+
border: 1px solid var(--border);
|
| 85 |
+
border-radius: var(--radius);
|
| 86 |
+
background: var(--bg);
|
| 87 |
+
color: var(--text);
|
| 88 |
+
font-size: 1rem;
|
| 89 |
+
transition: border-color var(--transition);
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
select:focus,
|
| 93 |
+
input:focus,
|
| 94 |
+
textarea:focus {
|
| 95 |
+
outline: none;
|
| 96 |
+
border-color: var(--accent);
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
textarea {
|
| 100 |
+
resize: vertical;
|
| 101 |
+
min-height: 120px;
|
| 102 |
+
font-family: var(--font-mono);
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
.tabs {
|
| 106 |
+
display: flex;
|
| 107 |
+
gap: 0.5rem;
|
| 108 |
+
margin-bottom: 1rem;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.tabs button {
|
| 112 |
+
background: transparent;
|
| 113 |
+
border: 1px solid var(--border);
|
| 114 |
+
border-radius: var(--radius);
|
| 115 |
+
padding: 0.5rem 1rem;
|
| 116 |
+
color: var(--text-muted);
|
| 117 |
+
cursor: pointer;
|
| 118 |
+
transition: background var(--transition), color var(--transition);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.tabs button[aria-selected="true"] {
|
| 122 |
+
background: var(--accent);
|
| 123 |
+
color: var(--bg);
|
| 124 |
+
border-color: var(--accent);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.tabs button:hover:not([aria-selected="true"]) {
|
| 128 |
+
background: var(--border);
|
| 129 |
+
color: var(--text);
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.search-toggle {
|
| 133 |
+
display: flex;
|
| 134 |
+
align-items: center;
|
| 135 |
+
gap: 0.5rem;
|
| 136 |
+
margin-top: 1rem;
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
.actions {
|
| 140 |
+
display: flex;
|
| 141 |
+
gap: 1rem;
|
| 142 |
+
justify-content: flex-end;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
button {
|
| 146 |
+
padding: 0.75rem 1.5rem;
|
| 147 |
+
border: none;
|
| 148 |
+
border-radius: var(--radius);
|
| 149 |
+
font-size: 1rem;
|
| 150 |
+
cursor: pointer;
|
| 151 |
+
transition: background var(--transition);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
#clear {
|
| 155 |
+
background: var(--border);
|
| 156 |
+
color: var(--text);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
#clear:hover {
|
| 160 |
+
background: var(--text-muted);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
#generate {
|
| 164 |
+
background: var(--accent);
|
| 165 |
+
color: var(--bg);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
#generate:hover {
|
| 169 |
+
background: var(--accent-hover);
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
pre {
|
| 173 |
+
background: var(--bg);
|
| 174 |
+
border: 1px solid var(--border);
|
| 175 |
+
border-radius: var(--radius);
|
| 176 |
+
padding: 1rem;
|
| 177 |
+
overflow-x: auto;
|
| 178 |
+
font-family: var(--font-mono);
|
| 179 |
+
font-size: 0.9rem;
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
iframe {
|
| 183 |
+
width: 100%;
|
| 184 |
+
height: 400px;
|
| 185 |
+
border: 1px solid var(--border);
|
| 186 |
+
border-radius: var(--radius);
|
| 187 |
+
background: #fff;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.visually-hidden {
|
| 191 |
+
position: absolute;
|
| 192 |
+
width: 1px;
|
| 193 |
+
height: 1px;
|
| 194 |
+
overflow: hidden;
|
| 195 |
+
clip: rect(0 0 0 0);
|
| 196 |
+
white-space: nowrap;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
@media (max-width: 600px) {
|
| 200 |
+
body {
|
| 201 |
+
padding: 0.5rem;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
header h1 {
|
| 205 |
+
font-size: 2rem;
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
.actions {
|
| 209 |
+
flex-direction: column;
|
| 210 |
+
}
|
| 211 |
+
}
|
| 212 |
+
</style>
|
| 213 |
</head>
|
| 214 |
<body>
|
| 215 |
<header>
|
| 216 |
+
<h1>🚀 AnyCoder AI</h1>
|
| 217 |
+
<p>Your AI partner for generating, modifying, and understanding code.</p>
|
| 218 |
</header>
|
| 219 |
+
|
| 220 |
+
<main>
|
| 221 |
+
<section aria-labelledby="model-selection">
|
| 222 |
+
<h2 id="model-selection">1. Select Model</h2>
|
| 223 |
+
<label for="model" class="visually-hidden">AI Model</label>
|
| 224 |
+
<select id="model" name="model">
|
| 225 |
+
<!-- options populated by script -->
|
| 226 |
+
</select>
|
| 227 |
+
</section>
|
| 228 |
+
|
| 229 |
+
<section aria-labelledby="context-input">
|
| 230 |
+
<h2 id="context-input">2. Provide Context</h2>
|
| 231 |
+
<div class="tabs" role="tablist">
|
| 232 |
+
<button role="tab" aria-selected="true" id="tab-prompt" aria-controls="panel-prompt">Prompt</button>
|
| 233 |
+
<button role="tab" aria-selected="false" id="tab-file" aria-controls="panel-file">File</button>
|
| 234 |
+
<button role="tab" aria-selected="false" id="tab-website" aria-controls="panel-website">Website</button>
|
| 235 |
+
</div>
|
| 236 |
+
|
| 237 |
+
<div role="tabpanel" id="panel-prompt">
|
| 238 |
+
<textarea id="prompt" placeholder="Describe what you want to build…" aria-label="Prompt input"></textarea>
|
| 239 |
+
</div>
|
| 240 |
+
<div role="tabpanel" id="panel-file" hidden>
|
| 241 |
+
<label for="reference-file">Reference File</label>
|
| 242 |
+
<input type="file" id="reference-file" accept=".pdf,.docx,.txt" />
|
| 243 |
+
</div>
|
| 244 |
+
<div role="tabpanel" id="panel-website" hidden>
|
| 245 |
+
<label for="website-url">Website URL</label>
|
| 246 |
+
<input type="url" id="website-url" placeholder="https://example.com" />
|
| 247 |
+
</div>
|
| 248 |
+
</section>
|
| 249 |
+
|
| 250 |
+
<section aria-labelledby="output-config">
|
| 251 |
+
<h2 id="output-config">3. Configure Output</h2>
|
| 252 |
+
<label for="language">Target Language</label>
|
| 253 |
+
<select id="language">
|
| 254 |
+
<option value="html">HTML</option>
|
| 255 |
+
<option value="python">Python</option>
|
| 256 |
+
<option value="javascript">JavaScript</option>
|
| 257 |
+
<option value="transformers.js">Transformers.js</option>
|
| 258 |
</select>
|
| 259 |
+
<div class="search-toggle">
|
| 260 |
+
<input type="checkbox" id="web-search" />
|
| 261 |
+
<label for="web-search">Enable Web Search</label>
|
| 262 |
+
</div>
|
| 263 |
+
</section>
|
| 264 |
+
|
| 265 |
+
<section class="actions">
|
| 266 |
+
<button id="clear" type="button">Clear Session</button>
|
| 267 |
+
<button id="generate" type="button">Generate Code</button>
|
| 268 |
+
</section>
|
| 269 |
+
|
| 270 |
+
<section aria-labelledby="output-tabs">
|
| 271 |
+
<h2 id="output-tabs" class="visually-hidden">Output</h2>
|
| 272 |
+
<div class="tabs" role="tablist">
|
| 273 |
+
<button role="tab" aria-selected="true" id="tab-code" aria-controls="panel-code">Code</button>
|
| 274 |
+
<button role="tab" aria-selected="false" id="tab-preview" aria-controls="panel-preview">Live Preview</button>
|
| 275 |
+
<button role="tab" aria-selected="false" id="tab-history" aria-controls="panel-history">History</button>
|
| 276 |
+
</div>
|
| 277 |
|
| 278 |
+
<div role="tabpanel" id="panel-code">
|
| 279 |
+
<pre><code id="code-output" class="language-html"></></code></pre>
|
| 280 |
+
</div>
|
| 281 |
+
<div role="tabpanel" id="panel-preview" hidden>
|
| 282 |
+
<iframe id="preview" title="Live preview" sandbox="allow-scripts allow-same-origin"></iframe>
|
| 283 |
+
</div>
|
| 284 |
+
<div role="tabpanel" id="panel-history" hidden>
|
| 285 |
+
<ul id="history-list" aria-live="polite"></ul>
|
| 286 |
+
</div>
|
| 287 |
+
</section>
|
| 288 |
</main>
|
| 289 |
+
|
| 290 |
+
<script>
|
| 291 |
+
// Model definitions
|
| 292 |
+
const AVAILABLE_MODELS = [
|
| 293 |
+
{
|
| 294 |
+
name: "Moonshot Kimi-K2",
|
| 295 |
+
id: "moonshotai/Kimi-K2-Instruct",
|
| 296 |
+
description: "Moonshot AI Kimi-K2-Instruct model for code generation and general tasks",
|
| 297 |
+
default_provider: "groq"
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
name: "DeepSeek V3",
|
| 301 |
+
id: "deepseek-ai/DeepSeek-V3-0324",
|
| 302 |
+
description: "DeepSeek V3 model for code generation"
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
name: "DeepSeek R1",
|
| 306 |
+
id: "deepseek-ai/DeepSeek-R1-0528",
|
| 307 |
+
description: "DeepSeek R1 model for code generation"
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
name: "ERNIE-4.5-VL",
|
| 311 |
+
id: "baidu/ERNIE-4.5-VL-424B-A47B-Base-PT",
|
| 312 |
+
description: "ERNIE-4.5-VL model for multimodal code generation with image support"
|
| 313 |
+
},
|
| 314 |
+
{
|
| 315 |
+
name: "MiniMax M1",
|
| 316 |
+
id: "MiniMaxAI/MiniMax-M1-80k",
|
| 317 |
+
description: "MiniMax M1 model for code generation and general tasks"
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
name: "Qwen3-235B-A22B",
|
| 321 |
+
id: "Qwen/Qwen3-235B-A22B",
|
| 322 |
+
description: "Qwen3-235B-A22B model for code generation and general tasks"
|
| 323 |
+
},
|
| 324 |
+
{
|
| 325 |
+
name: "SmolLM3-3B",
|
| 326 |
+
id: "HuggingFaceTB/SmolLM3-3B",
|
| 327 |
+
description: "SmolLM3-3B model for code generation and general tasks"
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
name: "GLM-4.1V-9B-Thinking",
|
| 331 |
+
id: "THUDM/GLM-4.1V-9B-Thinking",
|
| 332 |
+
description: "GLM-4.1V-9B-Thinking model for multimodal code generation with image support"
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
name: "OpenAI GPT-4",
|
| 336 |
+
id: "openai/gpt-4",
|
| 337 |
+
description: "OpenAI GPT-4 model via HF Inference Providers",
|
| 338 |
+
default_provider: "openai"
|
| 339 |
+
},
|
| 340 |
+
{
|
| 341 |
+
name: "Gemini Pro",
|
| 342 |
+
id: "gemini/pro",
|
| 343 |
+
description: "Google Gemini Pro model via HF Inference Providers",
|
| 344 |
+
default_provider: "gemini"
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
name: "Fireworks AI",
|
| 348 |
+
id: "fireworks-ai/fireworks-v1",
|
| 349 |
+
description: "Fireworks AI model via HF Inference Providers",
|
| 350 |
+
default_provider: "fireworks"
|
| 351 |
+
}
|
| 352 |
+
];
|
| 353 |
+
|
| 354 |
+
// Populate model dropdown
|
| 355 |
+
const modelSelect = document.getElementById('model');
|
| 356 |
+
AVAILABLE_MODELS.forEach(model => {
|
| 357 |
+
const option = document.createElement('option');
|
| 358 |
+
option.value = model.id;
|
| 359 |
+
option.textContent = model.name;
|
| 360 |
+
option.title = model.description;
|
| 361 |
+
modelSelect.appendChild(option);
|
| 362 |
+
});
|
| 363 |
+
|
| 364 |
+
// Tab functionality
|
| 365 |
+
function setupTabs(tabContainerSelector) {
|
| 366 |
+
const tabContainer = document.querySelector(tabContainerSelector);
|
| 367 |
+
const tabs = tabContainer.querySelectorAll('[role="tab"]');
|
| 368 |
+
const panels = tabContainer.parentElement.querySelectorAll('[role="tabpanel"]');
|
| 369 |
+
|
| 370 |
+
tabs.forEach(tab => {
|
| 371 |
+
tab.addEventListener('click', () => {
|
| 372 |
+
tabs.forEach(t => {
|
| 373 |
+
t.setAttribute('aria-selected', 'false');
|
| 374 |
+
t.tabIndex = -1;
|
| 375 |
+
});
|
| 376 |
+
tab.setAttribute('aria-selected', 'true');
|
| 377 |
+
tab.tabIndex = 0;
|
| 378 |
+
|
| 379 |
+
panels.forEach(panel => {
|
| 380 |
+
panel.hidden = true;
|
| 381 |
+
if (panel.id === tab.getAttribute('aria-controls')) {
|
| 382 |
+
panel.hidden = false;
|
| 383 |
+
}
|
| 384 |
+
});
|
| 385 |
+
});
|
| 386 |
+
});
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
setupTabs('.tabs[role="tablist"]');
|
| 390 |
+
|
| 391 |
+
// Clear session
|
| 392 |
+
document.getElementById('clear').addEventListener('click', () => {
|
| 393 |
+
document.getElementById('prompt').value = '';
|
| 394 |
+
document.getElementById('reference-file').value = '';
|
| 395 |
+
document.getElementById('website-url').value = '';
|
| 396 |
+
document.getElementById('code-output').textContent = '</>';
|
| 397 |
+
document.getElementById('preview').srcdoc = '';
|
| 398 |
+
document.getElementById('history-list').innerHTML = '';
|
| 399 |
+
});
|
| 400 |
+
|
| 401 |
+
// Generate code (stub)
|
| 402 |
+
document.getElementById('generate').addEventListener('click', () => {
|
| 403 |
+
const prompt = document.getElementById('prompt').value.trim();
|
| 404 |
+
const language = document.getElementById('language').value;
|
| 405 |
+
if (!prompt) {
|
| 406 |
+
alert('Please provide a prompt.');
|
| 407 |
+
return;
|
| 408 |
+
}
|
| 409 |
+
// Simulate generation
|
| 410 |
+
const code = `// Generated ${language} code\n// Prompt: ${prompt}\n\nconsole.log('Hello, AnyCoder AI!');`;
|
| 411 |
+
document.getElementById('code-output').textContent = code;
|
| 412 |
+
document.getElementById('preview').srcdoc = `<pre>${code}</pre>`;
|
| 413 |
+
const li = document.createElement('li');
|
| 414 |
+
li.textContent = new Date().toLocaleTimeString() + ' - ' + prompt.substring(0, 30) + '...';
|
| 415 |
+
document.getElementById('history-list').prepend(li);
|
| 416 |
+
});
|
| 417 |
+
</script>
|
| 418 |
</body>
|
| 419 |
</html>
|