v0.14.12: SearXNG pageno pagination + max_results HTML mode UI

- SearXNG: pageno分页+URL去重+早退, 准确满足max_results
- SearXNG: HTML模式禁用单次结果数输入框+提示
- menu.ts: 关于对话框版本号同步
- 版本号0.14.12
This commit is contained in:
紫影233
2026-07-10 12:55:51 +08:00
parent e3b44a0357
commit c824562f68
7 changed files with 137 additions and 60 deletions
+17
View File
@@ -66,6 +66,17 @@ export async function loadSearxngConfig(db: ChatDB): Promise<void> {
updateEnabledUI(searxngConfig.enabled);
}
/** 根据返回格式动态启用/禁用「单次结果数」输入框 */
function updateMaxResultsVisibility(): void {
const format = (document.querySelector('#searxngFormat') as HTMLSelectElement).value;
const isHtml = format === 'html';
const input = document.querySelector('#searxngMaxResults') as HTMLInputElement;
const hint = document.querySelector('#searxngMaxResultsHint') as HTMLElement;
input.disabled = isHtml;
input.style.opacity = isHtml ? '0.4' : '';
hint.style.display = isHtml ? '' : 'none';
}
/** 刷新 UI 控件以匹配当前配置 */
function syncFormFromConfig(): void {
(document.querySelector('#searxngUrl') as HTMLInputElement).value = searxngConfig.url;
@@ -82,6 +93,7 @@ function syncFormFromConfig(): void {
const toggle = document.querySelector('#toggleSearxngEnabled') as HTMLInputElement;
toggle.checked = searxngConfig.enabled;
updateEnabledUI(searxngConfig.enabled);
updateMaxResultsVisibility();
}
/** 启用/禁用状态切换 UI */
@@ -130,6 +142,11 @@ export function initSearxngModal(): void {
logInfo('SearXNG', checked ? '已启用' : '已禁用');
});
// ── 返回格式切换 → 动态启用/禁用「单次结果数」 ──
document.querySelector('#searxngFormat')!.addEventListener('change', () => {
updateMaxResultsVisibility();
});
// ── 保存按钮 ──
document.querySelector('#btnSaveSearxng')!.addEventListener('click', async () => {
const url = (document.querySelector('#searxngUrl') as HTMLInputElement).value.trim();
+3 -2
View File
@@ -28,7 +28,7 @@
<div class="header-left">
<img class="logo" src="./assets/icons/llama.png" alt="logo" />
<span class="app-title">Metona Ollama</span>
<span class="app-version">v0.14.11</span>
<span class="app-version">v0.14.12</span>
<button class="icon-btn help-btn" id="btnHelp" title="使用帮助">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="10"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/>
@@ -854,7 +854,8 @@
</div>
<div class="setting-group">
<label class="setting-label">单次结果数</label>
<input class="setting-input" id="searxngMaxResults" type="number" min="0" max="50" step="1" placeholder="0=使用默认值" style="margin-bottom:0;">
<input class="setting-input" id="searxngMaxResults" type="number" min="0" max="100" step="1" placeholder="0=使用默认值(30)" style="margin-bottom:0;">
<p class="text-muted" id="searxngMaxResultsHint" style="font-size:11px;margin-top:4px;display:none;color:var(--text-disabled);">HTML 模式下此选项不生效,返回整页文本</p>
</div>
<div class="setting-group">
<label class="setting-label">返回格式</label>