Files
Enterprise-Knowledge-Base/internal/application/service/web_search_exa.go
T
wizardchen 07a8c1de4c feat: Add web search functionality and enhance agent mode integration
- Introduced web search configuration in config.yaml, allowing multiple providers with specific settings.
- Updated InputField component to manage agent mode and web search toggles, improving user interaction.
- Enhanced chat API to include web search status in requests, enabling dynamic query handling.
- Implemented backend support for web search integration, merging results with knowledge base queries.
- Added tenant-level web search configuration management, allowing customization per tenant.
2025-11-10 03:14:12 +08:00

40 lines
929 B
Go

package service
import (
"context"
"fmt"
"github.com/Tencent/WeKnora/internal/config"
"github.com/Tencent/WeKnora/internal/types"
)
// ExaProvider implements web search using Exa API
type ExaProvider struct {
apiKey string
apiURL string
}
// NewExaProvider creates a new Exa provider
func NewExaProvider(cfg config.WebSearchProviderConfig) (WebSearchProvider, error) {
return &ExaProvider{
apiURL: cfg.APIURL,
}, nil
}
// Name returns the provider name
func (p *ExaProvider) Name() string {
return "exa"
}
// Search performs a web search using Exa API
func (p *ExaProvider) Search(ctx context.Context, query string, maxResults int, includeDate bool) ([]*types.WebSearchResult, error) {
// TODO: Implement Exa search API
return nil, fmt.Errorf("exa search provider is not yet implemented")
}
// SetAPIKey sets the API key for the provider
func (p *ExaProvider) SetAPIKey(apiKey string) {
p.apiKey = apiKey
}