Skip to content

Commit adf9b2a

Browse files
author
{cocoide}
committed
chore
1 parent 9250ee1 commit adf9b2a

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

cmd/suggest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ func NewSuggestModel() *suggestModel {
130130
log.Fatalf("設定ファイルの読み込みができませんでした")
131131
}
132132
switch config.WithGptRequestLocation() {
133-
case entity.Local:
133+
case entity.Client:
134134
nlp := gateway.NewOpenAIGateway(context.Background())
135-
commitMessageService = gateway.NewLocalMessageService(nlp)
135+
commitMessageService = gateway.NewClientCommitMessageGateway(nlp)
136136
case entity.Server:
137137
commitMessageService = gateway.NewGrpcServerGateway()
138138
}

internal/entity/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type GptRequestLocation int
3030

3131
const (
3232
Server GptRequestLocation = iota
33-
Local
33+
Client
3434
)
3535

3636
type Config struct {
@@ -138,7 +138,7 @@ func (c *Config) WithGptRequestLocation() GptRequestLocation {
138138
case 0:
139139
return Server
140140
case 1:
141-
return Local
141+
return Client
142142
default:
143143
return Server
144144
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ const (
1414

1515
var CommitMessageRegex = regexp.MustCompile(`^(\d.\s+)|^(-\s+)|^(\s+)`)
1616

17-
type localMessageService struct {
17+
type clientCommitMessageGateway struct {
1818
nlp service.NLPService
1919
}
2020

21-
func NewLocalMessageService(nlp service.NLPService) service.CommitMessageService {
22-
return &localMessageService{nlp: nlp}
21+
func NewClientCommitMessageGateway(nlp service.NLPService) service.CommitMessageService {
22+
return &clientCommitMessageGateway{nlp: nlp}
2323
}
2424

25-
func (l *localMessageService) GenerateCommitMessageList(code string, conf entity.Config) ([]string, error) {
25+
func (l *clientCommitMessageGateway) GenerateCommitMessageList(code string, conf entity.Config) ([]string, error) {
2626
prompt := fmt.Sprintf(NormalMessagePrompt, code)
2727
result, err := l.nlp.GetAnswerFromPrompt(prompt)
2828
if err != nil {
@@ -33,7 +33,7 @@ func (l *localMessageService) GenerateCommitMessageList(code string, conf entity
3333
return messages, nil
3434
}
3535

36-
func (l *localMessageService) removeFromArrayByRegex(array []string, pattern *regexp.Regexp) []string {
36+
func (l *clientCommitMessageGateway) removeFromArrayByRegex(array []string, pattern *regexp.Regexp) []string {
3737
for i, msg := range array {
3838
array[i] = pattern.ReplaceAllString(msg, "")
3939
}

0 commit comments

Comments
 (0)