mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-19 01:51:15 -05:00
enh: pyodide
This commit is contained in:
1 parent
8685256002
commit
09cd95bffe
4 files changed
+39
-42
No files matched your search
Generated
+5
-4
@@ -56,7 +56,7 @@
|
||||
"prosemirror-schema-list": "^1.4.1",
|
||||
"prosemirror-state": "^1.4.3",
|
||||
"prosemirror-view": "^1.34.3",
|
||||
"pyodide": "^0.26.1",
|
||||
"pyodide": "^0.27.2",
|
||||
"socket.io-client": "^4.2.0",
|
||||
"sortablejs": "^1.15.2",
|
||||
"svelte-sonner": "^0.3.19",
|
||||
@@ -9366,9 +9366,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/pyodide": {
|
||||
"version": "0.26.1",
|
||||
"resolved": "https://registry.npmjs.org/pyodide/-/pyodide-0.26.1.tgz",
|
||||
"integrity": "sha512-P+Gm88nwZqY7uBgjbQH8CqqU6Ei/rDn7pS1t02sNZsbyLJMyE2OVXjgNuqVT3KqYWnyGREUN0DbBUCJqk8R0ew==",
|
||||
"version": "0.27.2",
|
||||
"resolved": "https://registry.npmjs.org/pyodide/-/pyodide-0.27.2.tgz",
|
||||
"integrity": "sha512-sfA2kiUuQVRpWI4BYnU3sX5PaTTt/xrcVEmRzRcId8DzZXGGtPgCBC0gCqjUTUYSa8ofPaSjXmzESc86yvvCHg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"ws": "^8.5.0"
|
||||
},
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@
|
||||
"prosemirror-schema-list": "^1.4.1",
|
||||
"prosemirror-state": "^1.4.3",
|
||||
"prosemirror-view": "^1.34.3",
|
||||
"pyodide": "^0.26.1",
|
||||
"pyodide": "^0.27.2",
|
||||
"socket.io-client": "^4.2.0",
|
||||
"sortablejs": "^1.15.2",
|
||||
"svelte-sonner": "^0.3.19",
|
||||
|
||||
@@ -74,44 +74,40 @@ self.onmessage = async (event) => {
|
||||
};
|
||||
|
||||
function processResult(result: any): any {
|
||||
// Handle null and undefined
|
||||
if (result == null) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Handle primitive types
|
||||
if (typeof result !== 'object') {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Handle Date objects
|
||||
if (result instanceof Date) {
|
||||
return result.toISOString();
|
||||
}
|
||||
|
||||
// Handle Arrays
|
||||
if (Array.isArray(result)) {
|
||||
return result.map((item) => processResult(item));
|
||||
}
|
||||
|
||||
// Handle Proxy objects (assuming they're from Pyodide)
|
||||
if (typeof result.toJs === 'function') {
|
||||
return processResult(result.toJs());
|
||||
}
|
||||
|
||||
// Handle regular objects
|
||||
if (typeof result === 'object') {
|
||||
const processedObject: { [key: string]: any } = {};
|
||||
for (const key in result) {
|
||||
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
||||
processedObject[key] = processResult(result[key]);
|
||||
}
|
||||
// Catch and always return JSON-safe string representations
|
||||
try {
|
||||
if (result == null) {
|
||||
// Handle null and undefined
|
||||
return null;
|
||||
}
|
||||
return processedObject;
|
||||
if (typeof result === 'string' || typeof result === 'number' || typeof result === 'boolean') {
|
||||
// Handle primitive types directly
|
||||
return result;
|
||||
}
|
||||
if (Array.isArray(result)) {
|
||||
// If it's an array, recursively process items
|
||||
return result.map((item) => processResult(item));
|
||||
}
|
||||
if (typeof result.toJs === 'function') {
|
||||
// If it's a Pyodide proxy object (e.g., Pandas DF, Numpy Array), convert to JS and process recursively
|
||||
return processResult(result.toJs());
|
||||
}
|
||||
if (typeof result === 'object') {
|
||||
// Convert JS objects to a recursively serialized representation
|
||||
const processedObject: { [key: string]: any } = {};
|
||||
for (const key in result) {
|
||||
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
||||
processedObject[key] = processResult(result[key]);
|
||||
}
|
||||
}
|
||||
return processedObject;
|
||||
}
|
||||
// Stringify anything that's left (e.g., Proxy objects that cannot be directly processed)
|
||||
return JSON.stringify(result);
|
||||
} catch (err) {
|
||||
// In case something unexpected happens, we return a stringified fallback
|
||||
return `[processResult error]: ${err.toString()}`;
|
||||
}
|
||||
|
||||
// If we can't process it, return null or a placeholder
|
||||
return null;
|
||||
}
|
||||
|
||||
export default {};
|
||||
@@ -1 +1 @@
|
||||
{"info": {"abi_version": "2024_0", "arch": "wasm32", "platform": "emscripten_3_1_58", "python": "3.12.1", "version": "0.26.1"}, "packages": {"aiohttp": {"depends": ["aiosignal", "async-timeout", "attrs", "charset-normalizer", "frozenlist", "multidict", "yarl"], "file_name": "aiohttp-3.9.5-cp312-cp312-pyodide_2024_0_wasm32.whl", "imports": ["aiohttp"], "install_dir": "site", "name": "aiohttp", "package_type": "package", "sha256": "c9a381c45ca9d6f16f6ec269c27a82bcbcaa3075f7f8e5de271ef5c256aa4ea4", "shared_library": false, "unvendored_tests": true, "version": "3.9.5"}, "aiohttp-tests": {"depends": ["aiohttp"], "file_name": "aiohttp-tests.tar", "imports": [], "install_dir": "site", "name": "aiohttp-tests", "package_type": "package", "sha256": "dc42d3bea4ede411be4cd43059f224832438b00f076fbe4d9d1ef516e2eab250", "shared_library": false, "unvendored_tests": false, "version": "3.9.5"}, "aiosignal": {"depends": ["frozenlist"], "file_name": "aiosignal-1.3.1-py3-none-any.whl", "imports": ["aiosignal"], "install_dir": "site", "name": "aiosignal", "package_type": "package", "sha256": "e091282e280a5940e759c5c849dfcd3169f8eea21d5838c872ec1265ef825f1e", "shared_library": false, "unvendored_tests": false, "version": "1.3.1"}, "altair": {"depends": ["typing-extensions", "jinja2", "jsonschema", "numpy", "pandas", "toolz", "packaging"], "file_name": "altair-5.3.0-py3-none-any.whl", "imports": ["altair"], "install_dir": "site", "name": "altair", "package_type": "package", "sha256": "1d2f248506ab81f13292d42464faa60c4940c1ef5da9013dc3a97ed398d6f7f7", "shared_library": false, "unvendored_tests": false, "version": "5.3.0"}, "annotated-types": {"depends": [], "file_name": "annotated_types-0.6.0-py3-none-any.whl", "imports": ["annotated_types"], "install_dir": "site", "name": "annotated-types", "package_type": "package", "sha256": "337d2a3e1b65926cd6560d0c9a33f8be55d6b8a21e846091bc7ab8fdb2f421a3", "shared_library": false, "unvendored_tests": true, "version": "0.6.0"}, "annotated-types-tests": {"depends": ["annotated-types"], "file_name": "annotated-types-tests.tar", "imports": [], "install_dir": "site", "name": "annotated-types-tests", "package_type": "package", "sha256": "0eecd674a295f84758689100739cca7d54f73cd6288c41f2269f78a01e465a8d", "shared_library": false, "unvendored_tests": false, "version": "0.6.0"}, "asciitree": {"depends": [], "file_name": "asciitree-0.3.3-py3-none-any.whl", "imports": ["asciitree"], "install_dir": "site", "name": "asciitree", "package_type": "package", "sha256": "15d47009b9cacdddacbc7ef306e64d103ea96d4fdc0fbb2d579e43c8fe8666bf", "shared_library": false, "unvendored_tests": false, "version": "0.3.3"}, "astropy": {"depends": ["packaging", "numpy", "pyerfa", "pyyaml", "astropy_iers_data"], "file_name": "astropy-6.0.1-cp312-cp312-pyodide_2024_0_wasm32.whl", "imports": ["astropy"], "install_dir": "site", "name": "astropy", "package_type": "package", "sha256": "94be600bfff4973c962112913bf86b5d1c4ba8b162b6ef409a03f70a0cefb9e9", "shared_library": false, "unvendored_tests": false, "version": "6.0.1"}, "astropy-iers-data": {"depends": [], "file_name": "astropy_iers_data-0.2024.4.22.0.29.50-py3-none-any.whl", "imports": ["astropy_iers_data"], "install_dir": "site", "name": "astropy_iers_data", "package_type": "package", "sha256": "b9989c71b05bc8a550d74d7e49d5e041f192f420bdf8b71553adb225e286f478", "shared_library": false, "unvendored_tests": true, "version": "0.2024.4.22.0.29.50"}, "astropy-iers-data-tests": {"depends": ["astropy_iers_data"], "file_name": "astropy_iers_data-tests.tar", "imports": [], "install_dir": "site", "name": "astropy_iers_data-tests", "package_type": "package", "sha256": "3cbaffbea097e4d5f206a7f357b59871a67594cd3f899ad45a28c293c271d4f1", "shared_library": false, "unvendored_tests": false, "version": "0.2024.4.22.0.29.50"}, "asttokens": {"depends": ["six"], "file_name": "asttokens-2.4.1-py2.py3-none-any.whl", "imports": ["asttokens"], "install_dir": "site", "name": "asttokens", "package_type": "package", "sha256": "4f62a79cfd557b35cd1f1e4809c61eef0b6e54e0dea5270653bbde3fc341d05a", "shared_library": false, "unvendored_tests": false, "version": "2.4.1"}, "async-timeout": {"depends": [], "file_name": "async_timeout-4.0.3-py3-none-any.whl", "imports": ["async_timeout"], "install_dir": "site", "name": "async-timeout", "package_type": "package", "sha256": "39d42f0d92a009c9205d74a01ff194d89ea9f1741af36998bc405c615993779e", "shared_library": false, "unvendored_tests": false, "version": "4.0.3"}, "atomicwrites": {"depends": [], "file_name": "atomicwrites-1.4.1-py2.py3-none-any.whl", "imports": ["atomicwrites"], "install_dir": "site", "name": "atomicwrites", "package_type": "package", "sha256": "7ac6f1fb3dde1c23246b08b6d2a380fb9e1b344e57126f00bd9364ad1104bc82", "shared_library": false, "unvendored_tests": false, "version": "1.4.1"}, "attrs": {"depends": ["six"], "file_name": "attrs-23.2.0-py3-none-any.whl", "imports": ["attr", "attrs"], "install_dir": "site", "name": "attrs", "package_type": "package", "Line truncated
|
||||
{"info": {"abi_version": "2024_0", "arch": "wasm32", "platform": "emscripten_3_1_58", "python": "3.12.7", "version": "0.27.2"}, "packages": {"affine": {"depends": [], "file_name": "affine-2.4.0-py3-none-any.whl", "imports": ["affine"], "install_dir": "site", "name": "affine", "package_type": "package", "sha256": "465f43c53d566d8631c62020147e94c76c6e89bd3cf7255b91e3c6e1376589d8", "unvendored_tests": true, "version": "2.4.0"}, "affine-tests": {"depends": ["affine"], "file_name": "affine-tests.tar", "imports": [], "install_dir": "site", "name": "affine-tests", "package_type": "package", "sha256": "496ef58c6daf0684e50060026bd9b3b807f03eacf3490dfcd4e610463a660fcd", "unvendored_tests": false, "version": "2.4.0"}, "aiohttp": {"depends": ["aiosignal", "async-timeout", "attrs", "charset-normalizer", "frozenlist", "multidict", "yarl"], "file_name": "aiohttp-3.9.5-cp312-cp312-pyodide_2024_0_wasm32.whl", "imports": ["aiohttp"], "install_dir": "site", "name": "aiohttp", "package_type": "package", "sha256": "9187d627eaf387a56f0518fbd804f7c6caa7fc8bf672fa9efdf60ad4370a170b", "unvendored_tests": true, "version": "3.9.5"}, "aiohttp-tests": {"depends": ["aiohttp"], "file_name": "aiohttp-tests.tar", "imports": [], "install_dir": "site", "name": "aiohttp-tests", "package_type": "package", "sha256": "3f0691239fc606ab18dfa44282257d9dbbc2babd094cde2debdd2767ab7ac0e8", "unvendored_tests": false, "version": "3.9.5"}, "aiosignal": {"depends": ["frozenlist"], "file_name": "aiosignal-1.3.1-py3-none-any.whl", "imports": ["aiosignal"], "install_dir": "site", "name": "aiosignal", "package_type": "package", "sha256": "591e2f6aa2430ad9f511b36332d0c4d481c8b60ff4812673044409f70fc9acfb", "unvendored_tests": false, "version": "1.3.1"}, "altair": {"depends": ["typing-extensions", "jinja2", "jsonschema", "packaging", "narwhals"], "file_name": "altair-5.4.1-py3-none-any.whl", "imports": ["altair"], "install_dir": "site", "name": "altair", "package_type": "package", "sha256": "22b80935bacbbfc514a7ecce044510bc776dd18debdd82f65604c94fae09691d", "unvendored_tests": false, "version": "5.4.1"}, "annotated-types": {"depends": [], "file_name": "annotated_types-0.6.0-py3-none-any.whl", "imports": ["annotated_types"], "install_dir": "site", "name": "annotated-types", "package_type": "package", "sha256": "7415a962cd82322eacb271516c7c1c0a0d7bcd43b318ca058322b5d27b24517e", "unvendored_tests": true, "version": "0.6.0"}, "annotated-types-tests": {"depends": ["annotated-types"], "file_name": "annotated-types-tests.tar", "imports": [], "install_dir": "site", "name": "annotated-types-tests", "package_type": "package", "sha256": "ec8dc09ec048f30ff6c915159315188439435136769a3a7202321c09ca971719", "unvendored_tests": false, "version": "0.6.0"}, "apsw": {"depends": [], "file_name": "apsw-3.47.2.0-cp312-cp312-pyodide_2024_0_wasm32.whl", "imports": ["apsw"], "install_dir": "site", "name": "apsw", "package_type": "package", "sha256": "ea5d67230168a5f055c52b3b77be071cdf73007bcbd3a3a2b6fd0d99cc627a7d", "unvendored_tests": false, "version": "3.47.2.0"}, "argon2-cffi": {"depends": ["argon2-cffi-bindings"], "file_name": "argon2_cffi-23.1.0-py3-none-any.whl", "imports": ["argon2"], "install_dir": "site", "name": "argon2-cffi", "package_type": "package", "sha256": "934f49e85bceb8beb0c0beff0c80be029887297988d4801dc55fe6691ef89e58", "unvendored_tests": false, "version": "23.1.0"}, "argon2-cffi-bindings": {"depends": ["cffi"], "file_name": "argon2_cffi_bindings-21.2.0-cp312-abi3-pyodide_2024_0_wasm32.whl", "imports": ["_argon2_cffi_bindings"], "install_dir": "site", "name": "argon2-cffi-bindings", "package_type": "package", "sha256": "dd94aa3c2b9a630fe86ba52349380ddb9da63622c26bc623ea8431a30e278259", "unvendored_tests": false, "version": "21.2.0"}, "arro3-compute": {"depends": ["arro3-core"], "file_name": "arro3_compute-0.4.1-cp312-cp312-pyodide_2024_0_wasm32.whl", "imports": ["arro3.compute"], "install_dir": "site", "name": "arro3-compute", "package_type": "package", "sha256": "3d20915b504c7f2cf54a80e03938560bec35fa392a00215b233227a3d7b312ea", "unvendored_tests": false, "version": "0.4.1"}, "arro3-core": {"depends": [], "file_name": "arro3_core-0.4.1-cp312-cp312-pyodide_2024_0_wasm32.whl", "imports": ["arro3.core"], "install_dir": "site", "name": "arro3-core", "package_type": "package", "sha256": "3c9770df7027ba8f110d2afbad63f019b7d2d7c0cfafc46e1819b2441ca9d386", "unvendored_tests": false, "version": "0.4.1"}, "arro3-io": {"depends": ["arro3-core"], "file_name": "arro3_io-0.4.1-cp312-cp312-pyodide_2024_0_wasm32.whl", "imports": ["arro3.io"], "install_dir": "site", "name": "arro3-io", "package_type": "package", "sha256": "da072bcc0b8f8e2d8671e8b3ed19097244331d0db616b073dd5ae11eb565849a", "unvendored_tests": false, "version": "0.4.1"}, "asciitree": {"depends": [], "file_name": "asciitree-0.3.3-py3-none-any.whl", "imports": ["asciitree"], "install_dir": "site", "name": "asciitree", "package_type": "package", "sha256": "3f509fb58e8b0ed0cb084c36a086b1d7e5b798ed68b27276231ed8f65b428fbLine truncated
|
||||
Reference in new issue
Block a user