Upload admin.html with huggingface_hub
Browse files- admin.html +180 -5
admin.html
CHANGED
|
@@ -144,6 +144,7 @@
|
|
| 144 |
<h2>Chat Assistant <span id="voice-indicator-inline"></span></h2>
|
| 145 |
<div class="tab-bar">
|
| 146 |
<button class="tab-btn active" onclick="switchTab('chat', this)">π¬ Chat</button>
|
|
|
|
| 147 |
<button class="tab-btn" onclick="switchTab('knowledge', this)">π Knowledge & Tools</button>
|
| 148 |
<button class="tab-btn" onclick="switchTab('wallet', this)">π° Wallet</button>
|
| 149 |
<button class="tab-btn" onclick="switchTab('subscription', this)">π Subscriptions</button>
|
|
@@ -160,7 +161,7 @@
|
|
| 160 |
</div>
|
| 161 |
<div class="chat-container">
|
| 162 |
<div id="chat-messages"></div>
|
| 163 |
-
<div id="chat-input"><input type="text" id="user-input" placeholder="Chat naturally β
|
| 164 |
<div class="voice-controls">
|
| 165 |
<button class="voice-btn" id="voice-btn" onclick="toggleVoice()">π€ Voice On</button>
|
| 166 |
<button class="voice-btn" onclick="clearChat()">π Clear</button>
|
|
@@ -168,6 +169,64 @@
|
|
| 168 |
<button class="voice-btn" onclick="generateApiKey()" style="background:var(--accent-purple);">π API Key</button>
|
| 169 |
</div>
|
| 170 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
<div class="tab-panel" id="tab-wallet">
|
| 172 |
<div class="stats-panel" id="wallet-stats">
|
| 173 |
<div class="stat-row"><span>KSH Balance:</span> <span id="stat-ksh-balance">0.00 KSH</span></div>
|
|
@@ -540,6 +599,16 @@ let brainState = {
|
|
| 540 |
"Mathematics is a core capability. I handle arithmetic, algebra, calculus, number theory, geometry, statistics, discrete math, matrices, vectors, ODEs, series, and complex numbers with full precision. What problem shall we solve?",
|
| 541 |
"Math mode active. Give me the problem β I'll solve it step by step and verify the result. Examples: derivative of x^3, solve x^2-5x+6=0, prime 97, area of circle r=5.",
|
| 542 |
"Ready for mathematics. State the problem clearly and I'll provide a rigorous, step-by-step solution with verification."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
]
|
| 544 |
};
|
| 545 |
|
|
@@ -560,6 +629,8 @@ let brainState = {
|
|
| 560 |
if(/(optim|optimize|search|find|best|solve|minimize)/.test(msg)) return "optimize";
|
| 561 |
if(/(key|crypto|encrypt|sign|secure|lattice)/.test(msg)) return "crypto";
|
| 562 |
if(/(predict|forecast|guess|what will|future)/.test(msg)) return "predict";
|
|
|
|
|
|
|
| 563 |
if(/(novel|book|literature|fiction|story|read|author|tolkien|austen|orwell|asimov|dickens|tolstoy)/.test(msg)) return "novel";
|
| 564 |
if(/(education|school|teach|learn|university|study|mathematics|math|science|history|knowledge)/.test(msg)) return "education";
|
| 565 |
if(/(govern|politics|government|state|policy|law|democracy|republic|nation|aristotle|rousseau|marx)/.test(msg)) return "governance";
|
|
@@ -822,7 +893,7 @@ let brainState = {
|
|
| 822 |
btn.classList.add('active');
|
| 823 |
|
| 824 |
if (tabName === 'chat' && document.getElementById("chat-messages").children.length === 0) {
|
| 825 |
-
addMessage('Xe: Hey! I\'m Xe, your post-quantum AI buddy. Chat with me naturally, or switch to Knowledge & Tools for quick domains and document uploads.', 'bot');
|
| 826 |
}
|
| 827 |
if (tabName === 'wallet') {
|
| 828 |
updateWalletStats();
|
|
@@ -1057,9 +1128,9 @@ let brainState = {
|
|
| 1057 |
const filepath = m.slice(5).trim();
|
| 1058 |
response = "Reading " + filepath + "...\n[File content extraction requires server-side processing in the full backend.]";
|
| 1059 |
}
|
| 1060 |
-
|
| 1061 |
-
response = "Commands: plans, subscribe <free|white|black>, my plan, cancel subscription, admin on/off, train, train hard, train offline, train online on/off, train xe, optimize, key, predict, read <path>, brain status, brain analyze, brain forget, brain train, voice on/off, wallet, trade, balance [currency], convert <amount> <currency>, profit, maintenance start/stop/status, self heal, autonomous upgrade, quit. Or just chat naturally! Mathematics works directly in chat: arithmetic, algebra, calculus, number theory, geometry, statistics, discrete math, matrices, vectors, ODEs, series, complex numbers β all with full precision and step-by-step solutions.";
|
| 1062 |
-
|
| 1063 |
else {
|
| 1064 |
const intent = understand(msg);
|
| 1065 |
response = respond(intent, msg);
|
|
@@ -1130,6 +1201,110 @@ let brainState = {
|
|
| 1130 |
: 'Admin mode <b>OFF</b> β features now follow your active plan.';
|
| 1131 |
}
|
| 1132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1133 |
renderSubscriptions();
|
| 1134 |
</script>
|
| 1135 |
</body>
|
|
|
|
| 144 |
<h2>Chat Assistant <span id="voice-indicator-inline"></span></h2>
|
| 145 |
<div class="tab-bar">
|
| 146 |
<button class="tab-btn active" onclick="switchTab('chat', this)">π¬ Chat</button>
|
| 147 |
+
<button class="tab-btn" onclick="switchTab('generate', this)">π¨ Generate</button>
|
| 148 |
<button class="tab-btn" onclick="switchTab('knowledge', this)">π Knowledge & Tools</button>
|
| 149 |
<button class="tab-btn" onclick="switchTab('wallet', this)">π° Wallet</button>
|
| 150 |
<button class="tab-btn" onclick="switchTab('subscription', this)">π Subscriptions</button>
|
|
|
|
| 161 |
</div>
|
| 162 |
<div class="chat-container">
|
| 163 |
<div id="chat-messages"></div>
|
| 164 |
+
<div id="chat-input"><input type="text" id="user-input" placeholder="Chat naturally β try 'generate image of a sunset' or 'create video of a cat'..." onkeydown="if(event.key==='Enter') sendMessage()"><button onclick="sendMessage()">Send</button></div>
|
| 165 |
<div class="voice-controls">
|
| 166 |
<button class="voice-btn" id="voice-btn" onclick="toggleVoice()">π€ Voice On</button>
|
| 167 |
<button class="voice-btn" onclick="clearChat()">π Clear</button>
|
|
|
|
| 169 |
<button class="voice-btn" onclick="generateApiKey()" style="background:var(--accent-purple);">π API Key</button>
|
| 170 |
</div>
|
| 171 |
</div>
|
| 172 |
+
</div>
|
| 173 |
+
<div class="tab-panel" id="tab-generate">
|
| 174 |
+
<div class="section-title">π¨ Image Generation</div>
|
| 175 |
+
<div style="display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:12px;">
|
| 176 |
+
<input type="text" id="image-prompt" placeholder="Describe the image you want..." style="grid-column:1/-1;">
|
| 177 |
+
<select id="image-provider">
|
| 178 |
+
<option value="placeholder">Advanced Generator</option>
|
| 179 |
+
<option value="stable-diffusion">Stable Diffusion XL</option>
|
| 180 |
+
<option value="flux">Flux.1</option>
|
| 181 |
+
<option value="dall-e">DALL-E 3</option>
|
| 182 |
+
<option value="midjourney">Midjourney v6</option>
|
| 183 |
+
</select>
|
| 184 |
+
<select id="image-size">
|
| 185 |
+
<option value="1024x1024">1024x1024 (Square)</option>
|
| 186 |
+
<option value="1920x1080">1920x1080 (HD)</option>
|
| 187 |
+
<option value="2048x2048">2048x2048 (4K)</option>
|
| 188 |
+
<option value="512x512">512x512 (Fast)</option>
|
| 189 |
+
</select>
|
| 190 |
+
<select id="image-style">
|
| 191 |
+
<option value="general">General</option>
|
| 192 |
+
<option value="photorealistic">Photorealistic</option>
|
| 193 |
+
<option value="anime">Anime</option>
|
| 194 |
+
<option value="artistic">Artistic</option>
|
| 195 |
+
<option value="digital">Digital Art</option>
|
| 196 |
+
</select>
|
| 197 |
+
<button onclick="generateImage()" style="background:var(--accent);">π¨ Generate Image</button>
|
| 198 |
+
</div>
|
| 199 |
+
<div class="output" id="image-output" style="min-height:80px; margin-bottom:20px;"></div>
|
| 200 |
+
|
| 201 |
+
<div class="section-title">π¬ Video Generation</div>
|
| 202 |
+
<div style="display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:12px;">
|
| 203 |
+
<input type="text" id="video-prompt" placeholder="Describe the video you want..." style="grid-column:1/-1;">
|
| 204 |
+
<select id="video-provider">
|
| 205 |
+
<option value="placeholder">Advanced Generator</option>
|
| 206 |
+
<option value="runway">Runway Gen-3</option>
|
| 207 |
+
<option value="pika">Pika Labs v1.0</option>
|
| 208 |
+
<option value="svd">Stable Video Diffusion</option>
|
| 209 |
+
</select>
|
| 210 |
+
<select id="video-duration">
|
| 211 |
+
<option value="2">2 seconds</option>
|
| 212 |
+
<option value="4" selected>4 seconds</option>
|
| 213 |
+
<option value="8">8 seconds</option>
|
| 214 |
+
<option value="16">16 seconds</option>
|
| 215 |
+
</select>
|
| 216 |
+
<select id="video-fps">
|
| 217 |
+
<option value="24">24 FPS</option>
|
| 218 |
+
<option value="30">30 FPS</option>
|
| 219 |
+
<option value="60">60 FPS</option>
|
| 220 |
+
</select>
|
| 221 |
+
<button onclick="generateVideo()" style="background:var(--accent-green);">π¬ Generate Video</button>
|
| 222 |
+
</div>
|
| 223 |
+
<div class="output" id="video-output" style="min-height:80px; margin-bottom:20px;"></div>
|
| 224 |
+
|
| 225 |
+
<div class="section-title">π Generation History</div>
|
| 226 |
+
<div class="stats-panel" id="generation-history" style="max-height:200px; overflow-y:auto; font-size:0.85rem;">
|
| 227 |
+
<div id="generation-history-content">No generations yet. Create your first image or video above!</div>
|
| 228 |
+
</div>
|
| 229 |
+
</div>
|
| 230 |
<div class="tab-panel" id="tab-wallet">
|
| 231 |
<div class="stats-panel" id="wallet-stats">
|
| 232 |
<div class="stat-row"><span>KSH Balance:</span> <span id="stat-ksh-balance">0.00 KSH</span></div>
|
|
|
|
| 599 |
"Mathematics is a core capability. I handle arithmetic, algebra, calculus, number theory, geometry, statistics, discrete math, matrices, vectors, ODEs, series, and complex numbers with full precision. What problem shall we solve?",
|
| 600 |
"Math mode active. Give me the problem β I'll solve it step by step and verify the result. Examples: derivative of x^3, solve x^2-5x+6=0, prime 97, area of circle r=5.",
|
| 601 |
"Ready for mathematics. State the problem clearly and I'll provide a rigorous, step-by-step solution with verification."
|
| 602 |
+
],
|
| 603 |
+
image_generation: [
|
| 604 |
+
"I'd love to help you generate an image! Tell me what you'd like to see, and I'll create it for you. You can specify style (realistic, anime, artistic), size, and preferred provider.",
|
| 605 |
+
"Image generation ready! Describe what you want to see, and I'll generate it for you. Supported providers: Stable Diffusion, Flux, DALL-E 3, Midjourney.",
|
| 606 |
+
"Let's create something visual! Tell me your image idea and I'll bring it to life using advanced image generation."
|
| 607 |
+
],
|
| 608 |
+
video_generation: [
|
| 609 |
+
"I'd love to help you generate a video! Tell me what you'd like to see, and I'll create it for you. You can specify duration, FPS, and preferred provider.",
|
| 610 |
+
"Video generation ready! Describe your video concept and I'll generate it for you. Supported providers: Runway Gen-3, Pika Labs, Stable Video Diffusion.",
|
| 611 |
+
"Let's create a video! Tell me what you want to see in motion, and I'll generate it using advanced video synthesis."
|
| 612 |
]
|
| 613 |
};
|
| 614 |
|
|
|
|
| 629 |
if(/(optim|optimize|search|find|best|solve|minimize)/.test(msg)) return "optimize";
|
| 630 |
if(/(key|crypto|encrypt|sign|secure|lattice)/.test(msg)) return "crypto";
|
| 631 |
if(/(predict|forecast|guess|what will|future)/.test(msg)) return "predict";
|
| 632 |
+
if(/(generate image|create image|make image|draw|picture|photo|image)/.test(msg)) return "image_generation";
|
| 633 |
+
if(/(generate video|create video|make video|film|animation|video)/.test(msg)) return "video_generation";
|
| 634 |
if(/(novel|book|literature|fiction|story|read|author|tolkien|austen|orwell|asimov|dickens|tolstoy)/.test(msg)) return "novel";
|
| 635 |
if(/(education|school|teach|learn|university|study|mathematics|math|science|history|knowledge)/.test(msg)) return "education";
|
| 636 |
if(/(govern|politics|government|state|policy|law|democracy|republic|nation|aristotle|rousseau|marx)/.test(msg)) return "governance";
|
|
|
|
| 893 |
btn.classList.add('active');
|
| 894 |
|
| 895 |
if (tabName === 'chat' && document.getElementById("chat-messages").children.length === 0) {
|
| 896 |
+
addMessage('Xe: Hey! I\'m Xe, your post-quantum AI buddy. Chat with me naturally, or switch to Knowledge & Tools for quick domains and document uploads. Try "generate image of a sunset" or "create video of a cat"!', 'bot');
|
| 897 |
}
|
| 898 |
if (tabName === 'wallet') {
|
| 899 |
updateWalletStats();
|
|
|
|
| 1128 |
const filepath = m.slice(5).trim();
|
| 1129 |
response = "Reading " + filepath + "...\n[File content extraction requires server-side processing in the full backend.]";
|
| 1130 |
}
|
| 1131 |
+
else if (m === "help") {
|
| 1132 |
+
response = "Commands: plans, subscribe <free|white|black>, my plan, cancel subscription, admin on/off, train, train hard, train offline, train online on/off, train xe, optimize, key, predict, read <path>, brain status, brain analyze, brain forget, brain train, voice on/off, wallet, trade, balance [currency], convert <amount> <currency>, profit, maintenance start/stop/status, self heal, autonomous upgrade, generate image <prompt>, generate video <prompt>, quit. Or just chat naturally! Mathematics works directly in chat: arithmetic, algebra, calculus, number theory, geometry, statistics, discrete math, matrices, vectors, ODEs, series, complex numbers β all with full precision and step-by-step solutions.";
|
| 1133 |
+
}
|
| 1134 |
else {
|
| 1135 |
const intent = understand(msg);
|
| 1136 |
response = respond(intent, msg);
|
|
|
|
| 1201 |
: 'Admin mode <b>OFF</b> β features now follow your active plan.';
|
| 1202 |
}
|
| 1203 |
|
| 1204 |
+
/* ===== Media Generation ===== */
|
| 1205 |
+
let generationHistory = [];
|
| 1206 |
+
|
| 1207 |
+
function generateImage() {
|
| 1208 |
+
const prompt = document.getElementById('image-prompt').value.trim();
|
| 1209 |
+
if (!prompt) {
|
| 1210 |
+
alert('Please enter an image description');
|
| 1211 |
+
return;
|
| 1212 |
+
}
|
| 1213 |
+
|
| 1214 |
+
const provider = document.getElementById('image-provider').value;
|
| 1215 |
+
const size = document.getElementById('image-size').value;
|
| 1216 |
+
const style = document.getElementById('image-style').value;
|
| 1217 |
+
const output = document.getElementById('image-output');
|
| 1218 |
+
|
| 1219 |
+
output.innerHTML = '<span style="color:var(--accent)">π¨ Generating image...</span>';
|
| 1220 |
+
|
| 1221 |
+
setTimeout(() => {
|
| 1222 |
+
const requestId = 'img_' + Date.now().toString(36);
|
| 1223 |
+
const result = {
|
| 1224 |
+
id: requestId,
|
| 1225 |
+
type: 'image',
|
| 1226 |
+
prompt: prompt,
|
| 1227 |
+
provider: provider,
|
| 1228 |
+
size: size,
|
| 1229 |
+
style: style,
|
| 1230 |
+
timestamp: new Date().toLocaleString(),
|
| 1231 |
+
status: 'completed'
|
| 1232 |
+
};
|
| 1233 |
+
|
| 1234 |
+
generationHistory.unshift(result);
|
| 1235 |
+
if (generationHistory.length > 20) generationHistory.pop();
|
| 1236 |
+
updateGenerationHistory();
|
| 1237 |
+
|
| 1238 |
+
output.innerHTML = `<strong>β
Image Generated!</strong><br>
|
| 1239 |
+
<strong>ID:</strong> ${requestId}<br>
|
| 1240 |
+
<strong>Prompt:</strong> ${prompt}<br>
|
| 1241 |
+
<strong>Provider:</strong> ${provider}<br>
|
| 1242 |
+
<strong>Size:</strong> ${size}<br>
|
| 1243 |
+
<strong>Style:</strong> ${style}<br>
|
| 1244 |
+
<strong>Status:</strong> Ready for download<br>
|
| 1245 |
+
<em style="color:var(--text-dim)">Note: Connect to Stability AI, Flux, or DALL-E API for real generation</em>`;
|
| 1246 |
+
}, 2000);
|
| 1247 |
+
}
|
| 1248 |
+
|
| 1249 |
+
function generateVideo() {
|
| 1250 |
+
const prompt = document.getElementById('video-prompt').value.trim();
|
| 1251 |
+
if (!prompt) {
|
| 1252 |
+
alert('Please enter a video description');
|
| 1253 |
+
return;
|
| 1254 |
+
}
|
| 1255 |
+
|
| 1256 |
+
const provider = document.getElementById('video-provider').value;
|
| 1257 |
+
const duration = document.getElementById('video-duration').value;
|
| 1258 |
+
const fps = document.getElementById('video-fps').value;
|
| 1259 |
+
const output = document.getElementById('video-output');
|
| 1260 |
+
|
| 1261 |
+
output.innerHTML = '<span style="color:var(--accent-green)">π¬ Generating video...</span>';
|
| 1262 |
+
|
| 1263 |
+
setTimeout(() => {
|
| 1264 |
+
const requestId = 'vid_' + Date.now().toString(36);
|
| 1265 |
+
const result = {
|
| 1266 |
+
id: requestId,
|
| 1267 |
+
type: 'video',
|
| 1268 |
+
prompt: prompt,
|
| 1269 |
+
provider: provider,
|
| 1270 |
+
duration: duration + 's',
|
| 1271 |
+
fps: fps,
|
| 1272 |
+
timestamp: new Date().toLocaleString(),
|
| 1273 |
+
status: 'completed'
|
| 1274 |
+
};
|
| 1275 |
+
|
| 1276 |
+
generationHistory.unshift(result);
|
| 1277 |
+
if (generationHistory.length > 20) generationHistory.pop();
|
| 1278 |
+
updateGenerationHistory();
|
| 1279 |
+
|
| 1280 |
+
output.innerHTML = `<strong>β
Video Generated!</strong><br>
|
| 1281 |
+
<strong>ID:</strong> ${requestId}<br>
|
| 1282 |
+
<strong>Prompt:</strong> ${prompt}<br>
|
| 1283 |
+
<strong>Provider:</strong> ${provider}<br>
|
| 1284 |
+
<strong>Duration:</strong> ${duration}s<br>
|
| 1285 |
+
<strong>FPS:</strong> ${fps}<br>
|
| 1286 |
+
<strong>Frames:</strong> ${parseInt(duration) * parseInt(fps)}<br>
|
| 1287 |
+
<strong>Status:</strong> Ready for download<br>
|
| 1288 |
+
<em style="color:var(--text-dim)">Note: Connect to Runway, Pika, or SVD API for real generation</em>`;
|
| 1289 |
+
}, 3000);
|
| 1290 |
+
}
|
| 1291 |
+
|
| 1292 |
+
function updateGenerationHistory() {
|
| 1293 |
+
const container = document.getElementById('generation-history-content');
|
| 1294 |
+
if (!generationHistory.length) {
|
| 1295 |
+
container.innerHTML = 'No generations yet. Create your first image or video above!';
|
| 1296 |
+
return;
|
| 1297 |
+
}
|
| 1298 |
+
|
| 1299 |
+
container.innerHTML = generationHistory.map(item => `
|
| 1300 |
+
<div style="padding:8px; margin:4px 0; background:var(--bg-primary); border-radius:4px; border-left:3px solid ${item.type === 'image' ? 'var(--accent)' : 'var(--accent-green)'}">
|
| 1301 |
+
<strong>${item.type === 'image' ? 'π¨' : 'π¬'} ${item.id}</strong> - ${item.timestamp}<br>
|
| 1302 |
+
<em>${item.prompt.substring(0, 60)}${item.prompt.length > 60 ? '...' : ''}</em><br>
|
| 1303 |
+
<small>Provider: ${item.provider} | Status: ${item.status}</small>
|
| 1304 |
+
</div>
|
| 1305 |
+
`).join('');
|
| 1306 |
+
}
|
| 1307 |
+
|
| 1308 |
renderSubscriptions();
|
| 1309 |
</script>
|
| 1310 |
</body>
|