Update events.js

This commit is contained in:
2026-01-01 02:56:41 +08:00
committed by GitHub
parent a793a990bb
commit 89da0f9ff8

View File

@@ -65,6 +65,7 @@ import { processOptimization } from "./summarizer.js";
import { executeAutoHide } from './autoHideManager.js'; import { executeAutoHide } from './autoHideManager.js';
import { checkAndTriggerAutoSummary } from './historiographer.js'; import { checkAndTriggerAutoSummary } from './historiographer.js';
import { fillWithSecondaryApi } from './table-system/secondary-filler.js'; import { fillWithSecondaryApi } from './table-system/secondary-filler.js';
import { amilyHelper } from './tavern-helper/main.js';
export async function onMessageReceived(data) { export async function onMessageReceived(data) {
window.lastPreOptimizationResult = null; window.lastPreOptimizationResult = null;
@@ -97,11 +98,12 @@ export async function onMessageReceived(data) {
} }
if (result && result.optimizedContent && result.optimizedContent !== latestMessage.mes) { if (result && result.optimizedContent && result.optimizedContent !== latestMessage.mes) {
latestMessage.mes = result.optimizedContent; const messageId = chat.length - 1;
await saveChatConditional(); await amilyHelper.setChatMessage(
if (settings.optimizationMode === 'refresh') { { message: result.optimizedContent },
await reloadCurrentChat(); messageId,
} { refresh: 'display_and_render_current' }
);
} }
} else { } else {
console.log("[Amily2号-正文优化] 检测到消息并非AI对用户的直接回复已跳过优化。"); console.log("[Amily2号-正文优化] 检测到消息并非AI对用户的直接回复已跳过优化。");