初始化提交
This commit is contained in:
commit
887c1f449e
963 files changed
+166869
No files matched your search
@@ -0,0 +1,45 @@
|
||||
// Package models 定义博闻的数据类型。
|
||||
package models
|
||||
|
||||
// ProviderKind 搜索提供商枚举。
|
||||
type ProviderKind string
|
||||
|
||||
const (
|
||||
ProviderTavily ProviderKind = "tavily"
|
||||
ProviderBrave ProviderKind = "brave"
|
||||
)
|
||||
|
||||
// SearchMode 搜索结果聚合模式。
|
||||
type SearchMode string
|
||||
|
||||
const (
|
||||
ModeFirst SearchMode = "first" // 首个成功返回(低延迟,默认)
|
||||
ModeMerge SearchMode = "merge" // 合并多 provider 结果(高召回)
|
||||
)
|
||||
|
||||
// SearchRequest MCP 工具入参。
|
||||
type SearchRequest struct {
|
||||
Query string `json:"query"`
|
||||
MaxResults int `json:"max_results"`
|
||||
Providers []string `json:"providers,omitempty"`
|
||||
Mode SearchMode `json:"mode,omitempty"`
|
||||
}
|
||||
|
||||
// SearchResult 统一搜索响应。
|
||||
type SearchResult struct {
|
||||
Provider ProviderKind `json:"provider"`
|
||||
Query string `json:"query"`
|
||||
Results []ResultItem `json:"results"`
|
||||
TotalCount int `json:"total_count"`
|
||||
DurationMs int64 `json:"duration_ms"`
|
||||
Cached bool `json:"cached"`
|
||||
}
|
||||
|
||||
// ResultItem 单条搜索结果。
|
||||
type ResultItem struct {
|
||||
Title string `json:"title"`
|
||||
URL string `json:"url"`
|
||||
Snippet string `json:"snippet"`
|
||||
PublishedAt string `json:"published_at,omitempty"`
|
||||
Score float64 `json:"score,omitempty"`
|
||||
}
|
||||
Reference in new issue
Block a user