bhg-helper 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli/cli.js +10 -3
  2. package/package.json +1 -1
package/cli/cli.js CHANGED
@@ -184,9 +184,16 @@ async function apiPost(pathname) {
184
184
  }
185
185
 
186
186
  async function apiGet(pathname) {
187
- const res = await fetch(`${API_URL}${pathname}`)
188
- if (!res.ok) return null
189
- return await res.json().catch(() => null)
187
+ try {
188
+ const controller = new AbortController()
189
+ const timer = setTimeout(() => controller.abort(), 800)
190
+ const res = await fetch(`${API_URL}${pathname}`, { signal: controller.signal })
191
+ clearTimeout(timer)
192
+ if (!res.ok) return null
193
+ return await res.json().catch(() => null)
194
+ } catch {
195
+ return null
196
+ }
190
197
  }
191
198
 
192
199
  async function apiHealth() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhg-helper",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "BHG-helper:AI 编程工具 DeepSeek 中转 & 可视化配置工具",
5
5
  "type": "module",
6
6
  "bin": {