From c98843978bb1e18a90df5b3f233d3c888b5c1ffa Mon Sep 17 00:00:00 2001 From: Shiven Mian Date: Sun, 18 Feb 2024 22:26:45 -0800 Subject: [PATCH 1/2] fix: don't add code to skill if wrong + only add python code --- 01OS/01OS/server/teach.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/01OS/01OS/server/teach.py b/01OS/01OS/server/teach.py index bebe12a..e39a176 100644 --- a/01OS/01OS/server/teach.py +++ b/01OS/01OS/server/teach.py @@ -82,16 +82,20 @@ def teach(): elif step.strip() == "": continue logger.info(f"Performing step: {step}") + root.update() chunk_code = "" interpreter.computer.languages = [l for l in interpreter.computer.languages if l.name.lower() == "python"] interpreter.force_task_completion = True for chunk in interpreter.chat(step, stream=True, display=False): - if "format" in chunk and chunk["format"] == "execution": - content = chunk["content"] - language = content["format"] - code = content["content"] - chunk_code += code - interpreter.computer.run(code, language) + if chunk["role"] == "computer" and "start" not in chunk and "end" not in chunk: + chunk_type = chunk["type"] + chunk_content = chunk["content"] + chunk_format = chunk["format"] + if chunk_type == "confirmation" and chunk_format == "execution" and chunk_content["type"] == "code" and chunk_content["format"] == "python": + chunk_code += chunk_content["content"] + elif chunk_type == "console" and chunk_format == "output" and ("Traceback" in chunk_content or "Error" in chunk_content or "Exception" in chunk_content): + # this was an error so we disregard chunk_code + chunk_code = "" time.sleep(0.05) accumulator.accumulate(chunk) From 153f28482beb306374b8d43a332706b9ab5586b7 Mon Sep 17 00:00:00 2001 From: Shiven Mian Date: Sun, 18 Feb 2024 22:43:34 -0800 Subject: [PATCH 2/2] fix: update server_url --- 01OS/.env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/01OS/.env.example b/01OS/.env.example index cc7faae..5b27224 100644 --- a/01OS/.env.example +++ b/01OS/.env.example @@ -22,7 +22,7 @@ PIPER_VOICE_NAME="en_US-lessac-medium.onnx" # If SERVER_START, this is where we'll serve the server. # If CLIENT_START, this is where the client expects the server to be. -SERVER_URL=ws://localhost:8000/ +SERVER_URL=ws://0.0.0.0:8000/ SERVER_START=True CLIENT_START=True