diff --git a/.gitignore b/.gitignore index 5b041ad..42d89e8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ AGENTS.md plans/fix-regex-stage-alias-override.md 猫妖恬恬.json plan_global_task_regex.md +docs/BME六大功能全景解析.xlsx diff --git a/ena-planner/ena-planner.js b/ena-planner/ena-planner.js index 46396b7..981a947 100644 --- a/ena-planner/ena-planner.js +++ b/ena-planner/ena-planner.js @@ -20,6 +20,13 @@ function getPlannerRecallTimeoutMs() { : VECTOR_RECALL_TIMEOUT_MS; } +function getPlannerRequestTimeoutMs() { + const timeoutMs = Number(_bmeRuntime?.getPlannerRecallTimeoutMs?.()); + return Number.isFinite(timeoutMs) && timeoutMs > 0 + ? timeoutMs + : PLANNER_REQUEST_TIMEOUT_MS; +} + function getTrustedOrigin() { return window.location.origin; } function postToIframe(iframe, payload) { @@ -988,7 +995,8 @@ async function callPlanner(messages, options = {}) { if (mt != null && !Number.isNaN(mt) && mt > 0) body.max_tokens = mt; const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), PLANNER_REQUEST_TIMEOUT_MS); + const plannerRequestTimeoutMs = getPlannerRequestTimeoutMs(); + const timeoutId = setTimeout(() => controller.abort(), plannerRequestTimeoutMs); try { const res = await fetch(url, { method: 'POST', @@ -1047,7 +1055,7 @@ async function callPlanner(messages, options = {}) { return full; } catch (err) { if (controller.signal.aborted || err?.name === 'AbortError') { - throw new Error(`规划请求超时(>${Math.floor(PLANNER_REQUEST_TIMEOUT_MS / 1000)}s)`); + throw new Error(`规划请求超时(>${Math.floor(plannerRequestTimeoutMs / 1000)}s)`); } throw err; } finally { diff --git a/manifest.json b/manifest.json index 90078ae..51a5f15 100644 --- a/manifest.json +++ b/manifest.json @@ -6,6 +6,6 @@ "js": "index.js", "css": "style.css", "author": "Youzini", - "version": "4.2.2", + "version": "4.2.3", "homePage": "https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology" }