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: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1

# -✂- this stage is used to compile the application -------------------------------------------------------------------
FROM docker.io/library/golang:1.26-alpine AS compile
FROM docker.io/library/golang:1.26.3-alpine AS compile

# can be passed with any prefix (like `v1.2.3@FOO`), e.g.: `docker build --build-arg "APP_VERSION=v1.2.3@FOO" .`
ARG APP_VERSION="undefined@docker"
Expand All @@ -21,7 +21,7 @@ RUN set -x \
&& ./describe-commit --help

# -✂- and this is the final stage -------------------------------------------------------------------------------------
FROM docker.io/library/alpine:3.22 AS runtime
FROM docker.io/library/alpine:3.23.4 AS runtime

ARG APP_VERSION="undefined@docker"

Expand Down
4 changes: 2 additions & 2 deletions internal/ai/anthropic.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ func (p *Anthropic) newRequest(
TopP: 0.1, //nolint:mnd
MaxTokens: o.MaxOutputTokens,
Messages: []message{
{Role: "user", Content: wrapChanges(changes)},
{Role: "user", Content: wrapCommits(commits)},
{Role: roleUser, Content: wrapChanges(changes)},
{Role: roleUser, Content: wrapCommits(commits)},
},
})
if jErr != nil {
Expand Down
10 changes: 6 additions & 4 deletions internal/ai/gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (

const geminiDefaultBaseURL = "https://generativelanguage.googleapis.com"

const safetyThresholdBlockLowAndAbove = "BLOCK_LOW_AND_ABOVE"

// Gemini is a provider for the Gemini API.
type Gemini struct {
httpClient httpClient
Expand Down Expand Up @@ -166,10 +168,10 @@ func (p *Gemini) newRequest( //nolint:funlen
CandidateCount: 1,
},
SafetySettings: []safetySetting{
{Category: "HARM_CATEGORY_DANGEROUS_CONTENT", Threshold: "BLOCK_LOW_AND_ABOVE"},
{Category: "HARM_CATEGORY_HARASSMENT", Threshold: "BLOCK_LOW_AND_ABOVE"},
{Category: "HARM_CATEGORY_HATE_SPEECH", Threshold: "BLOCK_LOW_AND_ABOVE"},
{Category: "HARM_CATEGORY_SEXUALLY_EXPLICIT", Threshold: "BLOCK_LOW_AND_ABOVE"},
{Category: "HARM_CATEGORY_DANGEROUS_CONTENT", Threshold: safetyThresholdBlockLowAndAbove},
{Category: "HARM_CATEGORY_HARASSMENT", Threshold: safetyThresholdBlockLowAndAbove},
{Category: "HARM_CATEGORY_HATE_SPEECH", Threshold: safetyThresholdBlockLowAndAbove},
{Category: "HARM_CATEGORY_SEXUALLY_EXPLICIT", Threshold: safetyThresholdBlockLowAndAbove},
},
Contents: []content{{Parts: []contentPart{
{Text: wrapChanges(changes)},
Expand Down
4 changes: 2 additions & 2 deletions internal/ai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ func (p *OpenAI) newRequest(
MaxCompletionTokens: o.MaxOutputTokens,
Messages: []message{
{Role: "system", Content: instructions},
{Role: "user", Content: wrapChanges(changes)},
{Role: "user", Content: wrapCommits(commits)},
{Role: roleUser, Content: wrapChanges(changes)},
{Role: roleUser, Content: wrapCommits(commits)},
},
})
if jErr != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/ai/openrouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ func (p *OpenRouter) newRequest(
MaxTokens: o.MaxOutputTokens,
Messages: []message{
{Role: "system", Content: instructions},
{Role: "user", Content: wrapChanges(changes)},
{Role: "user", Content: wrapCommits(commits)},
{Role: roleUser, Content: wrapChanges(changes)},
{Role: roleUser, Content: wrapCommits(commits)},
},
})
if jErr != nil {
Expand Down
5 changes: 4 additions & 1 deletion internal/ai/providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ type (
}
)

const defaultMaxOutputTokens = 500
const (
defaultMaxOutputTokens = 500
roleUser = "user"
)

// httpClient is an interface for the common HTTP client.
type httpClient interface {
Expand Down