@galaxyproject/jupyterlite 0.0.29 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galaxyproject/jupyterlite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"static"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@playwright/test": "^1.52.0",
|
|
21
|
-
"axios": "^1.9.0",
|
|
22
21
|
"cpx": "^1.5.0",
|
|
23
22
|
"node-fetch": "^3.3.2",
|
|
24
23
|
"playwright": "^1.52.0",
|
|
@@ -248,55 +248,71 @@ function addFavicon(config) {
|
|
|
248
248
|
async function main() {
|
|
249
249
|
const config = await jupyterConfigData();
|
|
250
250
|
//__GXY__INJECTION__
|
|
251
|
+
const AI_SETTINGS = "@jupyterlite/ai:settings-model";
|
|
252
|
+
const PYODIDE_KERNEL = "@jupyterlite/pyodide-kernel-extension:kernel";
|
|
253
|
+
const searchParams = Object.fromEntries(new URL(window.location.href).searchParams.entries());
|
|
254
|
+
const galaxyRoot = searchParams.root || "/";
|
|
255
|
+
const galaxyApiBase = galaxyRoot + "api/plugins/jupyterlite";
|
|
256
|
+
|
|
257
|
+
// Intercept fetch to strip Authorization header for Galaxy API requests
|
|
258
|
+
const originalFetch = window.fetch;
|
|
259
|
+
const galaxyApiPath = galaxyApiBase.startsWith("http") ? new URL(galaxyApiBase).pathname : galaxyApiBase;
|
|
260
|
+
window.fetch = async function (url, init) {
|
|
261
|
+
// Normalize URL to pathname for comparison
|
|
262
|
+
let pathname;
|
|
263
|
+
if (typeof url === "string") {
|
|
264
|
+
pathname = url.startsWith("http") ? new URL(url).pathname : url;
|
|
265
|
+
} else if (url instanceof URL) {
|
|
266
|
+
pathname = url.pathname;
|
|
267
|
+
} else if (url instanceof Request) {
|
|
268
|
+
pathname = new URL(url.url).pathname;
|
|
269
|
+
} else {
|
|
270
|
+
pathname = String(url);
|
|
271
|
+
}
|
|
251
272
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
window.fetch = async function(url, init) {
|
|
260
|
-
let urlStr;
|
|
261
|
-
if (typeof url === "string") {
|
|
262
|
-
urlStr = url;
|
|
263
|
-
} else if (url instanceof URL) {
|
|
264
|
-
urlStr = url.toString();
|
|
265
|
-
} else if (url instanceof Request) {
|
|
266
|
-
urlStr = url.url;
|
|
267
|
-
} else {
|
|
268
|
-
urlStr = String(url);
|
|
273
|
+
// Check if this is a Galaxy API request
|
|
274
|
+
if (pathname.startsWith(galaxyApiPath)) {
|
|
275
|
+
// Handle Request objects with built-in headers
|
|
276
|
+
if (url instanceof Request) {
|
|
277
|
+
const headers = new Headers(url.headers);
|
|
278
|
+
headers.delete("Authorization");
|
|
279
|
+
url = new Request(url, { headers });
|
|
269
280
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
281
|
+
// Handle headers in init options
|
|
282
|
+
if (init?.headers) {
|
|
283
|
+
const headers = new Headers(init.headers);
|
|
284
|
+
headers.delete("Authorization");
|
|
285
|
+
init = { ...init, headers };
|
|
276
286
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
287
|
+
}
|
|
288
|
+
return originalFetch.call(this, url, init);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// Ensure nested config structure exists
|
|
292
|
+
config.litePluginSettings = config.litePluginSettings || {};
|
|
293
|
+
config.litePluginSettings[PYODIDE_KERNEL] = config.litePluginSettings[PYODIDE_KERNEL] || {};
|
|
294
|
+
config.litePluginSettings[PYODIDE_KERNEL].loadPyodideOptions =
|
|
295
|
+
config.litePluginSettings[PYODIDE_KERNEL].loadPyodideOptions || {};
|
|
296
|
+
config.litePluginSettings[PYODIDE_KERNEL].loadPyodideOptions.env = {
|
|
297
|
+
__gxy__: JSON.stringify(searchParams),
|
|
298
|
+
};
|
|
299
|
+
config.settingsOverrides = {};
|
|
300
|
+
config.settingsOverrides[AI_SETTINGS] = {
|
|
301
|
+
defaultProvider: "jnaut",
|
|
302
|
+
useSameProviderForChatAndCompleter: false,
|
|
303
|
+
providers: [
|
|
304
|
+
{
|
|
305
|
+
id: "jnaut",
|
|
306
|
+
name: "jnaut",
|
|
307
|
+
provider: "generic",
|
|
308
|
+
model: "jnaut",
|
|
309
|
+
baseURL: galaxyApiBase,
|
|
310
|
+
parameters: {
|
|
311
|
+
maxTokens: 4096,
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
};
|
|
300
316
|
|
|
301
317
|
//__GXY__INJECTION__
|
|
302
318
|
if (config.baseUrl === new URL(here()).pathname) {
|