Download index.html from Unmid/html: direct link, hf CLI and curl.
- Browser
- Download file 7.06 kB
-
https://huggingface.co/spaces/Unmid/html/resolve/main/index.html
- Command line
-
hf download hf://spaces/Unmid/html/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Unmid/html/resolve/main/index.html
7.06 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>OpenCode Zen - DeepSeek Chat</title> | |
| <style> | |
| :root { | |
| --bg-primary: #0f172a; | |
| --bg-secondary: #1e293b; | |
| --bg-bubble-ai: #273549; | |
| --bg-bubble-user: #2563eb; | |
| --text-main: #f8fafc; | |
| --border-color: #334155; | |
| --accent: #38bdf8; | |
| } | |
| * { box-sizing: border-box; margin: 0; padding: 0; font-family: system-ui, sans-serif; } | |
| body { background-color: var(--bg-primary); color: var(--text-main); display: flex; flex-direction: column; height: 100vh; overflow: hidden; } | |
| header { | |
| background-color: var(--bg-secondary); | |
| border-bottom: 1px solid var(--border-color); | |
| padding: 12px 16px; | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: 12px; | |
| align-items: center; | |
| justify-content: space-between; | |
| } | |
| .config-group { | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: 10px; | |
| align-items: center; | |
| font-size: 13px; | |
| } | |
| .config-group input, .config-group select { | |
| background: var(--bg-primary); | |
| border: 1px solid var(--border-color); | |
| color: var(--text-main); | |
| padding: 6px 10px; | |
| border-radius: 6px; | |
| font-size: 13px; | |
| outline: none; | |
| } | |
| #chat-window { | |
| flex: 1; | |
| padding: 20px; | |
| overflow-y: auto; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 16px; | |
| } | |
| .message { | |
| max-width: 85%; | |
| line-height: 1.5; | |
| padding: 12px 16px; | |
| border-radius: 12px; | |
| word-break: break-word; | |
| white-space: pre-wrap; | |
| } | |
| .user-msg { background-color: var(--bg-bubble-user); align-self: flex-end; border-bottom-right-radius: 2px; } | |
| .ai-msg { background-color: var(--bg-bubble-ai); align-self: flex-start; border-bottom-left-radius: 2px; border: 1px solid var(--border-color); } | |
| .error-msg { background-color: #7f1d1d; color: #fecaca; align-self: center; font-size: 13px; } | |
| #input-container { | |
| background-color: var(--bg-secondary); | |
| border-top: 1px solid var(--border-color); | |
| padding: 14px 20px; | |
| display: flex; | |
| gap: 10px; | |
| } | |
| textarea { | |
| flex: 1; | |
| background: var(--bg-primary); | |
| color: var(--text-main); | |
| border: 1px solid var(--border-color); | |
| border-radius: 8px; | |
| padding: 10px 14px; | |
| resize: none; | |
| height: 48px; | |
| outline: none; | |
| font-size: 14px; | |
| } | |
| button { | |
| background: var(--accent); | |
| color: #0f172a; | |
| border: none; | |
| font-weight: 600; | |
| padding: 0 20px; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| } | |
| button:disabled { opacity: 0.5; cursor: not-allowed; } | |
| </style> | |
| </head> | |
| <body> | |
| <header> | |
| <div><strong>OpenCode Zen Chat</strong></div> | |
| <div class="config-group"> | |
| <label>Proxy:</label> | |
| <select id="cors-mode"> | |
| <option value="proxy">CORS Proxy (For Web Hosts)</option> | |
| <option value="direct">Direct (No Proxy)</option> | |
| </select> | |
| <label>Endpoint:</label> | |
| <select id="endpoint-select"> | |
| <option value="https://opencode.ai/zen/v1/chat/completions">/zen/v1/chat/completions</option> | |
| <option value="https://opencode.ai/inference/v1/chat/completions">/inference/v1/chat/completions</option> | |
| </select> | |
| <label>Model:</label> | |
| <input type="text" id="model-input" value="deepseek-v4.1-flash-free" style="width: 200px;" /> | |
| <label>Key:</label> | |
| <input type="password" id="api-key" value="oc_sk_35b87025c3e1_wYnXQAjQFh5SahiJknEk7MRQdW3q7RaL" style="width: 140px;" /> | |
| </div> | |
| </header> | |
| <div id="chat-window"> | |
| <div class="message ai-msg">Ready! Type your question below.</div> | |
| </div> | |
| <div id="input-container"> | |
| <textarea id="prompt-input" placeholder="Type a message... (Shift + Enter for new line)"></textarea> | |
| <button id="send-btn" onclick="sendMessage()">Send</button> | |
| </div> | |
| <script> | |
| const chatWindow = document.getElementById("chat-window"); | |
| const promptInput = document.getElementById("prompt-input"); | |
| const sendBtn = document.getElementById("send-btn"); | |
| const apiKeyInput = document.getElementById("api-key"); | |
| const modelInput = document.getElementById("model-input"); | |
| const endpointSelect = document.getElementById("endpoint-select"); | |
| const corsMode = document.getElementById("cors-mode"); | |
| let messages = [ | |
| { role: "system", content: "You are a helpful coding and AI assistant." } | |
| ]; | |
| promptInput.addEventListener("keydown", (e) => { | |
| if (e.key === "Enter" && !e.shiftKey) { | |
| e.preventDefault(); | |
| sendMessage(); | |
| } | |
| }); | |
| function appendMessage(role, text) { | |
| const msg = document.createElement("div"); | |
| msg.className = `message ${role === "user" ? "user-msg" : "ai-msg"}`; | |
| msg.textContent = text; | |
| chatWindow.appendChild(msg); | |
| chatWindow.scrollTop = chatWindow.scrollHeight; | |
| return msg; | |
| } | |
| async function sendMessage() { | |
| const text = promptInput.value.trim(); | |
| const apiKey = apiKeyInput.value.trim(); | |
| const model = modelInput.value.trim(); | |
| if (!text || !apiKey) return; | |
| appendMessage("user", text); | |
| messages.push({ role: "user", content: text }); | |
| promptInput.value = ""; | |
| const aiBubble = appendMessage("assistant", "Thinking..."); | |
| sendBtn.disabled = true; | |
| // Determine target URL | |
| let targetUrl = endpointSelect.value; | |
| if (corsMode.value === "proxy") { | |
| // Routes through a CORS proxy so browser security doesn't block the static host | |
| targetUrl = "https://corsproxy.io/?" + encodeURIComponent(targetUrl); | |
| } | |
| try { | |
| const response = await fetch(targetUrl, { | |
| method: "POST", | |
| headers: { | |
| "Content-Type": "application/json", | |
| "Authorization": `Bearer ${apiKey}` | |
| }, | |
| body: JSON.stringify({ | |
| model: model, | |
| messages: messages, | |
| stream: false // Non-streamed for maximum proxy compatibility | |
| }) | |
| }); | |
| if (!response.ok) { | |
| const errBody = await response.text(); | |
| let parsedMsg = errBody; | |
| try { | |
| const json = JSON.parse(errBody); | |
| parsedMsg = json.error?.message || json.message || errBody; | |
| } catch (_) {} | |
| throw new Error(`HTTP ${response.status}: ${parsedMsg}`); | |
| } | |
| const data = await response.json(); | |
| const reply = data.choices?.[0]?.message?.content || "(No response content returned)"; | |
| aiBubble.textContent = reply; | |
| messages.push({ role: "assistant", content: reply }); | |
| } catch (err) { | |
| aiBubble.className = "message error-msg"; | |
| aiBubble.textContent = "Error: " + err.message; | |
| } finally { | |
| sendBtn.disabled = false; | |
| promptInput.focus(); | |
| chatWindow.scrollTop = chatWindow.scrollHeight; | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> |