Collapse filter rules and add code block filter

This commit is contained in:
2026-02-10 16:04:21 +08:00
parent 3650e0eda8
commit fbf34815bb
2 changed files with 55 additions and 19 deletions

View File

@@ -73,10 +73,11 @@
'陌生': 'trend-stranger', '投缘': 'trend-click', '亲密': 'trend-close', '交融': 'trend-merge'
};
const DEFAULT_FILTER_RULES = [
{ start: '<think>', end: '</think>' },
{ start: '<thinking>', end: '</thinking>' },
];
const DEFAULT_FILTER_RULES = [
{ start: '<think>', end: '</think>' },
{ start: '<thinking>', end: '</thinking>' },
{ start: '```', end: '```' },
];
// ═══════════════════════════════════════════════════════════════════════════
// State
@@ -209,8 +210,11 @@
list.querySelectorAll('.btn-del-rule').forEach(btn => {
btn.onclick = () => {
btn.closest('.filter-rule-item')?.remove();
updateFilterRulesCount();
};
});
updateFilterRulesCount();
}
function collectFilterRules() {
@@ -244,8 +248,19 @@
</div>
<button class="btn-del-rule">✕</button>
`);
div.querySelector('.btn-del-rule').onclick = () => div.remove();
div.querySelector('.btn-del-rule').onclick = () => {
div.remove();
updateFilterRulesCount();
};
list.appendChild(div);
updateFilterRulesCount();
}
function updateFilterRulesCount() {
const el = $('filter-rules-count');
if (!el) return;
const count = $('filter-rules-list')?.querySelectorAll('.filter-rule-item')?.length || 0;
el.textContent = count;
}
@@ -1565,6 +1580,17 @@
};
}
// Filter rules collapsible
const filterRulesToggle = $('filter-rules-toggle');
const filterRulesContent = $('filter-rules-content');
if (filterRulesToggle && filterRulesContent) {
filterRulesToggle.onclick = () => {
const collapse = filterRulesToggle.closest('.settings-collapse');
collapse.classList.toggle('open');
filterRulesContent.classList.toggle('hidden');
};
}
// Auto summary sub-options toggle
const triggerEnabled = $('trigger-enabled');
const autoSummaryOptions = $('auto-summary-options');