mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-23 14:10:42 -05:00
fix: running a block whose last value is a date, Decimal or object shows the value instead of an error (#32682)
This commit is contained in:
2 files changed
+8
-2
No files matched your search
@@ -92,7 +92,10 @@ const sandboxScript = String.raw`
|
||||
if (['string', 'number', 'boolean'].includes(typeof value)) return value;
|
||||
if (typeof value === 'bigint') return value.toString();
|
||||
if (Array.isArray(value)) return value.map(clean);
|
||||
if (typeof value.toJs === 'function') return clean(value.toJs());
|
||||
if (typeof value.toJs === 'function') {
|
||||
const converted = value.toJs();
|
||||
return typeof converted?.toJs === 'function' ? converted.toString() : clean(converted);
|
||||
}
|
||||
if (typeof value === 'object') {
|
||||
const out = {};
|
||||
for (const key in value) {
|
||||
|
||||
@@ -346,7 +346,10 @@ function processResult(result: any): any {
|
||||
}
|
||||
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());
|
||||
const converted = result.toJs();
|
||||
return typeof converted?.toJs === 'function'
|
||||
? converted.toString()
|
||||
: processResult(converted);
|
||||
}
|
||||
if (typeof result === 'object') {
|
||||
// Convert JS objects to a recursively serialized representation
|
||||
|
||||
Reference in new issue
Block a user