Compare commits

..

3 Commits

Author SHA1 Message Date
e2b46fcd59 Merge branch 'main' of github.com:SilenceLurker/ST-Amily2-Chat-Optimisation 2025-12-28 20:09:42 +08:00
5173133a69 Update manifest.json 2025-12-28 19:48:15 +08:00
5fe9b2a21c Update executor.js 2025-12-28 19:47:57 +08:00
2 changed files with 28 additions and 6 deletions

View File

@@ -5,6 +5,13 @@ function insertRow(state, tableIndex, data) {
log(`AI指令错误尝试在不存在的表格索引 ${tableIndex} 中插入行。`, 'error');
return { state, changes: [] };
}
// 【安全检查】确保 data 是对象
if (typeof data !== 'object' || data === null) {
log(`AI指令错误insertRow 的 data 参数必须是对象,实际收到: ${typeof data} (${data})`, 'error');
return { state, changes: [] };
}
const table = state[tableIndex];
const colCount = table.headers.length;
const newRow = Array(colCount).fill('');
@@ -28,6 +35,12 @@ function updateRow(state, tableIndex, rowIndex, data) {
return { state, changes: [] };
}
// 【安全检查】确保 data 是对象
if (typeof data !== 'object' || data === null) {
log(`AI指令错误updateRow 的 data 参数必须是对象,实际收到: ${typeof data} (${data})`, 'error');
return { state, changes: [] };
}
const table = state[tableIndex];
if (rowIndex >= table.rows.length) {
@@ -156,13 +169,21 @@ function parseValue(val) {
try {
return JSON.parse(val);
} catch (e) {
let fixedKeys = val.replace(/([{,]\s*)(\d+)(\s*:)/g, '$1"$2"$3');
try {
let fixedVal = val.replace(/([{,]\s*)(\d+)(\s*:)/g, '$1"$2"$3');
fixedVal = fixedVal.replace(/'/g, '"');
return JSON.parse(fixedVal);
return JSON.parse(fixedKeys);
} catch (e2) {
return val;
let fixedQuotes = fixedKeys.replace(/'/g, '"');
try {
return JSON.parse(fixedQuotes);
} catch (e3) {
let fixedAllKeys = val.replace(/([{,]\s*)([a-zA-Z0-9_]+)(\s*:)/g, '$1"$2"$3');
try {
return JSON.parse(fixedAllKeys);
} catch (e4) {
return val;
}
}
}
}
}

View File

@@ -1,7 +1,7 @@
{
"name": "Amily2号聊天优化助手",
"display_name": "Amily2号助手",
"version": "1.7.6",
"version": "1.7.7",
"author": "Wx-2025",
"description": "一个拥有独立UI的智能引擎正文优化、自动总结、记忆表格、rag向量、隐藏楼层、剧情推进等多功能整合。",
"minSillyTavernVersion": "1.10.0",
@@ -47,5 +47,6 @@