139 lines
6.9 KiB
Plaintext
Executable File
139 lines
6.9 KiB
Plaintext
Executable File
<?php require_once __DIR__ . "/hamid-providers-config.php"; ?>
|
|
<?php header('Content-Type: text/html; charset=UTF-8'); ?>
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>WEVAL MIND CLI - Terminal AI</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body { font-family: 'Courier New', monospace; background: #0c0c0c; color: #00ff00; height: 100vh; display: flex; flex-direction: column; }
|
|
.terminal-header { background: #1a1a1a; padding: 10px 15px; display: flex; align-items: center; gap: 15px; border-bottom: 1px solid #333; }
|
|
.terminal-header .dots { display: flex; gap: 8px; }
|
|
.terminal-header .dot { width: 12px; height: 12px; border-radius: 50%; }
|
|
.terminal-header .dot.red { background: #ff5f56; }
|
|
.terminal-header .dot.yellow { background: #ffbd2e; }
|
|
.terminal-header .dot.green { background: #27c93f; }
|
|
.terminal-header .title { flex: 1; text-align: center; color: #888; font-size: 13px; }
|
|
.terminal-header select { background: #333; color: #00ff00; border: 1px solid #555; padding: 5px 10px; font-family: inherit; font-size: 12px; }
|
|
.terminal { flex: 1; padding: 20px; overflow-y: auto; font-size: 14px; line-height: 1.8; }
|
|
.line { margin-bottom: 5px; white-space: pre-wrap; word-break: break-all; }
|
|
.line.input { color: #00d4ff; }
|
|
.line.output { color: #00ff00; }
|
|
.line.error { color: #ff5f56; }
|
|
.line.system { color: #888; }
|
|
.line .prompt { color: #ff79c6; }
|
|
.line .user { color: #00d4ff; }
|
|
.input-line { display: flex; align-items: center; padding: 10px 20px; background: #1a1a1a; border-top: 1px solid #333; }
|
|
.input-line .prompt { color: #ff79c6; margin-right: 10px; }
|
|
.input-line input { flex: 1; background: transparent; border: none; color: #00ff00; font-family: inherit; font-size: 14px; outline: none; }
|
|
.cursor { animation: blink 1s infinite; }
|
|
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
|
|
.ascii-art { color: #00d4ff; font-size: 10px; line-height: 1.2; margin-bottom: 20px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="terminal-header">
|
|
<div class="dots">
|
|
<div class="dot red"></div>
|
|
<div class="dot yellow"></div>
|
|
<div class="dot green"></div>
|
|
</div>
|
|
<div class="title">hamid@wevads:~</div>
|
|
<?php echo hamid_providers_dropdown("cerebras", "provider", ""); ?>
|
|
</div>
|
|
<div class="terminal" id="terminal">
|
|
<pre class="ascii-art">
|
|
_ _ _ __ __ ___ ____ ____ _ ___
|
|
| | | | / \ | \/ |_ _| _ \ / ___| | |_ _|
|
|
| |_| | / _ \ | |\/| || || | | | | | | | | |
|
|
| _ |/ ___ \| | | || || |_| | | |___| |___ | |
|
|
|_| |_/_/ \_\_| |_|___|____/ \____|_____|___|
|
|
|
|
</pre>
|
|
<div class="line system">WEVAL MIND CLI v2.0 - Superintelligence Terminal Interface</div>
|
|
<div class="line system">Type 'help' for commands, 'clear' to reset</div>
|
|
<div class="line system">Provider: <span id="currentProvider">cerebras</span> | KB: 141 entries</div>
|
|
<div class="line system">─────────────────────────────────────────────────────</div>
|
|
</div>
|
|
<div class="input-line">
|
|
<span class="prompt">hamid@wevads:~$</span>
|
|
<input type="text" id="input" autofocus autocomplete="off">
|
|
</div>
|
|
<script>
|
|
const terminal = document.getElementById('terminal');
|
|
const input = document.getElementById('input');
|
|
const providerSelect = document.getElementById('provider');
|
|
let sessionId = 'cli_' + Date.now();
|
|
let history = [];
|
|
let historyIndex = -1;
|
|
|
|
providerSelect.onchange = () => document.getElementById('currentProvider').textContent = providerSelect.value;
|
|
|
|
input.addEventListener('keydown', e => {
|
|
if (e.key === 'Enter') { execute(); }
|
|
else if (e.key === 'ArrowUp') { if (historyIndex < history.length - 1) { historyIndex++; input.value = history[history.length - 1 - historyIndex]; } }
|
|
else if (e.key === 'ArrowDown') { if (historyIndex > 0) { historyIndex--; input.value = history[history.length - 1 - historyIndex]; } else { historyIndex = -1; input.value = ''; } }
|
|
});
|
|
|
|
function addLine(text, type='output') {
|
|
const div = document.createElement('div');
|
|
div.className = 'line ' + type;
|
|
div.innerHTML = text;
|
|
terminal.appendChild(div);
|
|
terminal.scrollTop = terminal.scrollHeight;
|
|
}
|
|
|
|
function execute() {
|
|
const cmd = input.value.trim();
|
|
if (!cmd) return;
|
|
|
|
history.push(cmd);
|
|
historyIndex = -1;
|
|
addLine(`<span class="prompt">hamid@wevads:~$</span> <span class="user">${cmd}</span>`, 'input');
|
|
input.value = '';
|
|
|
|
// Built-in commands
|
|
if (cmd === 'help') {
|
|
addLine(`Commands:
|
|
help - Show this help
|
|
clear - Clear terminal
|
|
providers - List AI providers
|
|
status - Show system status
|
|
kb - Knowledge base info
|
|
pdf [topic] - Generate PDF document
|
|
[question] - Ask WEVAL MIND anything`, 'system');
|
|
return;
|
|
}
|
|
if (cmd === 'clear') { terminal.innerHTML = ''; return; }
|
|
if (cmd === 'providers') { addLine('Available: cerebras, groq, sambanova, mistral, cohere, claude, openai, ollama', 'system'); return; }
|
|
if (cmd === 'status') { addLine(`Provider: ${providerSelect.value}\nSession: ${sessionId}\nKB: 141 entries`, 'system'); return; }
|
|
|
|
// Send to API
|
|
addLine('⏳ Processing...', 'system');
|
|
|
|
fetch('/hamid-api.php', {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({ message: cmd, provider: providerSelect.value, session_id: sessionId })
|
|
})
|
|
.then(r => r.json())
|
|
.then(data => {
|
|
terminal.lastChild.remove(); // Remove "Processing..."
|
|
if (data.error) {
|
|
addLine('ERROR: ' + data.error, 'error');
|
|
} else {
|
|
addLine(data.response);
|
|
addLine(`[${data.provider} | ${data.duration}ms | KB:${data.kb_count}]`, 'system');
|
|
if (data.generated_doc) {
|
|
addLine(`📄 PDF generated: ${data.generated_doc.url}`, 'system');
|
|
}
|
|
}
|
|
})
|
|
.catch(e => addLine('ERROR: ' + e.message, 'error'));
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|