v2: Forge Console + Open WebUI artifacts + Docker
- web/: Local chat UI (Express + WS → Codex bridge) - openwebui/: Preset, pipelines, knowledge manifest - Dockerfile + docker-compose.yml - Updated README with 3 frontend options - CLI-agnostic: works with Codex, Claude Code, Kiro, Gemini
This commit is contained in:
127
web/public/index.html
Normal file
127
web/public/index.html
Normal file
@@ -0,0 +1,127 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Forge Console</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<header id="status-bar">
|
||||
<span class="logo">🔥 Forge Console</span>
|
||||
<span id="conn-status"><span class="dot red"></span> Disconnected</span>
|
||||
</header>
|
||||
<main id="messages"></main>
|
||||
<footer id="input-bar">
|
||||
<textarea id="input" placeholder="Ask anything..." rows="1"></textarea>
|
||||
<button id="send" title="Send">➤</button>
|
||||
</footer>
|
||||
</div>
|
||||
<script>
|
||||
const messages = document.getElementById('messages');
|
||||
const input = document.getElementById('input');
|
||||
const sendBtn = document.getElementById('send');
|
||||
const connStatus = document.getElementById('conn-status');
|
||||
|
||||
let ws;
|
||||
let currentAssistant = null;
|
||||
|
||||
function setStatus(connected) {
|
||||
connStatus.innerHTML = connected
|
||||
? '<span class="dot green"></span> Connected'
|
||||
: '<span class="dot red"></span> Disconnected';
|
||||
}
|
||||
|
||||
function scrollBottom() {
|
||||
messages.scrollTop = messages.scrollHeight;
|
||||
}
|
||||
|
||||
function addMessage(role, text) {
|
||||
const div = document.createElement('div');
|
||||
div.className = `msg ${role}`;
|
||||
div.textContent = text;
|
||||
messages.appendChild(div);
|
||||
scrollBottom();
|
||||
return div;
|
||||
}
|
||||
|
||||
function addThinking() {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'msg assistant thinking';
|
||||
div.innerHTML = '<span class="dots"><span>.</span><span>.</span><span>.</span></span>';
|
||||
messages.appendChild(div);
|
||||
scrollBottom();
|
||||
return div;
|
||||
}
|
||||
|
||||
function connect() {
|
||||
const proto = location.protocol === 'https:' ? 'wss' : 'ws';
|
||||
ws = new WebSocket(`${proto}://${location.host}/ws`);
|
||||
|
||||
ws.onopen = () => {
|
||||
setStatus(true);
|
||||
currentAssistant = null;
|
||||
};
|
||||
|
||||
ws.onclose = () => {
|
||||
setStatus(false);
|
||||
currentAssistant = null;
|
||||
setTimeout(connect, 2000);
|
||||
};
|
||||
|
||||
ws.onmessage = (e) => {
|
||||
let msg;
|
||||
try { msg = JSON.parse(e.data); } catch { return; }
|
||||
|
||||
if (msg.type === 'stdout' || msg.type === 'stderr') {
|
||||
// Remove thinking indicator if present
|
||||
const thinking = messages.querySelector('.thinking');
|
||||
if (thinking) thinking.remove();
|
||||
|
||||
if (!currentAssistant) {
|
||||
currentAssistant = addMessage('assistant', '');
|
||||
}
|
||||
currentAssistant.textContent += msg.data;
|
||||
scrollBottom();
|
||||
} else if (msg.type === 'exit') {
|
||||
addMessage('system', `Session ended (code ${msg.code}). Refresh to restart.`);
|
||||
currentAssistant = null;
|
||||
} else if (msg.type === 'error') {
|
||||
addMessage('system', `Error: ${msg.data}`);
|
||||
currentAssistant = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function send() {
|
||||
const text = input.value.trim();
|
||||
if (!text || !ws || ws.readyState !== 1) return;
|
||||
|
||||
addMessage('user', text);
|
||||
currentAssistant = null;
|
||||
addThinking();
|
||||
ws.send(text);
|
||||
input.value = '';
|
||||
input.style.height = 'auto';
|
||||
}
|
||||
|
||||
sendBtn.addEventListener('click', send);
|
||||
|
||||
input.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
send();
|
||||
}
|
||||
});
|
||||
|
||||
// Auto-resize textarea
|
||||
input.addEventListener('input', () => {
|
||||
input.style.height = 'auto';
|
||||
input.style.height = Math.min(input.scrollHeight, 120) + 'px';
|
||||
});
|
||||
|
||||
connect();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
176
web/public/style.css
Normal file
176
web/public/style.css
Normal file
@@ -0,0 +1,176 @@
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
:root {
|
||||
--bg: #1a1a2e;
|
||||
--surface: #16213e;
|
||||
--input-bg: #0f3460;
|
||||
--user-bg: #1a3a5c;
|
||||
--assistant-bg: #2a2a3e;
|
||||
--system-bg: #2e1a1a;
|
||||
--text: #e0e0e0;
|
||||
--text-dim: #8888aa;
|
||||
--accent: #4a9eff;
|
||||
--green: #4caf50;
|
||||
--red: #f44336;
|
||||
}
|
||||
|
||||
html, body { height: 100%; }
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
#app {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Status bar */
|
||||
#status-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px 16px;
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid rgba(255,255,255,0.05);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-weight: 600;
|
||||
font-size: 15px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
margin-right: 6px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.dot.green { background: var(--green); }
|
||||
.dot.red { background: var(--red); }
|
||||
|
||||
#conn-status { color: var(--text-dim); font-size: 12px; }
|
||||
|
||||
/* Messages */
|
||||
#messages {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.msg {
|
||||
max-width: 85%;
|
||||
padding: 10px 14px;
|
||||
border-radius: 12px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
animation: fadeIn 0.2s ease;
|
||||
}
|
||||
|
||||
.msg.user {
|
||||
align-self: flex-end;
|
||||
background: var(--user-bg);
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.msg.assistant {
|
||||
align-self: flex-start;
|
||||
background: var(--assistant-bg);
|
||||
border-bottom-left-radius: 4px;
|
||||
font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.msg.system {
|
||||
align-self: center;
|
||||
background: var(--system-bg);
|
||||
color: var(--text-dim);
|
||||
font-size: 12px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
/* Thinking dots */
|
||||
.thinking .dots span {
|
||||
animation: blink 1.4s infinite;
|
||||
font-size: 24px;
|
||||
line-height: 1;
|
||||
}
|
||||
.thinking .dots span:nth-child(2) { animation-delay: 0.2s; }
|
||||
.thinking .dots span:nth-child(3) { animation-delay: 0.4s; }
|
||||
|
||||
@keyframes blink {
|
||||
0%, 20% { opacity: 0.2; }
|
||||
50% { opacity: 1; }
|
||||
80%, 100% { opacity: 0.2; }
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* Input bar */
|
||||
#input-bar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 12px 16px;
|
||||
background: var(--surface);
|
||||
border-top: 1px solid rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
#input {
|
||||
flex: 1;
|
||||
background: var(--input-bg);
|
||||
border: 1px solid rgba(255,255,255,0.1);
|
||||
border-radius: 10px;
|
||||
padding: 10px 14px;
|
||||
color: var(--text);
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
resize: none;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
#input:focus { border-color: var(--accent); }
|
||||
|
||||
#input::placeholder { color: var(--text-dim); }
|
||||
|
||||
#send {
|
||||
background: var(--accent);
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
width: 44px;
|
||||
color: white;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
#send:hover { opacity: 0.85; }
|
||||
#send:active { opacity: 0.7; }
|
||||
|
||||
/* Scrollbar */
|
||||
#messages::-webkit-scrollbar { width: 6px; }
|
||||
#messages::-webkit-scrollbar-track { background: transparent; }
|
||||
#messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
|
||||
|
||||
/* Mobile */
|
||||
@media (max-width: 600px) {
|
||||
#app { max-width: 100%; }
|
||||
.msg { max-width: 92%; }
|
||||
}
|
||||
Reference in New Issue
Block a user