chore: throw error when no search results found

This commit is contained in:
AnotiaWang
2025-03-23 14:53:09 +08:00
parent c8ae1ece95
commit ff1e79603d
4 changed files with 9 additions and 3 deletions

View File

@ -92,7 +92,8 @@
"nodeFailed": "Search failed", "nodeFailed": "Search failed",
"nodeFailedToast": "Search node \"{label}\" failed", "nodeFailedToast": "Search node \"{label}\" failed",
"followUpQuestions": "Follow-up Questions", "followUpQuestions": "Follow-up Questions",
"retry": "Retry" "retry": "Retry",
"noSearchResult": "No search results found"
}, },
"researchReport": { "researchReport": {
"title": "4. Research Report", "title": "4. Research Report",

View File

@ -92,7 +92,8 @@
"nodeFailed": "Zoeken mislukt", "nodeFailed": "Zoeken mislukt",
"nodeFailedToast": "Zoekknooppunt \"{label}\" is mislukt", "nodeFailedToast": "Zoekknooppunt \"{label}\" is mislukt",
"followUpQuestions": "Vervolgvragen", "followUpQuestions": "Vervolgvragen",
"retry": "Opnieuw proberen" "retry": "Opnieuw proberen",
"noSearchResult": "Geen zoekresultaten gevonden"
}, },
"researchReport": { "researchReport": {
"title": "4. Onderzoeksrapport", "title": "4. Onderzoeksrapport",

View File

@ -92,7 +92,8 @@
"nodeFailed": "搜索失败", "nodeFailed": "搜索失败",
"nodeFailedToast": "搜索步骤 “{label}” 失败", "nodeFailedToast": "搜索步骤 “{label}” 失败",
"followUpQuestions": "后续问题", "followUpQuestions": "后续问题",
"retry": "重试" "retry": "重试",
"noSearchResult": "未找到搜索结果"
}, },
"researchReport": { "researchReport": {
"title": "4. 研究报告", "title": "4. 研究报告",

View File

@ -384,6 +384,9 @@ export async function deepResearch({
maxResults: 5, maxResults: 5,
lang: languageCode, lang: languageCode,
}) })
if (!results.length) {
throw new Error(t('webBrowsing.noSearchResult'))
}
console.log( console.log(
`[DeepResearch] Searched "${searchQuery.query}", found ${results.length} contents`, `[DeepResearch] Searched "${searchQuery.query}", found ${results.length} contents`,
) )