diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index 2b02c5dd8..c470a4354 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -170,7 +170,7 @@ const res = await pyodide.loadPackage('micropip'); console.log(res); - pyodide.setStdin({ stdin: () => prompt() }); + // pyodide.setStdin({ stdin: () => prompt() }); const micropip = pyodide.pyimport('micropip'); @@ -186,6 +186,11 @@ console.log(packages); await micropip.install(packages); + result = pyodide.runPython(`from js import prompt +def input(p): + return prompt(p) +__builtins__.input = input`); + result = pyodide.runPython(code); if (!result) {