5dimension commited on
Commit
ceb3963
·
verified ·
1 Parent(s): 1acf170
Files changed (1) hide show
  1. index.html +210 -41
index.html CHANGED
@@ -61,7 +61,6 @@
61
  }
62
  }
63
  }
64
-
65
  // Configuration
66
  const CONFIG = {
67
  HF_API_URL: "https://api-inference.huggingface.co/models/",
@@ -71,6 +70,21 @@
71
  HISTORY_SIZE: 20
72
  };
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  const PROMPT_TEMPLATES = {
75
  "standard": `[INST] You are NeuroCognitive Terminal v9.24.6. Provide detailed technical analysis with references.
76
  Break response into clear sections with markdown formatting. Current date: ${new Date().toISOString()}
@@ -81,14 +95,154 @@ Query: {query} Consider these unexpected angles:[/INST]`,
81
  Query: {query} Include: 1) Technical requirements 2) Implementation steps 3) Sample code[/INST]`
82
  };
83
 
84
- // State management
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  const AppState = {
86
  history: JSON.parse(localStorage.getItem('terminalHistory')) || [],
87
  lastRequestTime: 0,
88
  currentModel: CONFIG.DEFAULT_MODEL,
89
- apiKey: localStorage.getItem('hfApiKey') || ''
 
 
 
 
 
 
 
90
  };
91
- </script>
92
  </head>
93
  <body class="bg-gray-900 overflow-hidden font-terminal min-h-screen">
94
  <div class="crt h-screen relative flex flex-col bg-gradient-to-br from-black to-gray-900">
@@ -203,43 +357,52 @@ Query: {query} Include: 1) Technical requirements 2) Implementation steps 3) Sam
203
  </div>
204
  </div>
205
  </div>
206
-
207
- <div class="absolute bottom-0 left-0 right-0 bg-black/60 border-t border-green-900 p-4">
208
  <div class="flex items-center">
209
  <div class="text-green-500 mr-3 font-bold">user@terminal:~$</div>
210
  <div class="flex-grow flex items-center border border-green-700 bg-black/30">
211
  <select class="bg-black text-green-400 px-2 h-full border-r border-green-800">
212
- <option value="standard">Standard</option>
213
- <option value="creative">Creative</option>
214
- <option value="technical">Technical</option>
215
- </select>
216
- <input id="promptInput" type="text" class="flex-grow bg-transparent outline-none px-2 py-1 text-green-300" placeholder="Enter cognitive query...">
217
- <div class="h-full bg-green-500/30 px-3 font-mono flex items-center">
218
- <div class="inline-block w-4 h-6 bg-green-400 prompt"></div>
219
- </div>
220
- </div>
221
- <button onclick="TerminalApp.executePrompt()" class="ml-3 px-4 py-1 bg-green-700 hover:bg-green-600 text-cyan-100 font-bold rounded-sm">Execute</button>
222
- </div>
223
-
224
- <div class="mt-3 flex justify-between text-xs text-cyan-400">
225
- <div class="flex items-center">
226
- <i class="fas fa-brain mr-1"></i>
227
- <span>LLM: <span id="llmStatus" class="text-green-400">${CONFIG.DEFAULT_MODEL.split('/').pop()}</span></span>
228
- </div>
229
- <div class="flex items-center">
230
- <i class="fas fa-bolt mr-1"></i>
231
- <span>Tokens: <span id="tokenCounter">0</span>/2048</span>
232
- </div>
233
- <div class="flex items-center">
234
- <i class="fas fa-database mr-1"></i>
235
- <span>Context: <span id="contextStatus">Ready</span></span>
236
- </div>
237
- <div class="text-yellow-400 font-bold flex items-center">
238
- <i class="fas fa-star mr-1"></i>
239
- <span>Score: <span id="aiScore">+30</span></span>
240
- </div>
241
  </div>
242
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  </div>
244
 
245
  <!-- Settings Modal -->
@@ -408,7 +571,13 @@ Query: {query} Include: 1) Technical requirements 2) Implementation steps 3) Sam
408
  } else {
409
  responseText = JSON.stringify(response, null, 2);
410
  }
411
- const terminalOutput = document.querySelector('.terminal-scrollbar');
 
 
 
 
 
 
412
  const responseDiv = document.createElement('div');
413
  responseDiv.className = 'mb-4';
414
  terminalOutput.appendChild(responseDiv);
@@ -511,7 +680,6 @@ Query: {query} Include: 1) Technical requirements 2) Implementation steps 3) Sam
511
  TerminalUI.toggleLoading(false);
512
  }
513
  }
514
-
515
  static init() {
516
  // Load settings
517
  const settingsButton = document.createElement('div');
@@ -523,14 +691,16 @@ Query: {query} Include: 1) Technical requirements 2) Implementation steps 3) Sam
523
  `;
