mirror of
https://github.com/Wx-2025/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 15:05:51 +00:00
Update batch-filler.js
This commit is contained in:
@@ -116,7 +116,6 @@ async function callTableModel(messages) {
|
|||||||
try {
|
try {
|
||||||
const settings = extension_settings[extensionName];
|
const settings = extension_settings[extensionName];
|
||||||
|
|
||||||
// 检查是否启用了Nccs API
|
|
||||||
if (settings.nccsEnabled) {
|
if (settings.nccsEnabled) {
|
||||||
log('使用 Nccs API 进行表格填充...', 'info');
|
log('使用 Nccs API 进行表格填充...', 'info');
|
||||||
const result = await callNccsAI(messages);
|
const result = await callNccsAI(messages);
|
||||||
@@ -150,21 +149,31 @@ function getRawMessagesForSummary(startFloor, endFloor) {
|
|||||||
const userName = context.name1 || '用户';
|
const userName = context.name1 || '用户';
|
||||||
const characterName = context.name2 || '角色';
|
const characterName = context.name2 || '角色';
|
||||||
|
|
||||||
const useTagExtraction = settings.historiographyTagExtractionEnabled ?? false;
|
let tagsToExtract;
|
||||||
const tagsToExtract = useTagExtraction ? (settings.historiographyTags || '').split(',').map(t => t.trim()).filter(Boolean) : [];
|
let exclusionRules;
|
||||||
const exclusionRules = settings.historiographyExclusionRules || [];
|
|
||||||
|
if (settings.table_independent_rules_enabled) {
|
||||||
|
log('批量填表:使用独立提取规则。', 'info');
|
||||||
|
tagsToExtract = (settings.table_tags_to_extract || '').split(',').map(t => t.trim()).filter(Boolean);
|
||||||
|
exclusionRules = settings.table_exclusion_rules || [];
|
||||||
|
} else {
|
||||||
|
log('批量填表:使用微言录提取规则。', 'info');
|
||||||
|
const useHistoriographyTags = settings.historiographyTagExtractionEnabled ?? false;
|
||||||
|
tagsToExtract = useHistoriographyTags ? (settings.historiographyTags || '').split(',').map(t => t.trim()).filter(Boolean) : [];
|
||||||
|
exclusionRules = settings.historiographyExclusionRules || [];
|
||||||
|
}
|
||||||
|
|
||||||
const messages = historySlice.map((msg, index) => {
|
const messages = historySlice.map((msg, index) => {
|
||||||
let content = msg.mes;
|
let content = msg.mes;
|
||||||
|
|
||||||
if (useTagExtraction && tagsToExtract.length > 0) {
|
if (tagsToExtract.length > 0) {
|
||||||
const blocks = extractBlocksByTags(content, tagsToExtract);
|
const blocks = extractBlocksByTags(content, tagsToExtract);
|
||||||
if (blocks.length > 0) {
|
content = blocks.length > 0 ? blocks.join('\n\n') : '';
|
||||||
content = blocks.join('\n\n');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
content = applyExclusionRules(content, exclusionRules);
|
if (content) {
|
||||||
|
content = applyExclusionRules(content, exclusionRules);
|
||||||
|
}
|
||||||
|
|
||||||
if (!content.trim()) return null;
|
if (!content.trim()) return null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user