Skip to content

Commit c96548e

Browse files
committed
refactor: refactor AI engine initialization to use New function
- Renamed `NewLLMEngine` function to `New` in the AI engine initialization. - Updated all references to `NewLLMEngine` to use the new `New` function across multiple files. Signed-off-by: codiing-hui <wecoding@yeah.net>
1 parent 19a8d41 commit c96548e

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

internal/ai/ai.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type Engine struct {
3434
Config *options.Config
3535
}
3636

37-
func NewLLMEngine(ops ...EngineOption) (*Engine, error) {
37+
func New(ops ...EngineOption) (*Engine, error) {
3838
return applyEngineOptions(ops...)
3939
}
4040

internal/cli/ask/ask.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func (o *Options) Run() error {
9494
runMode = ui.ReplMode
9595
}
9696

97-
engine, err := ai.NewLLMEngine(ai.WithConfig(o.cfg))
97+
engine, err := ai.New(ai.WithConfig(o.cfg))
9898
if err != nil {
9999
return err
100100
}

internal/cli/coder/coder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (o *Options) run(_ *cobra.Command, args []string) error {
4343
return errbook.Wrap("Could not get git root", err)
4444
}
4545

46-
engine, err := ai.NewLLMEngine(ai.WithConfig(o.cfg))
46+
engine, err := ai.New(ai.WithConfig(o.cfg))
4747
if err != nil {
4848
return errbook.Wrap("Could not initialized ai engine", err)
4949
}

internal/cli/commit/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (o *Options) AutoCommit(_ *cobra.Command, args []string) error {
140140
o.userPrompt = strings.TrimSpace(strings.Join(args, " "))
141141
}
142142

143-
llmEngine, err := ai.NewLLMEngine(ai.WithConfig(o.cfg))
143+
llmEngine, err := ai.New(ai.WithConfig(o.cfg))
144144
if err != nil {
145145
return err
146146
}

internal/cli/review/review.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (o *Options) reviewCode(cmd *cobra.Command, args []string) error {
5353
return errors.New("git command not found on your system's PATH. Please install Git and try again")
5454
}
5555

56-
llmEngine, err := ai.NewLLMEngine(ai.WithConfig(o.cfg))
56+
llmEngine, err := ai.New(ai.WithConfig(o.cfg))
5757
if err != nil {
5858
return err
5959
}

internal/ui/coders/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type CoderContext struct {
2222
func NewCoderContext(cfg *options.Config) (*CoderContext, error) {
2323
repo := git.New()
2424
root, _ := repo.GitDir()
25-
engine, err := ai.NewLLMEngine(ai.WithConfig(cfg))
25+
engine, err := ai.New(ai.WithConfig(cfg))
2626
if err != nil {
2727
return nil, errbook.Wrap("Could not initialized ai engine", err)
2828
}

0 commit comments

Comments
 (0)