Update commands.js

This commit is contained in:
2026-01-01 02:57:03 +08:00
committed by GitHub
parent 89da0f9ff8
commit a60e03116b

View File

@@ -4,6 +4,7 @@ import { extensionName } from "../utils/settings.js";
import { SlashCommand } from "/scripts/slash-commands/SlashCommand.js"; import { SlashCommand } from "/scripts/slash-commands/SlashCommand.js";
import { SlashCommandParser } from "/scripts/slash-commands/SlashCommandParser.js"; import { SlashCommandParser } from "/scripts/slash-commands/SlashCommandParser.js";
import { checkAndFixWithAPI } from "./api.js"; import { checkAndFixWithAPI } from "./api.js";
import { amilyHelper } from './tavern-helper/main.js';
async function checkLatestMessage() { async function checkLatestMessage() {
const context = getContext(); const context = getContext();
@@ -94,9 +95,12 @@ export async function fixCommand() {
result.optimizedContent && result.optimizedContent &&
result.optimizedContent !== latestMessage.mes result.optimizedContent !== latestMessage.mes
) { ) {
latestMessage.mes = result.optimizedContent; const messageId = chat.length - 1;
await saveChatConditional(); await amilyHelper.setChatMessage(
await reloadCurrentChat(); { message: result.optimizedContent },
messageId,
{ refresh: 'display_and_render_current' }
);
toastr.success("回复已修复", "命令检查器"); toastr.success("回复已修复", "命令检查器");
} else { } else {
toastr.info("未检测到需要修复的问题", "命令检查器"); toastr.info("未检测到需要修复的问题", "命令检查器");