Skip to content

Commit

Permalink
update NeedExectue
Browse files Browse the repository at this point in the history
  • Loading branch information
rinfx committed Feb 25, 2025
1 parent 698c340 commit 66fc6df
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugins/wasm-go/extensions/ai-search/engine/bing/bing.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewBingSearch(config *gjson.Result) (*BingSearch, error) {
}

func (b BingSearch) NeedExectue(ctx engine.SearchContext) bool {
return ctx.EngineType == "internet"
return ctx.EngineType == "" || ctx.EngineType == "internet"
}

func (b BingSearch) Client() wrapper.HttpClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewGoogleSearch(config *gjson.Result) (*GoogleSearch, error) {
}

func (g GoogleSearch) NeedExectue(ctx engine.SearchContext) bool {
return ctx.EngineType == "internet"
return ctx.EngineType == "" || ctx.EngineType == "internet"
}

func (g GoogleSearch) Client() wrapper.HttpClient {
Expand Down
2 changes: 1 addition & 1 deletion plugins/wasm-go/extensions/ai-search/engine/quark/quark.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func NewQuarkSearch(config *gjson.Result) (*QuarkSearch, error) {
}

func (g QuarkSearch) NeedExectue(ctx engine.SearchContext) bool {
return ctx.EngineType == "internet"
return ctx.EngineType == "" || ctx.EngineType == "internet"
}

func (g QuarkSearch) Client() wrapper.HttpClient {
Expand Down
4 changes: 2 additions & 2 deletions plugins/wasm-go/extensions/ai-search/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func executeSearch(ctx wrapper.HttpContext, config Config, queryIndex int, body
// Check if engine needs to execute for any of the search contexts
var needsExecute bool
for _, searchCtx := range searchContexts {
if searchCtx.EngineType == "" || configEngine.NeedExectue(searchCtx) {
if configEngine.NeedExectue(searchCtx) {
needsExecute = true
break
}
Expand All @@ -393,7 +393,7 @@ func executeSearch(ctx wrapper.HttpContext, config Config, queryIndex int, body

// Process all search contexts for this engine
for _, searchCtx := range searchContexts {
if searchCtx.EngineType != "" && !configEngine.NeedExectue(searchCtx) {
if !configEngine.NeedExectue(searchCtx) {
continue
}
args := configEngine.CallArgs(searchCtx)
Expand Down

0 comments on commit 66fc6df

Please sign in to comment.