From c346059750b2d48810a3d2ad0ba8fa00e0d67446 Mon Sep 17 00:00:00 2001 From: adeeshperera Date: Tue, 7 Oct 2025 00:05:02 +0530 Subject: [PATCH] fix #52 : add Groq LLM support to setup and generation - Add Groq to LLM provider selection in setup - Import groq package and add case in commit message generation - Include Groq-specific error handling --- cmd/cli/createMsg.go | 5 +++++ cmd/cli/llmSetup.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/cli/createMsg.go b/cmd/cli/createMsg.go index 25a823a..f725bf2 100644 --- a/cmd/cli/createMsg.go +++ b/cmd/cli/createMsg.go @@ -11,6 +11,7 @@ import ( "github.com/dfanso/commit-msg/internal/gemini" "github.com/dfanso/commit-msg/internal/git" "github.com/dfanso/commit-msg/internal/grok" + "github.com/dfanso/commit-msg/internal/groq" "github.com/dfanso/commit-msg/internal/ollama" "github.com/dfanso/commit-msg/internal/stats" "github.com/dfanso/commit-msg/pkg/types" @@ -120,6 +121,8 @@ func CreateCommitMsg () { case "Claude": commitMsg, err = claude.GenerateCommitMessage(config, changes, apiKey) + case "Groq": + commitMsg, err = groq.GenerateCommitMessage(config, changes, apiKey) case "Ollama": model := "llama3:latest" @@ -138,6 +141,8 @@ func CreateCommitMsg () { pterm.Error.Printf("OpenAI API error. Check your OPENAI_API_KEY environment variable or run: commit llm setup\n") case "Claude": pterm.Error.Printf("Claude API error. Check your CLAUDE_API_KEY environment variable or run: commit llm setup\n") + case "Groq": + pterm.Error.Printf("Groq API error. Check your GROQ_API_KEY environment variable or run: commit llm setup\n") case "Grok": pterm.Error.Printf("Grok API error. Check your GROK_API_KEY environment variable or run: commit llm setup\n") default: diff --git a/cmd/cli/llmSetup.go b/cmd/cli/llmSetup.go index 545d51c..d774786 100644 --- a/cmd/cli/llmSetup.go +++ b/cmd/cli/llmSetup.go @@ -11,7 +11,7 @@ import ( func SetupLLM() error { - providers := []string{"OpenAI", "Claude", "Gemini", "Grok", "Ollama"} + providers := []string{"OpenAI", "Claude", "Gemini", "Grok", "Groq", "Ollama"} prompt := promptui.Select{ Label: "Select LLM", Items: providers,