ereniko commited on
Commit
fbefec9
·
unverified ·
1 Parent(s): 0d56bc3

v0.9.1: 'Works better on its own page' screen in the Space embed

Browse files
Files changed (5) hide show
  1. css/app.css +10 -0
  2. index.html +10 -0
  3. js/config.js +1 -1
  4. js/main.js +8 -1
  5. sw.js +1 -1
css/app.css CHANGED
@@ -718,3 +718,13 @@ code, pre, kbd, .mono, .tool-label, .crumbs, .vw-path, .hex, #terminal * { font-
718
  .hf-quick-actions { grid-column: 1 / -1; align-items: stretch; }
719
  .hf-quick-actions .hf-btn { width: 100%; }
720
  }
 
 
 
 
 
 
 
 
 
 
 
718
  .hf-quick-actions { grid-column: 1 / -1; align-items: stretch; }
719
  .hf-quick-actions .hf-btn { width: 100%; }
720
  }
721
+
722
+ /* shown instead of the app inside the Space page on huggingface.co */
723
+ .embed-gate { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); overflow-y: auto; }
724
+ .embed-gate[hidden] { display: none; }
725
+ .embed-gate-inner { max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
726
+ .embed-gate-inner img { border-radius: 16px; }
727
+ .embed-gate-inner h1 { margin: 6px 0 0; font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
728
+ .embed-gate-inner p { margin: 0; color: var(--text-2); line-height: 1.55; }
729
+ .embed-gate-btn { height: 44px; padding: 0 22px; font-size: 14px; border-radius: 12px; text-decoration: none; margin-top: 6px; }
730
+ .embed-gate-note { font-size: 12.5px; color: var(--text-3) !important; }
index.html CHANGED
@@ -135,6 +135,16 @@
135
  </section>
136
  </main>
137
 
 
 
 
 
 
 
 
 
 
 
138
  <div class="setup" id="setup" hidden>
139
  <div class="setup-inner">
140
  <div class="setup-brand"><img src="icon.svg" alt="" width="22" height="22"><span>LocalWebAgent</span></div>
 
135
  </section>
136
  </main>
137
 
138
+ <div class="embed-gate" id="embed-gate" hidden>
139
+ <div class="embed-gate-inner">
140
+ <img src="icon.svg" alt="" width="64" height="64">
141
+ <h1>Works better on its own page</h1>
142
+ <p>LocalWebAgent runs a whole Linux machine and keeps your models and files in your browser. Inside the Hugging Face page it can't save them properly or sign you in, so open it on its own page.</p>
143
+ <a class="btn primary embed-gate-btn" id="embed-gate-link" href="./" target="_blank" rel="noopener">Open LocalWebAgent</a>
144
+ <p class="embed-gate-note">Opens in a new tab. Bookmark it for next time.</p>
145
+ </div>
146
+ </div>
147
+
148
  <div class="setup" id="setup" hidden>
149
  <div class="setup-inner">
150
  <div class="setup-brand"><img src="icon.svg" alt="" width="22" height="22"><span>LocalWebAgent</span></div>
js/config.js CHANGED
@@ -1,5 +1,5 @@
1
  // Central configuration. Everything that pins a version or a location lives here.
2
- export const APP_VERSION = "0.9.0";
3
 
4
  // --- Local language models (loaded from the Hugging Face Hub, cached in Cache Storage) ---
5
  // Each runs on WebGPU through transformers.js. `chunks` is how many external weight files
 
1
  // Central configuration. Everything that pins a version or a location lives here.
2
+ export const APP_VERSION = "0.9.1";
3
 
4
  // --- Local language models (loaded from the Hugging Face Hub, cached in Cache Storage) ---
5
  // Each runs on WebGPU through transformers.js. `chunks` is how many external weight files
js/main.js CHANGED
@@ -3,7 +3,7 @@ import * as setup from "./setup.js";
3
  import { LLM } from "./llm.js";
4
  import { RemoteLLM, findPreset, loadApiKey, migrateLegacyKey } from "./remote-llm.js";
5
  import { createModelManager, avatarTile } from "./model-manager.js";
6
- import { freshAccessToken } from "./hf-auth.js";
7
  import { VM } from "./vm.js";
8
  import { Agent } from "./agent.js";
9
  import { renderMarkdown } from "./markdown.js";
@@ -120,6 +120,13 @@ let files = null;
120
 
121
  // ---------- boot ----------
122
  async function init() {
 
 
 
 
 
 
 
123
  $("#version").textContent = "v" + APP_VERSION;
124
  setBackendLabels();
125
  syncToggles();
 
3
  import { LLM } from "./llm.js";
4
  import { RemoteLLM, findPreset, loadApiKey, migrateLegacyKey } from "./remote-llm.js";
5
  import { createModelManager, avatarTile } from "./model-manager.js";
6
+ import { freshAccessToken, embedded, standaloneUrl } from "./hf-auth.js";
7
  import { VM } from "./vm.js";
8
  import { Agent } from "./agent.js";
9
  import { renderMarkdown } from "./markdown.js";
 
120
 
121
  // ---------- boot ----------
122
  async function init() {
123
+ // Inside the Space page on huggingface.co (an iframe) the app gets separate, partitioned
124
+ // storage and sign-in can't work, so send people to its own page instead of starting.
125
+ if (embedded()) {
126
+ $("#embed-gate-link").href = standaloneUrl();
127
+ $("#embed-gate").hidden = false;
128
+ return;
129
+ }
130
  $("#version").textContent = "v" + APP_VERSION;
131
  setBackendLabels();
132
  syncToggles();
sw.js CHANGED
@@ -6,7 +6,7 @@
6
  // (__vm__/disk.ext2), backed by the chunks the setup screen stored in Cache Storage.
7
  // 4. Adds the cross-origin isolation headers (COOP/COEP) that SharedArrayBuffer,
8
  // CheerpX and multi-threaded WASM need, even when a host forgets to send them.
9
- const SHELL_VERSION = "lwa-shell-0.9.0";
10
  const CX_ORIGIN = "https://cxrtnc.leaningtech.com";
11
  const CX_CACHE_PREFIX = "lwa-cheerpx-";
12
  const DISK_CACHE = "lwa-disk";
 
6
  // (__vm__/disk.ext2), backed by the chunks the setup screen stored in Cache Storage.
7
  // 4. Adds the cross-origin isolation headers (COOP/COEP) that SharedArrayBuffer,
8
  // CheerpX and multi-threaded WASM need, even when a host forgets to send them.
9
+ const SHELL_VERSION = "lwa-shell-0.9.1";
10
  const CX_ORIGIN = "https://cxrtnc.leaningtech.com";
11
  const CX_CACHE_PREFIX = "lwa-cheerpx-";
12
  const DISK_CACHE = "lwa-disk";