Skip to content

Commit 66d4d45

Browse files
committed
🔧 chore(commit): add default token limit and defaults to commit model
1 parent 0a3f84b commit 66d4d45

File tree

2 files changed

+95
-92
lines changed

2 files changed

+95
-92
lines changed

tgit/commit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
commit_types = ["feat", "fix", "chore", "docs", "style", "refactor", "perf", "wip"]
2626
commit_file = "commit.txt"
2727
commit_prompt_template = env.get_template("commit.txt")
28+
DEFAULT_MAX_OUTPUT_TOKENS = 256
2829

2930
# Define click arguments/options at module level to avoid B008
3031
MESSAGE_ARG = click.argument(
@@ -64,12 +65,11 @@ class TemplateParams:
6465
branch: str
6566
specified_type: str | None = None
6667

67-
6868
class CommitData(BaseModel):
6969
type: str
70-
scope: str | None
70+
scope: str | None = None
7171
msg: str
72-
is_breaking: bool
72+
is_breaking: bool = False
7373

7474

7575
def _supports_reasoning(model: str) -> bool:
@@ -196,7 +196,7 @@ def _generate_commit_with_ai(diff: str, specified_type: str | None, current_bran
196196
{"role": "user", "content": diff},
197197
],
198198
"model": model_name,
199-
"max_output_tokens": 50,
199+
"max_output_tokens": DEFAULT_MAX_OUTPUT_TOKENS,
200200
"text_format": CommitData,
201201
}
202202
if _supports_reasoning(model_name):

0 commit comments

Comments
 (0)