mgbam commited on
Commit
98ea765
·
verified ·
1 Parent(s): 13a7675

Delete static

Browse files
Files changed (4) hide show
  1. static/assets/logo.png +0 -0
  2. static/index.html +0 -115
  3. static/index.js +0 -132
  4. static/style.css +0 -48
static/assets/logo.png DELETED
static/index.html DELETED
@@ -1,115 +0,0 @@
1
- <!-- /static/index.html -->
2
- <!DOCTYPE html>
3
- <html lang="en">
4
- <head>
5
- <meta charset="UTF-8" />
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
-
8
- <title>AnyCoder AI</title>
9
- <meta
10
- name="description"
11
- content="Generate, modify and understand code with today’s most advanced AI models."
12
- />
13
-
14
- <!-- one dark‑mode friendly stylesheet -->
15
- <link rel="stylesheet" href="/static/style.css" />
16
- </head>
17
- <body>
18
- <header>
19
- <h1>🚀 AnyCoder AI</h1>
20
- <p class="tagline">
21
- Your AI partner for generating, modifying &amp; understanding code.
22
- </p>
23
- </header>
24
-
25
- <!-- ───────────── MAIN LAYOUT ───────────── -->
26
- <main>
27
- <!-- 1 · Model -->
28
- <section class="card" aria-labelledby="h‑model">
29
- <h2 id="h‑model">1. Select Model</h2>
30
- <label class="visually‑hidden" for="model">AI Model</label>
31
- <select id="model"></select>
32
- </section>
33
-
34
- <!-- 2 · Context -->
35
- <section class="card" aria-labelledby="h‑context">
36
- <h2 id="h‑context">2. Provide Context</h2>
37
-
38
- <!-- tab buttons -->
39
- <div class="tabs" role="tablist">
40
- <button role="tab" id="tab‑prompt" aria‑selected="true"
41
- aria‑controls="panel‑prompt">Prompt</button>
42
- <button role="tab" id="tab‑file" aria‑selected="false"
43
- aria‑controls="panel‑file">File</button>
44
- <button role="tab" id="tab‑website" aria‑selected="false"
45
- aria‑controls="panel‑website">Website</button>
46
- </div>
47
-
48
- <!-- tab panels -->
49
- <div id="panel‑prompt" role="tabpanel">
50
- <textarea id="prompt" placeholder="Describe what you want to build…" aria‑label="Prompt"></textarea>
51
- </div>
52
-
53
- <div id="panel‑file" role="tabpanel" hidden>
54
- <label for="reference‑file">Reference File</label>
55
- <input type="file" id="reference‑file"
56
- accept=".pdf,.docx,.txt" />
57
- </div>
58
-
59
- <div id="panel‑website" role="tabpanel" hidden>
60
- <label for="website‑url">Website URL</label>
61
- <input type="url" id="website‑url" placeholder="https://example.com" />
62
- </div>
63
- </section>
64
-
65
- <!-- 3 · Output -->
66
- <section class="card" aria-labelledby="h‑output">
67
- <h2 id="h‑output">3. Configure Output</h2>
68
-
69
- <label for="language">Target Language</label>
70
- <select id="language"></select>
71
-
72
- <div class="checkbox‑row">
73
- <input type="checkbox" id="web‑search" />
74
- <label for="web‑search">Enable Web Search</label>
75
- </div>
76
- </section>
77
-
78
- <!-- 4 · Actions -->
79
- <section class="actions">
80
- <button id="clear" type="button">Clear Session</button>
81
- <button id="generate" type="button" class="primary">Generate Code</button>
82
- </section>
83
-
84
- <!-- 5 · Output tabs -->
85
- <section class="card" aria-labelledby="h‑tabs">
86
- <h2 id="h‑tabs" class="visually‑hidden">Output</h2>
87
-
88
- <div class="tabs" role="tablist">
89
- <button role="tab" id="tab‑code" aria‑selected="true"
90
- aria‑controls="panel‑code">Code</button>
91
- <button role="tab" id="tab‑preview" aria‑selected="false"
92
- aria‑controls="panel‑preview">Live Preview</button>
93
- <button role="tab" id="tab‑history" aria‑selected="false"
94
- aria‑controls="panel‑history">History</button>
95
- </div>
96
-
97
- <div id="panel‑code" role="tabpanel">
98
- <pre><code id="code‑output" class="language‑html">&lt;/&gt;</code></pre>
99
- </div>
100
-
101
- <div id="panel‑preview" role="tabpanel" hidden>
102
- <iframe id="preview" title="Live preview"
103
- sandbox="allow‑scripts allow‑same‑origin"></iframe>
104
- </div>
105
-
106
- <div id="panel‑history" role="tabpanel" hidden>
107
- <ul id="history‑list" aria‑live="polite"></ul>
108
- </div>
109
- </section>
110
- </main>
111
-
112
- <!-- front‑end logic -->
113
- <script type="module" src="/static/index.js"></script>
114
- </body>
115
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/index.js DELETED
@@ -1,132 +0,0 @@
1
- /* /static/index.js – AnyCoder AI front‑end logic
2
- ------------------------------------------------- */
3
-
4
- /* 1) MODEL & LANGUAGE LISTS --------------------------------------- */
5
- const AVAILABLE_MODELS = [
6
- { name: "Moonshot Kimi‑K2", id: "moonshotai/Kimi-K2-Instruct", provider: "groq" },
7
- { name: "DeepSeek V3", id: "deepseek-ai/DeepSeek-V3-0324" },
8
- { name: "DeepSeek R1", id: "deepseek-ai/DeepSeek-R1-0528" },
9
- { name: "ERNIE‑4.5‑VL", id: "baidu/ERNIE-4.5-VL-424B-A47B-Base-PT" },
10
- { name: "MiniMax M1", id: "MiniMaxAI/MiniMax-M1-80k" },
11
- { name: "Qwen3‑235B‑A22B", id: "Qwen/Qwen3-235B-A22B" },
12
- { name: "SmolLM3‑3B", id: "HuggingFaceTB/SmolLM3-3B" },
13
- { name: "GLM‑4.1V‑9B‑Thinking", id: "THUDM/GLM-4.1V-9B-Thinking" },
14
- { name: "Qwen3‑235B‑A22B‑Instruct‑2507", id: "Qwen/Qwen3-235B-A22B-Instruct-2507" },
15
- { name: "Qwen3‑Coder‑480B‑A35B", id: "Qwen/Qwen3-Coder-480B-A35B-Instruct" },
16
- { name: "Qwen3‑32B", id: "Qwen/Qwen3-32B" },
17
- { name: "OpenAI GPT‑4", id: "openai/gpt-4", provider: "openai" },
18
- { name: "Gemini Pro", id: "gemini/pro", provider: "gemini" },
19
- { name: "Fireworks V1", id: "fireworks-ai/fireworks-v1", provider: "fireworks" }
20
- ];
21
-
22
- const TARGET_LANGUAGES = [
23
- "python","c","cpp","markdown","latex","json","html","css",
24
- "javascript","jinja2","typescript","yaml","dockerfile","shell",
25
- "r","sql","sql-msSQL","sql-mySQL","sql-mariaDB","sql-sqlite",
26
- "sql-cassandra","sql-plSQL","sql-hive","sql-pgSQL","sql-gql",
27
- "sql-gpSQL","sql-sparkSQL","sql-esper","transformers.js"
28
- ];
29
-
30
- /* 2) QUICK DOM HOOKS --------------------------------------------- */
31
- const $ = q => document.querySelector(q);
32
- const modelSel = $('#model');
33
- const langSel = $('#language');
34
- const tabs = document.querySelectorAll('.tabs[role="tablist"]');
35
-
36
- /* 3) POPULATE DROPDOWNS ------------------------------------------ */
37
- for (const m of AVAILABLE_MODELS) {
38
- const o = document.createElement('option');
39
- o.value = m.id;
40
- o.textContent = m.name;
41
- o.dataset.provider = m.provider || '';
42
- modelSel.appendChild(o);
43
- }
44
- for (const l of TARGET_LANGUAGES) {
45
- const o = document.createElement('option');
46
- o.value = l;
47
- o.textContent = l;
48
- langSel.appendChild(o);
49
- }
50
-
51
- /* 4) TABS (generic) ---------------------------------------------- */
52
- tabs.forEach(tabList => {
53
- tabList.querySelectorAll('[role="tab"]').forEach(btn => {
54
- btn.addEventListener('click', () => {
55
- tabList.querySelectorAll('[role="tab"]').forEach(t => t.ariaSelected = false);
56
- btn.ariaSelected = true;
57
- const panels = tabList.parentElement.querySelectorAll('[role="tabpanel"]');
58
- panels.forEach(p => p.hidden = p.id !== btn.getAttribute('aria-controls'));
59
- });
60
- });
61
- });
62
-
63
- /* 5) INPUTS ------------------------------------------------------- */
64
- const promptInput = $('#prompt');
65
- const fileInput = $('#reference‑file');
66
- const urlInput = $('#website‑url');
67
- const webSearchChk = $('#web‑search');
68
- const codeOut = $('#code‑output');
69
- const previewFrame = $('#preview');
70
- const histList = $('#history‑list');
71
-
72
- /* 6) CLEAR SESSION ----------------------------------------------- */
73
- $('#clear').addEventListener('click', () => {
74
- promptInput.value = '';
75
- fileInput.value = '';
76
- urlInput.value = '';
77
- codeOut.textContent = '</>';
78
- previewFrame.srcdoc = '';
79
- histList.innerHTML = '';
80
- });
81
-
82
- /* 7) GENERATE ----------------------------------------------------- */
83
- $('#generate').addEventListener('click', async () => {
84
- const prompt = promptInput.value.trim();
85
- if (!prompt) { alert('Please provide a prompt.'); return; }
86
-
87
- // build JSON payload
88
- const body = {
89
- prompt,
90
- model_id: modelSel.value,
91
- language: langSel.value,
92
- enable_search: webSearchChk.checked,
93
- website_url: urlInput.value || null
94
- };
95
-
96
- if (fileInput.files.length) {
97
- const f = fileInput.files[0];
98
- body.file_name = f.name;
99
- body.file_data = await f.text(); // send raw text; backend still trims to 5 000 chars
100
- }
101
-
102
- // UI state
103
- const genBtn = $('#generate');
104
- genBtn.disabled = true; genBtn.textContent = 'Generating…';
105
-
106
- try {
107
- const r = await fetch('/run/predict', {
108
- method : 'POST',
109
- headers: { 'Content-Type': 'application/json' },
110
- body : JSON.stringify(body)
111
- });
112
- if (!r.ok) throw new Error(await r.text());
113
- const { data } = await r.json(); // ↳ Gradio wraps in {data:[…]}
114
- const [code] = data;
115
-
116
- codeOut.textContent = code;
117
- previewFrame.srcdoc = langSel.value === 'html'
118
- ? code
119
- : `<pre style="white-space:pre-wrap">${code.replace(/&/g,'&amp;').replace(/</g,'&lt;')}</pre>`;
120
-
121
- // history
122
- const li = document.createElement('li');
123
- li.textContent = `${new Date().toLocaleTimeString()} – ${prompt.slice(0,40)}…`;
124
- histList.prepend(li);
125
-
126
- } catch (err) {
127
- console.error(err);
128
- alert('Generation failed – check console / backend logs.');
129
- } finally {
130
- genBtn.disabled = false; genBtn.textContent = 'Generate Code';
131
- }
132
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
static/style.css DELETED
@@ -1,48 +0,0 @@
1
- /* static/style.css – FULL FILE (dark theme, readable) */
2
- :root{
3
- --bg:#0d1117;--bg2:#161b22;--surface:#21262d;--border:#30363d;
4
- --text:#c9d1d9;--muted:#8b949e;--accent:#58a6ff;--accent2:#79c0ff;
5
- --r:8px;--mono:"SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;
6
- --tr:.2s ease
7
- }
8
- *{box-sizing:border-box;margin:0}
9
- body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
10
- background:var(--bg);color:var(--text);line-height:1.6}
11
- header{text-align:center;padding:2rem 1rem 1rem}
12
- header h1{font-size:2rem;margin-bottom:.3rem}
13
- header p{color:var(--muted)}
14
- main{max-width:960px;margin:0 auto 4rem;padding:0 1rem;display:flex;flex-direction:column;gap:2rem}
15
- section{background:var(--bg2);border:1px solid var(--border);border-radius:var(--r);padding:1.5rem}
16
- h2{font-size:1.25rem;margin:0 0 1rem}
17
-
18
- /* inputs */
19
- label{font-weight:600;margin:.5rem 0;display:block}
20
- select,input[type=file],input[type=url],textarea{
21
- width:100%;padding:.75rem;border:1px solid var(--border);border-radius:var(--r);
22
- background:var(--surface);color:var(--text);font-size:1rem;transition:border-color var(--tr)
23
- }
24
- select:focus,input:focus,textarea:focus{outline:none;border-color:var(--accent)}
25
- textarea{resize:vertical;min-height:140px;font-family:var(--mono)}
26
-
27
- /* tabs */
28
- .tabs{display:flex;gap:.5rem;margin-bottom:1rem}
29
- .tabs button{background:transparent;border:1px solid var(--border);border-radius:var(--r);
30
- padding:.4rem 1rem;color:var(--muted);cursor:pointer;transition:background var(--tr),color var(--tr)}
31
- .tabs button[aria-selected=true]{background:var(--accent);color:var(--bg);border-color:var(--accent)}
32
- .tabs button:hover:not([aria-selected=true]){background:var(--surface);color:var(--text)}
33
-
34
- /* buttons */
35
- .actions{display:flex;gap:.75rem;justify-content:flex-end;flex-wrap:wrap}
36
- button{border:none;border-radius:var(--r);font-size:1rem;cursor:pointer;padding:.7rem 1.5rem;transition:background var(--tr)}
37
- #clear{background:var(--border);color:var(--text)}#clear:hover{background:var(--surface)}
38
- #generate{background:var(--accent);color:var(--bg)}#generate:hover{background:var(--accent2)}
39
- #generate:disabled{opacity:.6;cursor:progress}
40
-
41
- /* outputs */
42
- pre{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);
43
- padding:1rem;overflow-x:auto;font-family:var(--mono);font-size:.9rem}
44
- iframe{width:100%;height:420px;border:1px solid var(--border);border-radius:var(--r);background:#fff}
45
-
46
- /* utilities */
47
- .visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
48
- @media(max-width:640px){header{padding-top:1.5rem}section{padding:1.2rem}.actions{flex-direction:column}}