diff --git a/components/ConfigManager.vue b/components/ConfigManager.vue
index b946f27..2e01328 100644
--- a/components/ConfigManager.vue
+++ b/components/ConfigManager.vue
@@ -70,6 +70,7 @@
supportsCustomApiBase: true,
},
])
+ const tavilySearchTopicOptions = ['general', 'news', 'finance']
const selectedAiProvider = computed(() =>
aiProviderOptions.value.find((o) => o.value === config.value.ai.provider),
)
@@ -323,6 +324,27 @@
:step="1"
/>
+
+
+
+
+
+
+
+
+
+
diff --git a/composables/useWebSearch.ts b/composables/useWebSearch.ts
index bab2d69..b33ad5e 100644
--- a/composables/useWebSearch.ts
+++ b/composables/useWebSearch.ts
@@ -47,7 +47,11 @@ export const useWebSearch = (): WebSearchFunction => {
apiKey: config.webSearch.apiKey,
})
return async (q: string, o: WebSearchOptions) => {
- const results = await tvly.search(q, o)
+ const results = await tvly.search(q, {
+ ...o,
+ searchDepth: config.webSearch.tavilyAdvancedSearch ? 'advanced' : 'basic',
+ topic: config.webSearch.tavilySearchTopic,
+ })
return results.results
.filter((x) => !!x?.content && !!x.url)
.map((r) => ({
diff --git a/i18n/en.json b/i18n/en.json
index cf8334a..dd29069 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -37,7 +37,11 @@
"queryLanguageHelp": "The language of the search query. Useful if you want to get search results in a different language.\nWhen writing conclusions, the AI model will still use the language same as the web UI.",
"providers": {
"tavily": {
- "help": "Similar to Firecrawl, but provides 1000 free credits / month. Get one API key at {0}."
+ "help": "Similar to Firecrawl, but provides 1000 free credits / month. Get one API key at {0}.",
+ "advancedSearch": "Advanced Search",
+ "advancedSearchHelp": "Get higher quality search results. Costs 1 extra credit each time.",
+ "searchTopic": "Search Topic",
+ "searchTopicHelp": "Optimize the search for the selected topic with tailored and curated information. Defaults to 'general'."
},
"firecrawl": {
"help": "Get one API key at {0} if you are using the official service."
diff --git a/i18n/zh.json b/i18n/zh.json
index 893d42b..60b75a4 100644
--- a/i18n/zh.json
+++ b/i18n/zh.json
@@ -40,7 +40,11 @@
"help": "如果你使用的是官方服务,请在 {0} 获取 API key。"
},
"tavily": {
- "help": "和 Firecrawl 类似,不过提供了每月 1000 次免费搜索。在 {0} 获取一个 API key。"
+ "help": "和 Firecrawl 类似,不过提供了每月 1000 次免费搜索。在 {0} 获取一个 API key。",
+ "advancedSearchHelp": "获得更高质量的搜索结果。每次多消耗一个搜索点数 (credit)。",
+ "searchTopic": "搜索领域",
+ "advancedSearch": "高质量搜索",
+ "searchTopicHelp": "搜索特定领域的信息,获得更精确的结果。默认为“通用” (general)。"
}
},
"concurrencyLimit": "并发数",
diff --git a/stores/config.ts b/stores/config.ts
index cf30f37..ccb1f62 100644
--- a/stores/config.ts
+++ b/stores/config.ts
@@ -26,6 +26,10 @@ export interface ConfigWebSearch {
searchLanguage?: Locale
/** Limit the number of concurrent tasks globally */
concurrencyLimit?: number
+ /** Tavily: use advanced search to retrieve higher quality results */
+ tavilyAdvancedSearch?: boolean
+ /** Tavily: search topic. Defaults to `general` */
+ tavilySearchTopic?: 'general' | 'news' | 'finance'
}
export interface Config {