Skip to content

Commit 68ce8d0

Browse files
authored
feat: improve model selection and API usage (#71)
- Replace `viper.GetString("openai.model")` with `currentModel` for commit message summary - Add condition to select model based on `openai.provider` value
1 parent 7ae227e commit 68ce8d0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cmd/commit.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ var commitCmd = &cobra.Command{
7272
viper.Set("openai.timeout", timeout)
7373
}
7474

75-
color.Green("Summarize the commit message use " + viper.GetString("openai.model") + " model")
75+
currentModel := viper.GetString("openai.model")
76+
if viper.GetString("openai.provider") == openai.AZURE {
77+
currentModel = viper.GetString("openai.model_name")
78+
}
79+
80+
color.Green("Summarize the commit message use " + currentModel + " model")
7681
client, err := openai.New(
7782
openai.WithToken(viper.GetString("openai.api_key")),
7883
openai.WithModel(viper.GetString("openai.model")),

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LABEL org.opencontainers.image.source=https://github.com/appleboy/CodeGPT
1212
LABEL org.opencontainers.image.description="A CLI written in Go language that writes git commit messages or do a code review brief for you using ChatGPT AI."
1313
LABEL org.opencontainers.image.licenses=MIT
1414

15-
RUN apk add --no-cache ca-certificates=20220614-r4 git=2.38.4-r1 && \
15+
RUN apk add --no-cache ca-certificates=20220614-r4 git=2.38.5-r0 && \
1616
rm -rf /var/cache/apk/*
1717

1818
COPY release/${TARGETOS}/${TARGETARCH}/codegpt /bin/

0 commit comments

Comments
 (0)