mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Merge upstream/main: resolve format-only conflicts
Adopt upstream multi-line formatting for chat-history.js and tests/chat-history.mjs. Also brings in upstream .gitignore, settleExtractionStatusAfterHistoryRecovery null-safety fix, and getSmartTriggerDecision index-aware extraction filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
48
index.js
48
index.js
@@ -4412,22 +4412,6 @@ function notifyExtractionIssue(message, title = "ST-BME 提取提示") {
|
||||
toastr.warning(message, title, { timeOut: 4500 });
|
||||
}
|
||||
|
||||
function settleExtractionStatusAfterHistoryRecovery(
|
||||
text = "提取完成",
|
||||
meta = "",
|
||||
level = "success",
|
||||
) {
|
||||
const currentText = String(lastExtractionStatus?.text || "");
|
||||
const currentLevel = String(lastExtractionStatus?.level || "");
|
||||
if (currentText !== "AI 生成中" && currentLevel !== "running") {
|
||||
return;
|
||||
}
|
||||
setLastExtractionStatus(text, meta, level, {
|
||||
syncRuntime: true,
|
||||
toastKind: "",
|
||||
});
|
||||
}
|
||||
|
||||
async function fetchLocalWithTimeout(
|
||||
url,
|
||||
options = {},
|
||||
@@ -5668,8 +5652,12 @@ const DEFAULT_TRIGGER_KEYWORDS = [
|
||||
export function getSmartTriggerDecision(chat, lastProcessed, settings) {
|
||||
const pendingMessages = chat
|
||||
.slice(Math.max(0, (lastProcessed ?? -1) + 1))
|
||||
.filter((msg) => !isSystemMessageForExtraction(msg))
|
||||
.map((msg) => ({
|
||||
.map((msg, offset) => ({
|
||||
msg,
|
||||
index: Math.max(0, (lastProcessed ?? -1) + 1) + offset,
|
||||
}))
|
||||
.filter(({ msg, index }) => !isSystemMessageForExtraction(msg, { index, chat }))
|
||||
.map(({ msg }) => ({
|
||||
role: msg.is_user ? "user" : "assistant",
|
||||
content: msg.mes || "",
|
||||
}))
|
||||
@@ -7936,6 +7924,30 @@ async function recoverHistoryIfNeeded(trigger = "history-recovery") {
|
||||
}
|
||||
}
|
||||
|
||||
function settleExtractionStatusAfterHistoryRecovery(
|
||||
text = "提取完成",
|
||||
meta = "",
|
||||
level = "success",
|
||||
) {
|
||||
const statusSnapshot =
|
||||
typeof lastExtractionStatus === "object" && lastExtractionStatus
|
||||
? lastExtractionStatus
|
||||
: null;
|
||||
if (!statusSnapshot || typeof setLastExtractionStatus !== "function") {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentText = String(statusSnapshot.text || "");
|
||||
const currentLevel = String(statusSnapshot.level || "");
|
||||
if (currentText !== "AI 生成中" && currentLevel !== "running") {
|
||||
return;
|
||||
}
|
||||
setLastExtractionStatus(text, meta, level, {
|
||||
syncRuntime: true,
|
||||
toastKind: "",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取管线:处理未提取的对话楼层
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user