524
  document.body.appendChild(settingsButton);
525
 
 
 
 
526
  // Display initial history if any
527
  if (AppState.history.length > 0) {
528
  const lastEntry = AppState.history[0];
529
  TerminalUI.streamResponse(lastEntry.response, lastEntry.prompt);
530
  }
531
  }
532
-
533
- static showSettings() {
534
  const modal = document.getElementById('settingsModal');
535
  document.getElementById('hfApiKeyInput').value = AppState.apiKey;
536
  modal.classList.remove('hidden');
@@ -624,11 +794,10 @@ Query: {query} Include: 1) Technical requirements 2) Implementation steps 3) Sam
624
  }
625
  }
626
  }
627
-
628
  // Initialize app
629
  document.addEventListener('DOMContentLoaded', () => {
630
  TerminalApp.init();
631
  });
632
- </script>
633
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=5dimension/terminal" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
634
  </html>
 
61
  }
62
  }
63
  }
 
64
  // Configuration
65
  const CONFIG = {
66
  HF_API_URL: "https://api-inference.huggingface.co/models/",
 
70
  HISTORY_SIZE: 20
71
  };
72
 
73
+ // Game Configuration
74
+ const GAME_CONFIG = {
75
+ XP_PER_TOKEN: 0.1,
76
+ XP_PER_QUERY: 5,
77
+ BONUS_XP_CREATIVE: 10,
78
+ BONUS_XP_TECHNICAL: 15,
79
+ LEVEL_UP_MULTIPLIER: 1.5,
80
+ ACHIEVEMENTS: {
81
+ FIRST_QUERY: { name: "First Query", xp: 25 },
82
+ CREATIVE_THINKER: { name: "Creative Thinker", xp: 50 },
83
+ TECHNICAL_EXPERT: { name: "Technical Expert", xp: 75 },
84
+ POWER_USER: { name: "Power User", xp: 100 },
85
+ MASTER_PROMPTER: { name: "Master Prompter", xp: 150 }
86
+ }
87
+ };
88
  const PROMPT_TEMPLATES = {
89
  "standard": `[INST] You are NeuroCognitive Terminal v9.24.6. Provide detailed technical analysis with references.
90
  Break response into clear sections with markdown formatting. Current date: ${new Date().toISOString()}
 
95
  Query: {query} Include: 1) Technical requirements 2) Implementation steps 3) Sample code[/INST]`
96
  };
97
 
