Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/domain/ports/ai_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"github.com/Tomas-vilte/MateCommit/internal/domain/models"
)

type AIProvider interface {
// CommitSummarizer es una interfaz que define el servicio para generar sugerencias de commits.
type CommitSummarizer interface {
//GenerateSuggestions genera una lista de sugerencias de mensajes de commit.
GenerateSuggestions(ctx context.Context, info models.CommitInfo, count int) ([]models.CommitSuggestion, error)
}

Expand Down
1 change: 1 addition & 0 deletions internal/i18n/locales/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ pr_changes_section = "Key Changes"
error_gemini_client = "Error creating Gemini client: {{.Error}}"
response_empty = "Empty AI response"
title_not_found = "The title was not found in the answer"
error_empty_prompt = "The prompt cannot be empty"

[suggestion_header]
other = "=========[ Suggestion {{.Number}} ]========="
Expand Down
3 changes: 2 additions & 1 deletion internal/i18n/locales/active.es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ other = "❌ Error al iniciar Gemini: {{.Error}}"
other = "🔍 Analizando cambios..."

[error_missing_api_key]
other = "La variable de entorno, GEMINI_API_KEY no esta configurada"
other = "La GEMINI_API_KEY no está configurada"

[error_generating_content]
other = "Error generando el contenido: {{.Error}}"
Expand Down Expand Up @@ -178,6 +178,7 @@ pr_changes_section = "Cambios Clave"
error_gemini_client = "Error al crear el cliente de Gemini: {{.Error}}"
response_empty = "Respuesta de la IA vacia"
title_not_found = "No se encontro el titulo en la respuesta"
error_empty_prompt = "El prompt no puede estar vacio"

[suggestion_header]
other = "=========[ Sugerencias {{.Number}} ]========="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

func (gps *GeminiPRSummarizer) GeneratePRSummary(ctx context.Context, prompt string) (models.PRSummary, error) {
if prompt == "" {
msg := gps.trans.GetMessage("error_empty_prompt", 0, nil)
msg := gps.trans.GetMessage("gemini_service.error_empty_prompt", 0, nil)

Check warning on line 50 in internal/infrastructure/ai/gemini/gemini_pr_summarizer_service.go

View check run for this annotation

Codecov / codecov/patch

internal/infrastructure/ai/gemini/gemini_pr_summarizer_service.go#L50

Added line #L50 was not covered by tests
return models.PRSummary{}, fmt.Errorf("%s", msg)
}

Expand Down
4 changes: 2 additions & 2 deletions internal/services/commit_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import (

type CommitService struct {
git ports.GitService
ai ports.AIProvider
ai ports.CommitSummarizer
ticketManager ports.TickerManager
config *config.Config
trans *i18n.Translations
}

func NewCommitService(git ports.GitService, ai ports.AIProvider, ticketManager ports.TickerManager, cfg *config.Config, trans *i18n.Translations) *CommitService {
func NewCommitService(git ports.GitService, ai ports.CommitSummarizer, ticketManager ports.TickerManager, cfg *config.Config, trans *i18n.Translations) *CommitService {
return &CommitService{
git: git,
ai: ai,
Expand Down
Loading