gac 1.2.4__py3-none-any.whl → 1.2.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gac might be problematic. Click here for more details.

gac/__version__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Version information for gac package."""
2
2
 
3
- __version__ = "1.2.4"
3
+ __version__ = "1.2.5"
gac/ai.py CHANGED
@@ -16,6 +16,7 @@ from gac.providers import (
16
16
  call_ollama_api,
17
17
  call_openai_api,
18
18
  call_openrouter_api,
19
+ call_zai_api,
19
20
  )
20
21
 
21
22
  logger = logging.getLogger(__name__)
@@ -67,6 +68,7 @@ def generate_commit_message(
67
68
  "cerebras": call_cerebras_api,
68
69
  "ollama": call_ollama_api,
69
70
  "openrouter": call_openrouter_api,
71
+ "zai": call_zai_api,
70
72
  }
71
73
 
72
74
  # Generate the commit message using centralized retry logic
gac/init_cli.py CHANGED
@@ -24,15 +24,16 @@ def init() -> None:
24
24
  ("Cerebras", "qwen-3-coder-480b"),
25
25
  ("Groq", "meta-llama/llama-4-maverick-17b-128e-instruct"),
26
26
  ("Ollama", "gemma3"),
27
- ("OpenRouter", "openrouter/auto"),
28
27
  ("OpenAI", "gpt-4.1-mini"),
28
+ ("OpenRouter", "openrouter/auto"),
29
+ ("Z.AI", "glm-4.6"),
29
30
  ]
30
31
  provider_names = [p[0] for p in providers]
31
32
  provider = questionary.select("Select your provider:", choices=provider_names).ask()
32
33
  if not provider:
33
34
  click.echo("Provider selection cancelled. Exiting.")
34
35
  return
35
- provider_key = provider.lower()
36
+ provider_key = provider.lower().replace(".", "")
36
37
  model_suggestion = dict(providers)[provider]
37
38
  model = questionary.text(f"Enter the model (default: {model_suggestion}):", default=model_suggestion).ask()
38
39
  model_to_save = model.strip() if model.strip() else model_suggestion
gac/providers/__init__.py CHANGED
@@ -6,6 +6,7 @@ from .groq import call_groq_api
6
6
  from .ollama import call_ollama_api
7
7
  from .openai import call_openai_api
8
8
  from .openrouter import call_openrouter_api
9
+ from .zai import call_zai_api
9
10
 
10
11
  __all__ = [
11
12
  "call_anthropic_api",
@@ -14,4 +15,5 @@ __all__ = [
14
15
  "call_ollama_api",
15
16
  "call_openai_api",
16
17
  "call_openrouter_api",
18
+ "call_zai_api",
17
19
  ]
gac/providers/groq.py CHANGED
@@ -36,8 +36,9 @@ def call_groq_api(model: str, messages: list[dict], temperature: float, max_toke
36
36
  content = choice["message"]["content"]
37
37
  logger.debug(f"Found content in message.content: {repr(content)}")
38
38
  if content is None:
39
- logger.warning("Groq API returned None content in message.content")
40
- return ""
39
+ raise AIError.model_error("Groq API returned null content")
40
+ if content == "":
41
+ raise AIError.model_error("Groq API returned empty content")
41
42
  return content
42
43
  elif "text" in choice:
43
44
  content = choice["text"]
gac/providers/zai.py ADDED
@@ -0,0 +1,43 @@
1
+ """Z.AI API provider for gac."""
2
+
3
+ import os
4
+
5
+ import httpx
6
+
7
+ from gac.errors import AIError
8
+
9
+
10
+ def call_zai_api(model: str, messages: list[dict], temperature: float, max_tokens: int) -> str:
11
+ """Call Z.AI API directly."""
12
+ api_key = os.getenv("ZAI_API_KEY")
13
+ if not api_key:
14
+ raise AIError.model_error("ZAI_API_KEY not found in environment variables")
15
+
16
+ url = "https://api.z.ai/api/paas/v4/chat/completions"
17
+ headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
18
+
19
+ data = {"model": model, "messages": messages, "temperature": temperature, "max_tokens": max_tokens}
20
+
21
+ try:
22
+ response = httpx.post(url, headers=headers, json=data, timeout=120)
23
+ response.raise_for_status()
24
+ response_data = response.json()
25
+
26
+ # Handle different possible response structures
27
+ if "choices" in response_data and len(response_data["choices"]) > 0:
28
+ choice = response_data["choices"][0]
29
+ if "message" in choice and "content" in choice["message"]:
30
+ content = choice["message"]["content"]
31
+ if content is None:
32
+ raise AIError.model_error("Z.AI API returned null content")
33
+ if content == "":
34
+ raise AIError.model_error("Z.AI API returned empty content")
35
+ return content
36
+ else:
37
+ raise AIError.model_error(f"Z.AI API response missing content: {response_data}")
38
+ else:
39
+ raise AIError.model_error(f"Z.AI API unexpected response structure: {response_data}")
40
+ except httpx.HTTPStatusError as e:
41
+ raise AIError.model_error(f"Z.AI API error: {e.response.status_code} - {e.response.text}") from e
42
+ except Exception as e:
43
+ raise AIError.model_error(f"Error calling Z.AI API: {str(e)}") from e
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gac
3
- Version: 1.2.4
3
+ Version: 1.2.5
4
4
  Summary: AI-powered Git commit message generator with multi-provider support
5
5
  Project-URL: Homepage, https://github.com/cellwebb/gac
6
6
  Project-URL: Documentation, https://github.com/cellwebb/gac#readme
@@ -56,7 +56,7 @@ Description-Content-Type: text/markdown
56
56
 
57
57
  - **LLM-Powered Commit Messages:** Automatically generates clear, concise, and context-aware commit messages using large language models.
58
58
  - **Deep Contextual Analysis:** Understands your code by analyzing staged changes, repository structure, and recent commit history to provide highly relevant suggestions.
59
- - **Multi-Provider & Model Support:** Flexibly works with various leading AI providers (like Anthropic, Cerebras, Groq, OpenRouter, OpenAI) and models, easily configured through an interactive setup or environment variables.
59
+ - **Multi-Provider & Model Support:** Flexibly works with various leading AI providers (like Anthropic, Cerebras, Groq, OpenRouter, OpenAI, Z.AI) and models, easily configured through an interactive setup or environment variables.
60
60
  - **Seamless Git Workflow:** Integrates smoothly into your existing Git routine as a simple drop-in replacement for `git commit`.
61
61
  - **Extensive Customization:** Tailor commit messages to your needs with a rich set of flags, including one-liners (`-o`), AI hints (`-h`), scope inference (`-s`), and specific model selection (`-m`).
62
62
  - **Streamlined Workflow Commands:** Boost your productivity with convenient options to stage all changes (`-a`), auto-confirm commits (`-y`), and push to your remote repository (`-p`) in a single step.
@@ -1,6 +1,6 @@
1
1
  gac/__init__.py,sha256=HFWgSVNbTAFhgetCRWI1WrtyE7zC7IHvoBOrfDGUurM,989
2
- gac/__version__.py,sha256=GDkaKhOfSvCVkLJaxZC9kiSV-zeX97pEG3kptZAPPV0,66
3
- gac/ai.py,sha256=iW7DqVoWGaHJeUWhkcYgFxJZHEkvNMcKgnEFQiBT_Dg,3090
2
+ gac/__version__.py,sha256=rEIPNZZEsV4VY9-nveQIQm49SIdTXtFKdIXA7-Hy7N0,66
3
+ gac/ai.py,sha256=DRQ59U3-nf94qNCSqmOabRHEFaeV8gUU-4u_6iUyApo,3137
4
4
  gac/ai_utils.py,sha256=4qr1Jpm89ND5avqWQoQIjyc-zS-CPLoODjlhI44l8M8,7079
5
5
  gac/cli.py,sha256=eQS8S7v6p0CfN9wtr239ujYGTi9rKl-KV7STX2U-C3w,4581
6
6
  gac/config.py,sha256=wSgEDjtis7Vk1pv5VPvYmJyD9-tymDS6GiUHjnCMbIM,1486
@@ -9,20 +9,21 @@ gac/constants.py,sha256=MAxdASGncfZY1TdKGdhJZ0wvTBEU3gTN6KEdw8n3Bd8,4844
9
9
  gac/diff_cli.py,sha256=wnVQ9OFGnM0d2Pj9WVjWbo0jxqIuRHVAwmb8wU9Pa3E,5676
10
10
  gac/errors.py,sha256=kwKxBhBpdgESRftUdN8RBiGDKE7E_H7nFN5-JVNyZE4,7578
11
11
  gac/git.py,sha256=MS2m4fv8h4mau1djFG1aje9NXTmkGsjPO9w18LqNGX0,6031
12
- gac/init_cli.py,sha256=e4z9-4NhoUn2DUyApIru8JR-W7HuNq2VeeXkR9aXHLo,1868
12
+ gac/init_cli.py,sha256=iommTXXLzjlDZWl3I43ksMZ5miDxhiYXCvFJmsKLyRU,1914
13
13
  gac/main.py,sha256=POay7l6ihm3oF9ajGWx9cA40Pu-NVz5x_OzQOYPDoX8,12011
14
14
  gac/preprocess.py,sha256=krrLPHsccYMdn_YAtUrppBJIoRgevxGWusDwhE40LEo,15366
15
15
  gac/prompt.py,sha256=_fv24XU3DZE_S72vcdUYnNkmy-_KXnr1Vlc-9okop7E,17263
16
16
  gac/utils.py,sha256=W3ladtmsH01MNLdckQYTzYrYbTGEdzCKI36he9C-y_E,3945
17
- gac/providers/__init__.py,sha256=iGwZmV-cFqL3AeFE0vc6KpHwm-RLWcVSU17c7IvJg2s,456
17
+ gac/providers/__init__.py,sha256=FUtpU9oSxwv8-GQ7WBFHzV_cQMh3HjZ1vQfOPsZcRPs,506
18
18
  gac/providers/anthropic.py,sha256=esf6pq6nRdqD0mpKz_IQNXmXe5WnkoSA2b1isrrRB4o,1514
19
19
  gac/providers/cerebras.py,sha256=eE9lAjEzrATIo941vv97I2DSmpnXYBCJ9HkVIb-6Whg,1130
20
- gac/providers/groq.py,sha256=Z-j-RKrRGV7evSWxTyKKnPff1Mn5YmYZxitqWVlwadE,2452
20
+ gac/providers/groq.py,sha256=ILe1Qo8tK0mZ_b-fCPq25j76HfI9KcPnUi2Dginw0Ys,2529
21
21
  gac/providers/ollama.py,sha256=Bp94DvortQssDhekuNdJ7fKLeWpWASYXSssJNCuGszg,1383
22
22
  gac/providers/openai.py,sha256=RohHaQqttx0BTVzoJrmEA4eajxnFLN7zyfcFBE0aRyQ,1120
23
23
  gac/providers/openrouter.py,sha256=x9jGhvHHbApCT859bSAUZrkpgQKfQTHUIFSlWYPvlfE,1196
24
- gac-1.2.4.dist-info/METADATA,sha256=Sf_uWtXM2nDhkmCbsLqW1Ug7Cjx4kyTNg8xQydGUK-I,8481
25
- gac-1.2.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
26
- gac-1.2.4.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
27
- gac-1.2.4.dist-info/licenses/LICENSE,sha256=vOab37NouL1PNs5BswnPayrMCqaN2sqLfMQfqPDrpZg,1103
28
- gac-1.2.4.dist-info/RECORD,,
24
+ gac/providers/zai.py,sha256=a8ifYYudA1iFXmmag5UUZ8WGRgV9ERu1FdM9oLAA8HA,1828
25
+ gac-1.2.5.dist-info/METADATA,sha256=EyTzqDH7dROpB9p3XQhzZ58CsbDs0UGKsdsKvxDJFq4,8487
26
+ gac-1.2.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
27
+ gac-1.2.5.dist-info/entry_points.txt,sha256=tdjN-XMmcWfL92swuRAjT62bFLOAwk9bTMRLGP5Z4aI,36
28
+ gac-1.2.5.dist-info/licenses/LICENSE,sha256=vOab37NouL1PNs5BswnPayrMCqaN2sqLfMQfqPDrpZg,1103
29
+ gac-1.2.5.dist-info/RECORD,,
File without changes