From fa0a1eafc730e3c31c0b76da77cf26f0a365ba74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Solbj=C3=B8rg?= <4324290+Notnaton@users.noreply.github.com> Date: Sat, 18 Jan 2025 23:16:14 +0100 Subject: [PATCH 1/2] Initialize colorama for Windows compatibility in MarkdownRenderer and ContentRenderer --- interpreter/ui/markdown.py | 3 +++ interpreter/ui/tool.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/interpreter/ui/markdown.py b/interpreter/ui/markdown.py index 3d1517ce60..3df3c0e2a8 100644 --- a/interpreter/ui/markdown.py +++ b/interpreter/ui/markdown.py @@ -22,6 +22,9 @@ class MarkdownElement(Enum): class MarkdownRenderer: def __init__(self): + if os.name == "nt": + import colorama + colorama.init() # ANSI escape codes self.BOLD = "\033[1m" self.CODE = "\033[7m" # Regular inline code stays inverted diff --git a/interpreter/ui/tool.py b/interpreter/ui/tool.py index 962b112040..27e419e2b4 100644 --- a/interpreter/ui/tool.py +++ b/interpreter/ui/tool.py @@ -14,6 +14,9 @@ class ContentRenderer: def __init__(self, style): + if os.name == "nt": + import colorama + colorama.init() self.buffer = "" self.started = False self.style = style From ce106f926811b9beb8efd7dd454a4f0872c33a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Solbj=C3=B8rg?= <4324290+Notnaton@users.noreply.github.com> Date: Sat, 18 Jan 2025 23:17:23 +0100 Subject: [PATCH 2/2] Add colorama dependency for enhanced Windows compatibility --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 8097a7f266..ad2765266d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,6 +26,7 @@ pillow = ">=10.3.0" uvicorn = "^0.32.0" pynput = "^1.7.7" httpx = "0.27.2" +colorama = "^0.4.6" [build-system] requires = ["poetry-core>=1.0.0"]