vidbye commited on
Commit
4e32346
·
verified ·
1 Parent(s): ee11846

Update hf.js

Browse files
Files changed (1) hide show
  1. hf.js +1 -292
hf.js CHANGED
@@ -1250,82 +1250,6 @@ app.get('/', (req, res) => {
1250
  color: var(--text-muted);
1251
  }
1252
 
1253
- .modal-backdrop {
1254
- position: fixed;
1255
- top: 0;
1256
- left: 0;
1257
- right: 0;
1258
- bottom: 0;
1259
- background-color: rgba(0, 0, 0, 0.5);
1260
- display: flex;
1261
- align-items: center;
1262
- justify-content: center;
1263
- z-index: 50;
1264
- backdrop-filter: var(--backdrop-blur);
1265
- transition: all 0.3s ease;
1266
- }
1267
-
1268
- .modal {
1269
- background-color: var(--bg-card);
1270
- border-radius: 0.75rem;
1271
- width: 90%;
1272
- max-width: 500px;
1273
- max-height: 90vh;
1274
- overflow-y: auto;
1275
- box-shadow: 0 10px 25px var(--shadow-color);
1276
- animation: fadeInUp 0.3s ease;
1277
- }
1278
-
1279
- .modal-header {
1280
- padding: 1.25rem;
1281
- border-bottom: 1px solid var(--border-color);
1282
- display: flex;
1283
- align-items: center;
1284
- justify-content: space-between;
1285
- }
1286
-
1287
- .modal-title {
1288
- font-size: 1.25rem;
1289
- font-weight: 600;
1290
- color: var(--text-primary);
1291
- }
1292
-
1293
- .modal-body {
1294
- padding: 1.25rem;
1295
- }
1296
-
1297
- .modal-footer {
1298
- padding: 1.25rem;
1299
- border-top: 1px solid var(--border-color);
1300
- display: flex;
1301
- justify-content: flex-end;
1302
- gap: 0.75rem;
1303
- }
1304
-
1305
- .modal-close {
1306
- color: var(--text-muted);
1307
- cursor: pointer;
1308
- font-size: 1.25rem;
1309
- }
1310
-
1311
- .modal-close:hover {
1312
- color: var(--text-primary);
1313
- }
1314
-
1315
- /* Custom scrollbar for chat */
1316
- .chat-body::-webkit-scrollbar {
1317
- width: 6px;
1318
- }
1319
-
1320
- .chat-body::-webkit-scrollbar-track {
1321
- background: transparent;
1322
- }
1323
-
1324
- .chat-body::-webkit-scrollbar-thumb {
1325
- background-color: var(--border-color);
1326
- border-radius: 3px;
1327
- }
1328
-
1329
  .markdown-content {
1330
  color: inherit;
1331
  line-height: 1.5;
@@ -1863,15 +1787,6 @@ app.get('/', (req, res) => {
1863
  </select>
1864
  </div>
1865
  </div>
1866
- <div class="settings-row">
1867
- <div>
1868
- <div class="settings-label">Default Parameters</div>
1869
- <div class="settings-description">Set default generation parameters.</div>
1870
- </div>
1871
- <div class="settings-control">
1872
- <a href="#" class="text-primary-light" id="edit-params-btn">Edit Parameters</a>
1873
- </div>
1874
- </div>
1875
  </div>
1876
 
1877
  <div class="card mt-6">
@@ -1996,7 +1911,7 @@ app.get('/', (req, res) => {
1996
  </div>
1997
  <div>
1998
  <h4 class="font-semibold">Can I customize the model parameters?</h4>
1999
- <p class="text-gray-400">Yes, you can adjust temperature and other parameters in the chat interface or set defaults in the Settings section.</p>
2000
  </div>
2001
  </div>
2002
  </div>
@@ -2004,56 +1919,6 @@ app.get('/', (req, res) => {
2004
  </main>
2005
  </div>
2006
 
2007
- <!-- Parameters Modal (Hidden by default) -->
2008
- <div id="params-modal" class="modal-backdrop hidden">
2009
- <div class="modal">
2010
- <div class="modal-header">
2011
- <h3 class="modal-title">Default Model Parameters</h3>
2012
- <div class="modal-close" id="close-params-modal">
2013
- <i class="fas fa-times"></i>
2014
- </div>
2015
- </div>
2016
- <div class="modal-body">
2017
- <div class="parameter-row">
2018
- <div class="parameter-control">
2019
- <div class="parameter-label">
2020
- <span class="parameter-name">Temperature</span>
2021
- <span class="parameter-value" id="modal-temp-value">0.7</span>
2022
- </div>
2023
- <input type="range" id="modal-temperature" min="0" max="2" step="0.1" value="0.7">
2024
- <p class="mt-1 text-xs text-gray-400">Controls randomness: Lower is more deterministic, higher is more creative.</p>
2025
- </div>
2026
- </div>
2027
-
2028
- <div class="parameter-row">
2029
- <div class="parameter-control">
2030
- <div class="parameter-label">
2031
- <span class="parameter-name">Top P</span>
2032
- <span class="parameter-value" id="modal-top-p-value">1.0</span>
2033
- </div>
2034
- <input type="range" id="modal-top-p" min="0" max="1" step="0.05" value="1.0">
2035
- <p class="mt-1 text-xs text-gray-400">Alternative to temperature, controls diversity of responses.</p>
2036
- </div>
2037
- </div>
2038
-
2039
- <div class="parameter-row">
2040
- <div class="parameter-control">
2041
- <div class="parameter-label">
2042
- <span class="parameter-name">Max Tokens</span>
2043
- <span class="parameter-value" id="modal-max-tokens-value">2048</span>
2044
- </div>
2045
- <input type="range" id="modal-max-tokens" min="256" max="8192" step="256" value="2048">
2046
- <p class="mt-1 text-xs text-gray-400">Maximum length of response.</p>
2047
- </div>
2048
- </div>
2049
- </div>
2050
- <div class="modal-footer">
2051
- <button class="btn outline" id="reset-params-btn">Reset to Defaults</button>
2052
- <button class="btn" id="save-params-btn">Save Changes</button>
2053
- </div>
2054
- </div>
2055
- </div>
2056
-
2057
  <script>
2058
  // Declare global variables
2059
  let chatHistory = [];
@@ -2074,9 +1939,6 @@ app.get('/', (req, res) => {
2074
 
2075
  // Initialize the dashboard
2076
  document.addEventListener('DOMContentLoaded', function() {
2077
- // Clear any potential startup modals that might be blocking access
2078
- forceCloseAllModals();
2079
-
2080
  // Load saved settings
2081
  loadSettings();
2082
 
@@ -2162,53 +2024,6 @@ app.get('/', (req, res) => {
2162
  toggleDarkMode(this.checked);
2163
  });
2164
 
2165
- // Set up parameters modal with proper close handlers
2166
- document.getElementById('edit-params-btn').addEventListener('click', (e) => {
2167
- e.preventDefault();
2168
- openModal('params-modal');
2169
- updateModalValues();
2170
- });
2171
-
2172
- // Enhanced close functionality for the parameters modal
2173
- setupModalCloseHandlers('params-modal', 'close-params-modal');
2174
-
2175
- // Add click event to close modal when clicking outside
2176
- document.getElementById('params-modal').addEventListener('click', (e) => {
2177
- if (e.target.id === 'params-modal') {
2178
- closeModal('params-modal');
2179
- }
2180
- });
2181
-
2182
- // Add ESC key handler to close modals
2183
- document.addEventListener('keydown', (e) => {
2184
- if (e.key === 'Escape') {
2185
- closeAllModals();
2186
- }
2187
- });
2188
-
2189
- document.getElementById('modal-temperature').addEventListener('input', (e) => {
2190
- document.getElementById('modal-temp-value').textContent = e.target.value;
2191
- });
2192
-
2193
- document.getElementById('modal-top-p').addEventListener('input', (e) => {
2194
- document.getElementById('modal-top-p-value').textContent = e.target.value;
2195
- });
2196
-
2197
- document.getElementById('modal-max-tokens').addEventListener('input', (e) => {
2198
- document.getElementById('modal-max-tokens-value').textContent = e.target.value;
2199
- });
2200
-
2201
- document.getElementById('reset-params-btn').addEventListener('click', () => {
2202
- resetParameters();
2203
- updateModalValues();
2204
- });
2205
-
2206
- document.getElementById('save-params-btn').addEventListener('click', () => {
2207
- saveParameters();
2208
- closeModal('params-modal');
2209
- showToast('Saved', 'Default parameters updated', 'success');
2210
- });
2211
-
2212
  // Set up refresh models button
2213
  document.getElementById('refresh-models-btn').addEventListener('click', fetchModels);
2214
 
@@ -2224,76 +2039,8 @@ app.get('/', (req, res) => {
2224
  if (typeof tippy !== 'undefined') {
2225
  tippy('[data-tippy-content]');
2226
  }
2227
-
2228
- // Force close any potential initial modals again after 500ms
2229
- setTimeout(forceCloseAllModals, 500);
2230
  });
2231
 
2232
- // Force close all modals
2233
- function forceCloseAllModals() {
2234
- document.querySelectorAll('.modal-backdrop').forEach(modal => {
2235
- modal.classList.add('hidden');
2236
- });
2237
- console.log('Closed all modals');
2238
- }
2239
-
2240
- // Close all modals
2241
- function closeAllModals() {
2242
- document.querySelectorAll('.modal-backdrop').forEach(modal => {
2243
- closeModal(modal.id);
2244
- });
2245
- }
2246
-
2247
- // Open modal
2248
- function openModal(modalId) {
2249
- const modal = document.getElementById(modalId);
2250
- if (modal) {
2251
- modal.classList.remove('hidden');
2252
- }
2253
- }
2254
-
2255
- // Close modal
2256
- function closeModal(modalId) {
2257
- const modal = document.getElementById(modalId);
2258
- if (modal) {
2259
- modal.classList.add('hidden');
2260
- }
2261
- }
2262
-
2263
- // Setup modal close handlers
2264
- function setupModalCloseHandlers(modalId, closeButtonId) {
2265
- // Close button
2266
- const closeButton = document.getElementById(closeButtonId);
2267
- if (closeButton) {
2268
- closeButton.addEventListener('click', () => {
2269
- closeModal(modalId);
2270
- });
2271
-
2272
- // Add direct extra handlers
2273
- closeButton.onclick = function() {
2274
- closeModal(modalId);
2275
- };
2276
- }
2277
-
2278
- // Add clickable backdrop closing
2279
- const modal = document.getElementById(modalId);
2280
- if (modal) {
2281
- modal.addEventListener('click', (e) => {
2282
- if (e.target === modal) {
2283
- closeModal(modalId);
2284
- }
2285
- });
2286
- }
2287
-
2288
- // Save button acts as close too
2289
- const saveButton = document.querySelector('#' + modalId + ' #save-params-btn');
2290
- if (saveButton) {
2291
- saveButton.addEventListener('click', () => {
2292
- closeModal(modalId);
2293
- });
2294
- }
2295
- }
2296
-
2297
  // Toggle dark mode
2298
  function toggleDarkMode(forceDark) {
2299
  if (typeof forceDark === 'boolean') {
@@ -2345,41 +2092,6 @@ app.get('/', (req, res) => {
2345
  }
2346
  }
2347
 
2348
- // Update modal values
2349
- function updateModalValues() {
2350
- document.getElementById('modal-temperature').value = modelParams.temperature;
2351
- document.getElementById('modal-temp-value').textContent = modelParams.temperature;
2352
-
2353
- document.getElementById('modal-top-p').value = modelParams.top_p;
2354
- document.getElementById('modal-top-p-value').textContent = modelParams.top_p;
2355
-
2356
- document.getElementById('modal-max-tokens').value = modelParams.max_tokens;
2357
- document.getElementById('modal-max-tokens-value').textContent = modelParams.max_tokens;
2358
- }
2359
-
2360
- // Reset parameters to defaults
2361
- function resetParameters() {
2362
- modelParams = {
2363
- temperature: 0.7,
2364
- top_p: 1.0,
2365
- max_tokens: 2048
2366
- };
2367
- }
2368
-
2369
- // Save parameters
2370
- function saveParameters() {
2371
- modelParams.temperature = parseFloat(document.getElementById('modal-temperature').value);
2372
- modelParams.top_p = parseFloat(document.getElementById('modal-top-p').value);
2373
- modelParams.max_tokens = parseInt(document.getElementById('modal-max-tokens').value);
2374
-
2375
- // Save to localStorage
2376
- localStorage.setItem('model-params', JSON.stringify(modelParams));
2377
-
2378
- // Update UI
2379
- document.getElementById('temp-value').textContent = modelParams.temperature;
2380
- document.getElementById('temperature').value = modelParams.temperature;
2381
- }
2382
-
2383
  // Initialize chat functionality
2384
  function initChat() {
2385
  const messageInput = document.getElementById('message-input');
@@ -3288,9 +3000,6 @@ app.get('/', (req, res) => {
3288
  // Show toast
3289
  showToast('Exported', 'Conversation exported successfully', 'success');
3290
  }
3291
-
3292
- // Immediately close any modals on load
3293
- setTimeout(forceCloseAllModals, 100);
3294
  </script>
3295
  </body>
3296
  </html>
 
1250
  color: var(--text-muted);
1251
  }
1252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1253
  .markdown-content {
1254
  color: inherit;
1255
  line-height: 1.5;
 
1787
  </select>
1788
  </div>
1789
  </div>
 
 
 
 
 
 
 
 
 
1790
  </div>
1791
 
1792
  <div class="card mt-6">
 
1911
  </div>
1912
  <div>
1913
  <h4 class="font-semibold">Can I customize the model parameters?</h4>
1914
+ <p class="text-gray-400">Yes, you can adjust temperature in the chat interface.</p>
1915
  </div>
1916
  </div>
1917
  </div>
 
1919
  </main>
1920
  </div>
1921
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1922
  <script>
1923
  // Declare global variables
1924
  let chatHistory = [];
 
1939
 
1940
  // Initialize the dashboard
1941
  document.addEventListener('DOMContentLoaded', function() {
 
 
 
1942
  // Load saved settings
1943
  loadSettings();
1944
 
 
2024
  toggleDarkMode(this.checked);
2025
  });
2026
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2027
  // Set up refresh models button
2028
  document.getElementById('refresh-models-btn').addEventListener('click', fetchModels);
2029
 
 
2039
  if (typeof tippy !== 'undefined') {
2040
  tippy('[data-tippy-content]');
2041
  }
 
 
 
2042
  });
2043
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2044
  // Toggle dark mode
2045
  function toggleDarkMode(forceDark) {
2046
  if (typeof forceDark === 'boolean') {
 
2092
  }
2093
  }
2094
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2095
  // Initialize chat functionality
2096
  function initChat() {
2097
  const messageInput = document.getElementById('message-input');
 
3000
  // Show toast
3001
  showToast('Exported', 'Conversation exported successfully', 'success');
3002
  }
 
 
 
3003
  </script>
3004
  </body>
3005
  </html>