Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
4efb8638
"git@developer.sourcefind.cn:modelzoo/resnet50_tensorflow.git" did not exist on "661965337ecbb01e42b4537d2c6ae770c55c0ad3"
Commit
4efb8638
authored
May 16, 2024
by
Timothy J. Baek
Browse files
refac
parent
8f8ce269
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
src/lib/components/chat/Messages/CodeBlock.svelte
src/lib/components/chat/Messages/CodeBlock.svelte
+13
-9
No files found.
src/lib/components/chat/Messages/CodeBlock.svelte
View file @
4efb8638
...
@@ -138,18 +138,14 @@
...
@@ -138,18 +138,14 @@
};
};
const executePython = async (code) => {
const executePython = async (code) => {
result = null;
stdout = null;
stderr = null;
executed = true;
executed = true;
let pyodide = await loadPyodide({
let pyodide = await loadPyodide({
indexURL: '/pyodide/',
indexURL: '/pyodide/',
stderr: (text) => {
console.log('An error occured:', text);
if (stderr) {
stderr += `${text}\n`;
} else {
stderr = `${text}\n`;
}
},
stdout: (text) => {
stdout: (text) => {
console.log('Python output:', text);
console.log('Python output:', text);
...
@@ -158,14 +154,22 @@
...
@@ -158,14 +154,22 @@
} else {
} else {
stdout = `${text}\n`;
stdout = `${text}\n`;
}
}
},
stderr: (text) => {
console.log('An error occured:', text);
if (stderr) {
stderr += `${text}\n`;
} else {
stderr = `${text}\n`;
}
}
}
});
});
result = pyodide.runPython(code);
result = pyodide.runPython(code);
console.log(result);
console.log(result);
console.log(stderr);
console.log(stdout);
console.log(stdout);
console.log(stderr);
};
};
$: highlightedCode = code ? hljs.highlightAuto(code, hljs.getLanguage(lang)?.aliases).value : '';
$: highlightedCode = code ? hljs.highlightAuto(code, hljs.getLanguage(lang)?.aliases).value : '';
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment