feat: configure max notification items

This commit is contained in:
2026-05-07 00:10:35 +08:00
parent ad48715664
commit 6c8fdc861f
6 changed files with 62 additions and 4 deletions
+3 -1
View File
@@ -912,6 +912,7 @@ async function loadNotifyConfig() {
document.getElementById('n-enabled').checked = notifyConfig.enabled !== false;
document.getElementById('n-good-only').checked = notifyConfig.notifyOnlyGood !== false;
document.getElementById('n-min-score').value = notifyConfig.minScore ?? 75;
document.getElementById('n-max-items').value = notifyConfig.maxNotifyItems ?? 10;
renderNotifyChannels();
}
@@ -962,7 +963,7 @@ function renderNotifyChannelsFromDom() {
}
function addNotifyChannel(type) {
if (!notifyConfig) notifyConfig = { enabled: true, notifyOnlyGood: true, minScore: 75, channels: [] };
if (!notifyConfig) notifyConfig = { enabled: true, notifyOnlyGood: true, minScore: 75, maxNotifyItems: 10, channels: [] };
const normalizedType = type === 'hermes-webhook' ? 'hermes-send-message' : type;
const defaults = {
'hermes-send-message': { name: 'Hermes 平台消息', target: 'feishu:oc_3e963a150d98f254d8f38881bcfa1812', url: '' },
@@ -997,6 +998,7 @@ function collectNotifyConfig() {
enabled: document.getElementById('n-enabled').checked,
notifyOnlyGood: document.getElementById('n-good-only').checked,
minScore: Number(document.getElementById('n-min-score').value || 75),
maxNotifyItems: Number(document.getElementById('n-max-items').value || 10),
channels,
};
}
+5
View File
@@ -183,6 +183,11 @@
<label>通知最低分</label>
<input id="n-min-score" type="number" min="0" max="100" value="75">
</div>
<div class="form-group">
<label>单次最多推送商品数</label>
<input id="n-max-items" type="number" min="1" max="50" value="10">
<span class="hint">每次分析完成后最多单独推送多少个候选,避免刷屏。</span>
</div>
</div>
<div class="notify-help">
推荐:Hermes 平台消息会直接调用本机 Hermes send_message,可选择飞书/微信/QQ 等目标;Bark、PushPlus 和自定义 Webhook 仍保留为备用。