mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Fix hidden-message leakage into plugin prompts
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// 为 prompt 变量扩展(Phase 2)提供统一的 ST 上下文数据接口
|
||||
|
||||
import { getContext } from "../../../../extensions.js";
|
||||
import { buildPluginVisibleChatMessages } from "../maintenance/chat-history.js";
|
||||
|
||||
function safeClone(value, fallback) {
|
||||
if (value == null) {
|
||||
@@ -62,7 +63,9 @@ function resolveLastUserMessage(chat = []) {
|
||||
|
||||
function buildStructuredSnapshot(ctx = {}) {
|
||||
const char = resolveCharacter(ctx);
|
||||
const chat = Array.isArray(ctx.chat) ? safeClone(ctx.chat, []) : [];
|
||||
const chat = Array.isArray(ctx.chat)
|
||||
? buildPluginVisibleChatMessages(ctx.chat)
|
||||
: [];
|
||||
const currentTime = new Date().toLocaleString("zh-CN");
|
||||
const globalVars = safeClone(
|
||||
ctx.extensionSettings?.variables?.global || {},
|
||||
|
||||
Reference in New Issue
Block a user