Collapse filter rules and add code block filter
This commit is contained in:
@@ -76,6 +76,7 @@
|
|||||||
const DEFAULT_FILTER_RULES = [
|
const DEFAULT_FILTER_RULES = [
|
||||||
{ start: '<think>', end: '</think>' },
|
{ start: '<think>', end: '</think>' },
|
||||||
{ start: '<thinking>', end: '</thinking>' },
|
{ start: '<thinking>', end: '</thinking>' },
|
||||||
|
{ start: '```', end: '```' },
|
||||||
];
|
];
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
@@ -209,8 +210,11 @@
|
|||||||
list.querySelectorAll('.btn-del-rule').forEach(btn => {
|
list.querySelectorAll('.btn-del-rule').forEach(btn => {
|
||||||
btn.onclick = () => {
|
btn.onclick = () => {
|
||||||
btn.closest('.filter-rule-item')?.remove();
|
btn.closest('.filter-rule-item')?.remove();
|
||||||
|
updateFilterRulesCount();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateFilterRulesCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
function collectFilterRules() {
|
function collectFilterRules() {
|
||||||
@@ -244,8 +248,19 @@
|
|||||||
</div>
|
</div>
|
||||||
<button class="btn-del-rule">✕</button>
|
<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);
|
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
|
// Auto summary sub-options toggle
|
||||||
const triggerEnabled = $('trigger-enabled');
|
const triggerEnabled = $('trigger-enabled');
|
||||||
const autoSummaryOptions = $('auto-summary-options');
|
const autoSummaryOptions = $('auto-summary-options');
|
||||||
|
|||||||
@@ -384,9 +384,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 文本过滤规则 -->
|
<!-- 文本过滤规则 -->
|
||||||
<div class="filter-rules-section">
|
<div class="settings-collapse" id="filter-rules-collapse">
|
||||||
|
<div class="settings-collapse-header" id="filter-rules-toggle">
|
||||||
|
<span>文本过滤规则 · <strong id="filter-rules-count">0</strong> 条</span>
|
||||||
|
<svg class="collapse-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||||
|
stroke-width="2">
|
||||||
|
<polyline points="6 9 12 15 18 9"></polyline>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div class="settings-collapse-content hidden" id="filter-rules-content">
|
||||||
|
<div class="filter-rules-section" style="margin-top:0">
|
||||||
<div class="filter-rules-header">
|
<div class="filter-rules-header">
|
||||||
<label>文本过滤规则</label>
|
<p class="settings-hint" style="margin:0">过滤干扰内容(如思考标签)</p>
|
||||||
<button class="btn btn-sm btn-add" id="btn-add-filter-rule">
|
<button class="btn btn-sm btn-add" id="btn-add-filter-rule">
|
||||||
<svg viewBox="0 0 24 24" width="14" height="14" fill="none"
|
<svg viewBox="0 0 24 24" width="14" height="14" fill="none"
|
||||||
stroke="currentColor" stroke-width="2">
|
stroke="currentColor" stroke-width="2">
|
||||||
@@ -396,9 +405,10 @@
|
|||||||
添加
|
添加
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="settings-hint">过滤干扰内容(如思考标签)</p>
|
|
||||||
<div id="filter-rules-list" class="filter-rules-list"></div>
|
<div id="filter-rules-list" class="filter-rules-list"></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- ═══════════════════════════════════════════════════════════ -->
|
<!-- ═══════════════════════════════════════════════════════════ -->
|
||||||
<!-- 记忆锚点(L0 文本层)-->
|
<!-- 记忆锚点(L0 文本层)-->
|
||||||
|
|||||||
Reference in New Issue
Block a user