+ import type { ButtonProps } from '@nuxt/ui'
import type { ResearchStep } from '~/lib/deep-research'
export type TreeNodeStatus = Exclude
@@ -24,38 +25,43 @@
(e: 'select', value: TreeNode): void
}>()
- const icon = computed(() => {
- const result = { name: '', pulse: false }
+ const theme = computed(() => {
+ const result = {
+ icon: '',
+ pulse: false,
+ color: 'info' as ButtonProps['color'],
+ }
if (!props.node.status) return result
switch (props.node.status) {
case 'generating_query':
- result.name = 'i-lucide-clipboard-list'
+ result.icon = 'i-lucide-clipboard-list'
result.pulse = true
break
case 'generated_query':
- // FIXME: 因为 deepResearch 有并发限制,这个 case 是为了明确区分状态。
- // 但是目前进入这个状态之后再进入 searching 状态,图标不会更新成 search,不知道原因
- // 暂时禁用了这个 case
- // result.name = 'i-lucide-pause'
- // result.pulse = true
- // break
+ // FIXME: 因为 deepResearch 有并发限制,这个 case 是为了明确区分状态。
+ // 但是目前进入这个状态之后再进入 searching 状态,图标不会更新成 search,不知道原因
+ // 暂时禁用了这个 case
+ // result.name = 'i-lucide-pause'
+ // result.pulse = true
+ // break
case 'searching':
- result.name = 'i-lucide-search'
+ result.icon = 'i-lucide-search'
result.pulse = true
break
case 'search_complete':
- result.name = 'i-lucide-search-check'
+ result.icon = 'i-lucide-search-check'
break
case 'processing_serach_result':
- result.name = 'i-lucide-brain'
+ result.icon = 'i-lucide-brain'
result.pulse = true
break
case 'processed_search_result':
- result.name = 'i-lucide-circle-check-big'
+ result.icon = 'i-lucide-circle-check-big'
break
case 'error':
- result.name = 'i-lucide-octagon-x'
+ result.icon = 'i-lucide-octagon-x'
+ result.color = 'error'
break
}
return result
@@ -66,10 +72,10 @@
diff --git a/i18n/en.json b/i18n/en.json
index 08de0dc..18df3a8 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -73,5 +73,8 @@
"error": "Generate report failed: {0}",
"downloadingFonts": "Downloading necessary fonts, this may take some time...",
"downloadFontFailed": "Download font failed"
+ },
+ "error": {
+ "requestBlockedByCORS": "The current API provider may not allow cross-origin requests. Please try a different service provider or contact the provider for support."
}
}
\ No newline at end of file
diff --git a/i18n/zh.json b/i18n/zh.json
index d58ffb6..a8f6323 100644
--- a/i18n/zh.json
+++ b/i18n/zh.json
@@ -73,5 +73,8 @@
"error": "生成报告失败:{0}",
"downloadingFonts": "正在下载必要字体,可能需要较长时间...",
"downloadFontFailed": "下载字体失败"
+ },
+ "error": {
+ "requestBlockedByCORS": "当前 API 服务可能不允许接口跨域,请换一个服务试试,或者向服务方反馈。"
}
}
\ No newline at end of file
diff --git a/lib/deep-research.ts b/lib/deep-research.ts
index 15b19f6..37b2bb4 100644
--- a/lib/deep-research.ts
+++ b/lib/deep-research.ts
@@ -110,6 +110,9 @@ export function generateSearchQueries({
model: useAiModel(),
system: systemPrompt(),
prompt,
+ onError({ error }) {
+ throw error
+ },
})
}
@@ -159,6 +162,9 @@ function processSearchResult({
abortSignal: AbortSignal.timeout(60_000),
system: systemPrompt(),
prompt,
+ onError({ error }) {
+ throw error
+ },
})
}
@@ -187,6 +193,9 @@ export function writeFinalReport({
model: useAiModel(),
system: systemPrompt(),
prompt: _prompt,
+ onError({ error }) {
+ throw error
+ },
})
}
diff --git a/lib/feedback.ts b/lib/feedback.ts
index 0dac09a..a125bee 100644
--- a/lib/feedback.ts
+++ b/lib/feedback.ts
@@ -36,6 +36,9 @@ export function generateFeedback({
model: useAiModel(),
system: systemPrompt(),
prompt,
+ onError({ error }) {
+ throw error
+ },
})
return parseStreamingJson(
diff --git a/scripts/build.js b/scripts/build.js
index bd78183..5b0f48f 100644
--- a/scripts/build.js
+++ b/scripts/build.js
@@ -10,7 +10,7 @@
*
* So I wrote this script to override the encodings in `@tavily/core` to `o200k_base`
* and clean up unused js-tiktoken encodings in the build output,
- * making the build output smaller by about 2 MB.
+ * making the build output smaller by about 3 MB.
*/
import { execSync } from 'child_process';