mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 15:55:50 +00:00
Update cwb_core.js
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { getContext } from '/scripts/extensions.js';
|
import { getContext } from '/scripts/extensions.js';
|
||||||
import { state, SCRIPT_ID_PREFIX } from './cwb_state.js';
|
import { state, SCRIPT_ID_PREFIX } from './cwb_state.js';
|
||||||
import { logDebug, logError, showToastr, escapeHtml, cleanChatName, parseCustomFormat } from './cwb_utils.js';
|
import { logDebug, logError, showToastr, escapeHtml, cleanChatName, parseCustomFormat, isCwbEnabled } from './cwb_utils.js';
|
||||||
import { callCustomOpenAI } from './cwb_apiService.js';
|
import { callCustomOpenAI } from './cwb_apiService.js';
|
||||||
import { saveDescriptionToLorebook, updateCharacterRosterLorebookEntry, manageAutoCardUpdateLorebookEntry, getTargetWorldBook } from './cwb_lorebookManager.js';
|
import { saveDescriptionToLorebook, updateCharacterRosterLorebookEntry, manageAutoCardUpdateLorebookEntry, getTargetWorldBook } from './cwb_lorebookManager.js';
|
||||||
import { extractBlocksByTags, applyExclusionRules } from '../../core/utils/rag-tag-extractor.js';
|
import { extractBlocksByTags, applyExclusionRules } from '../../core/utils/rag-tag-extractor.js';
|
||||||
@@ -317,10 +317,16 @@ async function triggerAutomaticUpdate($panel) {
|
|||||||
e.keys.includes(cleanChatId)
|
e.keys.includes(cleanChatId)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (rosterEntry) {
|
if (rosterEntry && rosterEntry.content) {
|
||||||
const floorRangeKey = rosterEntry.keys.find(k => /^\d+-\d+$/.test(k));
|
const floorMatch = rosterEntry.content.match(/【前(\d+)楼角色世界书已更新完成】/);
|
||||||
if (floorRangeKey) {
|
if (floorMatch && floorMatch[1]) {
|
||||||
maxEndFloorInLorebook = parseInt(floorRangeKey.split('-')[1], 10);
|
maxEndFloorInLorebook = parseInt(floorMatch[1], 10);
|
||||||
|
} else {
|
||||||
|
// Fallback for older entries
|
||||||
|
const floorRangeKey = rosterEntry.keys.find(k => /^\d+-\d+$/.test(k));
|
||||||
|
if (floorRangeKey) {
|
||||||
|
maxEndFloorInLorebook = parseInt(floorRangeKey.split('-')[1], 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -359,7 +365,7 @@ export async function getLatestChatName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function handleMessageReceived($panel) {
|
export async function handleMessageReceived($panel) {
|
||||||
if (!checkCwbEnabled('消息接收处理')) {
|
if (!isCwbEnabled('消息接收处理')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user