aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-searxng.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/module-searxng.js')
-rw-r--r--modules/core/module-searxng.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/core/module-searxng.js b/modules/core/module-searxng.js
index 24db0f5..2feb982 100644
--- a/modules/core/module-searxng.js
+++ b/modules/core/module-searxng.js
@@ -38,13 +38,18 @@ class SearXNGModule {
const categoryLabel = category === 'images' ? '🖼️' : (category === 'videos' ? '🎬' : '🔍');
this.terminal.print(`${categoryLabel} Searching ${category}: ${query}`, 'info');
+ if (summarize) this.terminal.print('⏳ AI overview will be generated (1-3s)...', 'info');
let params = 'q=' + encodeURIComponent(query) + '&categories=' + category;
if (summarize) params += '&summarize=true';
if (fetchContent) params += '&fetch_content=true';
try {
- const resp = await fetch('/api/search?' + params);
+ // 30s client-side timeout (matches module-fetcher)
+ const controller = new AbortController();
+ const timer = setTimeout(() => controller.abort(), 30000);
+ const resp = await fetch('/api/search?' + params, { signal: controller.signal });
+ clearTimeout(timer);
if (!resp.ok) {
const err = await resp.json().catch(() => ({}));
this.terminal.print('Search failed: ' + (err.error || 'HTTP ' + resp.status), 'error');
@@ -100,7 +105,11 @@ class SearXNGModule {
}
});
} catch (e) {
- this.terminal.print('Search failed: ' + e.message, 'error');
+ if (e.name === 'AbortError') {
+ this.terminal.print('⏱ Search timed out (30s). Try removing --summarize or --fetch flags.', 'error');
+ } else {
+ this.terminal.print('Search failed: ' + e.message, 'error');
+ }
}
}
}