mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-07 10:55:51 +00:00
Update events.js
This commit is contained in:
@@ -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对用户的直接回复,已跳过优化。");
|
||||||
|
|||||||
Reference in New Issue
Block a user