mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Merge pull request #24 from Hao19911125/main
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,3 +12,4 @@ AGENTS.md
|
||||
plans/fix-regex-stage-alias-override.md
|
||||
猫妖恬恬.json
|
||||
plan_global_task_regex.md
|
||||
docs/BME六大功能全景解析.xlsx
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
"js": "index.js",
|
||||
"css": "style.css",
|
||||
"author": "Youzini",
|
||||
"version": "4.2.1",
|
||||
"version": "4.2.3",
|
||||
"homePage": "https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user