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}")