mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-28 06:22:33 +00: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:
parent
d4d5bc2ef5
commit
fb5eec56dd
2 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue