Update batch-filler.js

This commit is contained in:
2025-10-01 23:32:27 +08:00
committed by GitHub
parent 546acae509
commit 25504c7ba6

View File

@@ -116,7 +116,6 @@ async function callTableModel(messages) {
try {
const settings = extension_settings[extensionName];
// 检查是否启用了Nccs API
if (settings.nccsEnabled) {
log('使用 Nccs API 进行表格填充...', 'info');
const result = await callNccsAI(messages);
@@ -150,21 +149,31 @@ function getRawMessagesForSummary(startFloor, endFloor) {
const userName = context.name1 || '用户';
const characterName = context.name2 || '角色';
const useTagExtraction = settings.historiographyTagExtractionEnabled ?? false;
const tagsToExtract = useTagExtraction ? (settings.historiographyTags || '').split(',').map(t => t.trim()).filter(Boolean) : [];
const exclusionRules = settings.historiographyExclusionRules || [];
let tagsToExtract;
let exclusionRules;
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) => {
let content = msg.mes;
if (useTagExtraction && tagsToExtract.length > 0) {
if (tagsToExtract.length > 0) {
const blocks = extractBlocksByTags(content, tagsToExtract);
if (blocks.length > 0) {
content = blocks.join('\n\n');
}
content = blocks.length > 0 ? blocks.join('\n\n') : '';
}
if (content) {
content = applyExclusionRules(content, exclusionRules);
}
if (!content.trim()) return null;