98
+ // Game Mechanics
99
+ class GameManager {
100
+ static calculateXP(tokens, mode) {
101
+ let xp = GAME_CONFIG.XP_PER_QUERY + (tokens * GAME_CONFIG.XP_PER_TOKEN);
102
+
103
+ if (mode === 'creative') {
104
+ xp += GAME_CONFIG.BONUS_XP_CREATIVE;
105
+ } else if (mode === 'technical') {
106
+ xp += GAME_CONFIG.BONUS_XP_TECHNICAL;
107
+ }
108
+
109
+ return Math.round(xp);
110
+ }
111
+
112
+ static levelUp(currentLevel) {
113
+ return Math.floor(100 * Math.pow(GAME_CONFIG.LEVEL_UP_MULTIPLIER, currentLevel - 1));
114
+ }
115
+
116
+ static addXP(xp) {
117
+ const stats = AppState.playerStats;
118
+ stats.xp += xp;
119
+ stats.totalTokens += tokens;
120
+ stats.totalQueries += 1;
121
+
122
+ const nextLevelXP = this.levelUp(stats.level);
123
+ if (stats.xp >= nextLevelXP) {
124
+ stats.level += 1;
125
+ stats.xp -= nextLevelXP;
126
+ this.showLevelUp(stats.level);
127
+ }
128
+
129
+ this.updateUI();
130
+ localStorage.setItem('playerStats', JSON.stringify(AppState.playerStats));
131
+ }
132
+
133
+ static updateUI() {
134
+ const stats = AppState.playerStats;
135
+ const nextLevelXP = this.levelUp(stats.level);
136
+
137
+ document.getElementById('playerLevel').textContent = stats.level;
138
+ document.getElementById('currentXP').textContent = stats.xp;
139
+ document.getElementById('nextLevelXP').textContent = nextLevelXP;
140
+ document.getElementById('xpProgress').style.width = `${(stats.xp / nextLevelXP) * 100}%`;
141
+ document.getElementById('aiScore').textContent = `+${stats.totalQueries * 10}`;
142
+
143
+ const progressPercent = (stats.xp / nextLevelXP) * 100;
144
+ const progressBar = document.getElementById('xpProgress');
145
+ progressBar.style.width = `${progressPercent}%`;
146
+
147
+ // Color change based on level
148
+ if (stats.level >= 10) {
149
+ progressBar.className = 'h-full bg-gradient-to-r from-yellow-500 to-red-500 transition-all duration-500';
150
+ } else if (stats.level >= 5) {
151
+ progressBar.className = 'h-full bg-gradient-to-r from-purple-500 to-pink-500 transition-all duration-500';
152
+ } else {
153
+ progressBar.className = 'h-full bg-gradient-to-r from-blue-500 to-purple-500 transition-all duration-500';
154
+ }
155
+ }
156
+
157
+ static showLevelUp(newLevel) {
158
+ const terminalOutput = document.querySelector('.terminal-scrollbar');
159
+ const levelUpDiv = document.createElement('div');
160
+ levelUpDiv.className = 'mb-4 text-center';
161
+ levelUpDiv.innerHTML = `
162
+ <div class="border-2 border-yellow-500 bg-yellow-900/20 p-4 rounded-lg animate-pulse';
163
+ <div class="text-yellow-400 text-xl font-bold mb-1">LEVEL UP!</div>
164
+ <div class="text-green-300 text-lg">Reached Level ${newLevel}</div>
165
+ <div class="text-cyan-300 text-sm mt-1">New capabilities unlocked!</div>
166
+ `;
167
+ terminalOutput.appendChild(levelUpDiv);
168
+ terminalOutput.scrollTop = terminalOutput.scrollHeight;
169
+
170
+ // Show celebration effect
171
+ const particles = document.createElement('div');
172
+ particles.className = 'fixed inset-0 pointer-events-none z-20';
173
+ particles.innerHTML = `
174
+ <div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2';
175
+ ${Array.from({length: 20}, (_, i) => `
176
+ <div class="absolute w-2 h-2 bg-yellow-400 rounded-full animate-bounce"
177
+ style="animation-delay: ${i * 0.1}s">
178
+ </div>
179
+ `;
180
+ document.body.appendChild(particles);
181
+ setTimeout(() => particles.remove(), 3000);
182
+ }
183
+
184
+ static checkAchievements() {
185
+ const stats = AppState.playerStats;
186
+ const achievements = [];
187
+
188
+ if (stats.totalQueries >= 1 && !stats.achievements.includes('FIRST_QUERY')) {
189
+ achievements.push('FIRST_QUERY');
190
+ }
191
+ if (stats.totalQueries >= 10 && !stats.achievements.includes('CREATIVE_THINKER')) {
192
+ achievements.push('CREATIVE_THINKER');
193
+ }
194
+ if (stats.totalQueries >= 25 && !stats.achievements.includes('TECHNICAL_EXPERT')) {
195
+ achievements.push('TECHNICAL_EXPERT');
196
+ }
197
+ if (stats.totalTokens >= 10000 && !stats.achievements.includes('POWER_USER')) {
198
+ achievements.push('POWER_USER');
199
+ }
200
+ if (stats.level >= 10 && !stats.achievements.includes('MASTER_PROMPTER')) {
201
+ achievements.push('MASTER_PROMPTER');
202
+ }
203
+
204
+ achievements.forEach(achievement => {
205
+ this.unlockAchievement(achievement);
206
+ });
207
+ }
208
+
209
+ static unlockAchievement(key) {
210
+ const achievement = GAME_CONFIG.ACHIEVEMENTS[key];
211
+ if (achievement && !AppState.playerStats.achievements.includes(key)) {
212
+ AppState.playerStats.achievements.push(key);
213
+ this.showAchievement(achievement);
214
+ this.addXP(achievement.xp);
215
+ }
216
+ }
217
+
218
+ static showAchievement(achievement) {
219
+ const terminalOutput = document.querySelector('.terminal-scrollbar');
220
+ const achievementDiv = document.createElement('div');
221
+ achievementDiv.className = 'mb-4 text-center bg-gradient-to-r from-purple-900/50 to-blue-900/50 border border-purple-500 p-4 rounded-lg';
222
+ achievementDiv.innerHTML = `
223
+ <div class="text-purple-400 text-lg font-bold mb-1">ACHIEVEMENT UNLOCKED!</div>
224
+ <div class="text-yellow-300 text-xl">${achievement.name}</div>
225
+ <div class="text-green-400 text-sm mt-1">+${achievement.xp} XP</div>
226
+ `;
227
+ terminalOutput.appendChild(achievementDiv);
228
+ terminalOutput.scrollTop = terminalOutput.scrollHeight;
229
+ }
230
+ }
231
+ // State management
232
  const AppState = {
233
  history: JSON.parse(localStorage.getItem('terminalHistory')) || [],
234
  lastRequestTime: 0,
235
  currentModel: CONFIG.DEFAULT_MODEL,
236
+ apiKey: localStorage.getItem('hfApiKey') || '',
237
+ playerStats: JSON.parse(localStorage.getItem('playerStats')) || {
238
+ level: 1,
239
+ xp: 0,
240
+ totalQueries: 0,
241
+ totalTokens: 0,
242
+ achievements: []
243
+ }
244
  };
245
+ </script>
246
  </head>
247
  <body class="bg-gray-900 overflow-hidden font-terminal min-h-screen">
248
  <div class="crt h-screen relative flex flex-col bg-gradient-to-br from-black to-gray-900">
 
357
  </div>
358
  </div>
359
  </div>
360
+ <div class="absolute bottom-0 left-0 right-0 bg-black/60 border-t border-green-900 p-4">
 
361
  <div class="flex items-center">
362
  <div class="text-green-500 mr-3 font-bold">user@terminal:~$</div>
363
  <div class="flex-grow flex items-center border border-green-700 bg-black/30">
364
  <select class="bg-black text-green-400 px-2 h-full border-r border-green-800">
365
+ <option value="standard">Standard</option>
366
+ <option value="creative">Creative</option>
367
+ <option value="technical">Technical</option>
368
+ </select>
369
+ <input id="promptInput" type="text" class="flex-grow bg-transparent outline-none px-2 py-1 text-green-300" placeholder="Enter cognitive query...">
370
+ <div class="h-full bg-green-500/30 px-3 font-mono flex items-center">
371
+ <div class="inline-block w-4 h-6 bg-green-400 prompt"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
  </div>
373
  </div>
374
+ <button onclick="TerminalApp.executePrompt()" class="ml-3 px-4 py-1 bg-green-700 hover:bg-green-600 text-cyan-100 font-bold rounded-sm">Execute</button>
375
+ </div>
376
+
377
+ <!-- XP Progress Bar -->
378
+ <div class="mt-3 mb-2">
379
+ <div class="flex justify-between text-xs text-cyan-400 mb-1">
380
+ <span>Level <span id="playerLevel">1</span></span>
381
+ <span><span id="currentXP">0</span>/<span id="nextLevelXP">100</span> XP</span>
382
+ </div>
383
+ <div class="w-full bg-black/50 h-2 rounded-full overflow-hidden">
384
+ <div id="xpProgress" class="h-full bg-gradient-to-r from-blue-500 to-purple-500 transition-all duration-500" style="width: 0%"></div>
385
+ </div>
386
+
387
+ <div class="flex justify-between text-xs text-cyan-400">
388
+ <div class="flex items-center">
389
+ <i class="fas fa-brain mr-1"></i>
390
+ <span>LLM: <span id="llmStatus" class="text-green-400">${CONFIG.DEFAULT_MODEL.split('/').pop()}</span></span>
391
+ </div>
392
+ <div class="flex items-center">
393
+ <i class="fas fa-bolt mr-1"></i>
394
+ <span>Tokens: <span id="tokenCounter">0</span>/2048</span>
395
+ </div>
396
+ <div class="flex items-center">
397
+ <i class="fas fa-database mr-1"></i>
398
+ <span>Context: <span id="contextStatus">Ready</span></span>
399
+ </div>
400
+ <div class="text-yellow-400 font-bold flex items-center">
401
+ <i class="fas fa-star mr-1"></i>
402
+ <span>Score: <span id="aiScore">+30</span></span>
403
+ </div>
404
+ </div>
405
+ </div>
406
  </div>
407
 
408
  <!-- Settings Modal -->
 
571
  } else {
572
  responseText = JSON.stringify(response, null, 2);
573
  }
574
+
575
+ // Award XP for this response
576
+ const mode = document.querySelector('select').value;
577
+ const xp = GameManager.calculateXP(responseText.length, mode);
578
+ GameManager.addXP(xp);
579
+ GameManager.checkAchievements();
580
+ const terminalOutput = document.querySelector('.terminal-scrollbar');
581
  const responseDiv = document.createElement('div');
582
  responseDiv.className = 'mb-4';
583
  terminalOutput.appendChild(responseDiv);
 
680
  TerminalUI.toggleLoading(false);
681
  }
682
  }
 
683
  static init() {
684
  // Load settings
685
  const settingsButton = document.createElement('div');
 
691
  `;
692
  document.body.appendChild(settingsButton);
693
 
694
+ // Initialize game UI
695
+ GameManager.updateUI();
696
+
697
  // Display initial history if any
698
  if (AppState.history.length > 0) {
699
  const lastEntry = AppState.history[0];
700
  TerminalUI.streamResponse(lastEntry.response, lastEntry.prompt);
701
  }
702
  }
703
+ static showSettings() {
 
704
  const modal = document.getElementById('settingsModal');
705
  document.getElementById('hfApiKeyInput').value = AppState.apiKey;
706
  modal.classList.remove('hidden');
 
794
  }
795
  }
796
  }
 
797
  // Initialize app
798
  document.addEventListener('DOMContentLoaded', () => {
799
  TerminalApp.init();
800
  });
801
+ </script>
802
  <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=5dimension/terminal" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
803
  </html>