Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

fix(ui): surface a toast when reading the run logs fails

hairyf0ecd7326ae87
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 4370a555..edf993e4 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -156,6 +156,7 @@
"nav.maximize": "Maximize",
"nav.background": "Background",
"messages.logs_copied": "Logs copied to clipboard",
+ "messages.logs_read_failed": "Failed to read logs. Please try again.",
"app.help": "Help",
"profiles.title": "Profiles",
"profiles.tooltip": "Profiles are isolated bundles of plugins, patches and settings in dsh. The desktop runs in the default web profile; create new profiles to trial different plugin combinations without affecting the current setup.",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index f16e2754..1d79be76 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -156,6 +156,7 @@
"nav.maximize": "最大化",
"nav.background": "后台化",
"messages.logs_copied": "日志已复制到剪贴板",
+ "messages.logs_read_failed": "读取日志失败,请稍后重试",
"app.help": "帮助",
"profiles.title": "档案",
"profiles.tooltip": "档案是 dsh 中一组相互隔离的配置集合,包含各自的插件、补丁与设置。桌面端运行在默认的 web 档案中;新建档案可试用不同的插件组合而不影响当前配置。",
diff --git a/src/layout/components/setup.tsx b/src/layout/components/setup.tsx
index 5d9f8bc3..8b523b73 100644
--- a/src/layout/components/setup.tsx
+++ b/src/layout/components/setup.tsx
@@ -8,6 +8,7 @@ import { useStore } from 'valtio-define'
import { button } from '@/components/primitives'
import { store } from '@/store'
import { writeClipboardText } from '@/utils/clipboard'
+import { toast } from '@/utils/toast'
import { Loadable } from './loadable'
// 各阶段对应不同图标,保持与 logo 一致的黑白中性色调
@@ -21,14 +22,20 @@ const STATUS_ICONS: Record<SetupStatus, IconComponent> = {
}
async function copyLogsHandler(t: (key: string) => string) {
+ let logs: string
try {
- const logs = await invoke<string>('read_run_logs')
- // 成功/失败提示由 writeClipboardText 统一给出,这里只记录日志
- await writeClipboardText(logs, t('messages.logs_copied'))
+ logs = await invoke<string>('read_run_logs')
}
catch (err) {
- console.error('[Setup] failed to copy logs:', err)
+ // 读取失败必须可见:静默 catch 会让「复制日志」看起来毫无反应
+ console.error('[Setup] failed to read logs:', err)
+ toast(t('messages.logs_read_failed'), { variant: 'danger' })
+ return
}
+ // 成功/失败提示由 writeClipboardText 统一给出,这里只记录日志
+ await writeClipboardText(logs, t('messages.logs_copied')).catch((err) => {
+ console.error('[Setup] failed to copy logs:', err)
+ })
}
/**