Skip to content

Commit 83c5f6c

Browse files
committed
refactor: refactor engine option naming for consistency
- Rename `EngineOption` to `Option` for consistency. - Rename `applyEngineOptions` to `applyOptions` for consistency. - Update function signatures to use the new `Option` type. Signed-off-by: codiing-hui <wecoding@yeah.net>
1 parent c96548e commit 83c5f6c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

internal/ai/ai.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ type Engine struct {
3434
Config *options.Config
3535
}
3636

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

4141
func (e *Engine) SetMode(m EngineMode) {

internal/ai/ai_options.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ import (
1111
"github.com/coding-hui/wecoding-sdk-go/services/ai/llms/openai"
1212
)
1313

14-
type EngineOption func(*Engine)
14+
type Option func(*Engine)
1515

16-
func WithMode(mode EngineMode) EngineOption {
16+
func WithMode(mode EngineMode) Option {
1717
return func(e *Engine) {
1818
e.mode = mode
1919
}
2020
}
2121

22-
func WithConfig(cfg *options.Config) EngineOption {
22+
func WithConfig(cfg *options.Config) Option {
2323
return func(e *Engine) {
2424
e.Config = cfg
2525
}
2626
}
2727

28-
func WithStore(store convo.Store) EngineOption {
28+
func WithStore(store convo.Store) Option {
2929
return func(a *Engine) {
3030
a.convoStore = store
3131
}
3232
}
3333

34-
func applyEngineOptions(engineOpts ...EngineOption) (engine *Engine, err error) {
34+
func applyOptions(engineOpts ...Option) (engine *Engine, err error) {
3535
engine = &Engine{
3636
channel: make(chan StreamCompletionOutput),
3737
running: false,

0 commit comments

Comments
 (0)