Update cwb_core.js

This commit is contained in:
2025-10-04 02:33:06 +08:00
committed by GitHub
parent 338d75a2db
commit 99f1fd0641

View File

@@ -415,7 +415,6 @@ export async function resetScriptStateForNewChat($panel, newChatName) {
state.currentChatFileIdentifier = newChatName || 'unknown_chat_fallback'; state.currentChatFileIdentifier = newChatName || 'unknown_chat_fallback';
await loadAllChatMessages($panel); await loadAllChatMessages($panel);
await manageAutoCardUpdateLorebookEntry();
logDebug('状态重置完成。'); logDebug('状态重置完成。');
} }
@@ -545,6 +544,7 @@ async function processNextBatch($panel) {
} }
export async function startBatchUpdate($panel) { export async function startBatchUpdate($panel) {
await loadAllChatMessages($panel);
if (!state.customApiConfig.url || !state.customApiConfig.model) { if (!state.customApiConfig.url || !state.customApiConfig.model) {
showToastr('warning', '请先配置API信息。'); showToastr('warning', '请先配置API信息。');
return; return;
@@ -565,7 +565,6 @@ export async function startBatchUpdate($panel) {
} }
manualBatchStopRequested = false; manualBatchStopRequested = false;
await loadAllChatMessages($panel);
if (state.allChatMessages.length === 0) { if (state.allChatMessages.length === 0) {
showToastr('info', '当前没有聊天记录,无需更新。'); showToastr('info', '当前没有聊天记录,无需更新。');
@@ -582,6 +581,7 @@ export async function startBatchUpdate($panel) {
} }
export async function handleFloorRangeUpdate($panel) { export async function handleFloorRangeUpdate($panel) {
await loadAllChatMessages($panel);
if (isUpdatingCard || isBatchUpdating) { if (isUpdatingCard || isBatchUpdating) {
showToastr('info', '已有更新任务在进行中。'); showToastr('info', '已有更新任务在进行中。');
return; return;
@@ -605,7 +605,10 @@ export async function handleFloorRangeUpdate($panel) {
return; return;
} }
await loadAllChatMessages($panel); if (state.allChatMessages.length === 0) {
showToastr('info', '当前没有聊天记录,无需更新。');
return;
}
if (endFloor > state.allChatMessages.length) { if (endFloor > state.allChatMessages.length) {
showToastr('warning', `结束楼层 ${endFloor} 超出了当前聊天记录长度 ${state.allChatMessages.length}`); showToastr('warning', `结束楼层 ${endFloor} 超出了当前聊天记录长度 ${state.allChatMessages.length}`);