From 36ef93f4f248e82aaedca8ee0e5262cc73819f94 Mon Sep 17 00:00:00 2001 From: songsenand Date: Wed, 4 Feb 2026 16:42:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20encoding=20=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E4=BB=A5=E7=A1=AE=E4=BF=9D=20Git=20=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=AD=A3=E7=A1=AE=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autocommit/git.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autocommit/git.py b/autocommit/git.py index 47439a1..25550ca 100644 --- a/autocommit/git.py +++ b/autocommit/git.py @@ -13,6 +13,7 @@ class GitHandler: self.llm_client = llm_client else: from .llm import LLMClient + self.llm_client = LLMClient() def get_diff(self) -> str: @@ -21,7 +22,8 @@ class GitHandler: result = subprocess.run( ["git", "diff", "--staged"], capture_output=True, - text=True + text=True, + encoding="utf-8", ) return result.stdout except FileNotFoundError: @@ -35,7 +37,8 @@ class GitHandler: result = subprocess.run( ["git", "commit", "-m", message], capture_output=True, - text=True + text=True, + encoding="utf-8", ) if result.returncode != 0: raise Exception(f"Git 提交失败: {result.stderr}")