feat: implement local deep search engine

This commit is contained in:
john
2026-07-23 22:27:07 +08:00
parent 4e36b98c9e
commit be1e4c18c0
12 changed files with 1717 additions and 16 deletions
+22 -3
View File
@@ -42,6 +42,18 @@ const BUILTIN_SERVICES = Object.freeze([
timeoutMs: 8000,
priority: 80,
},
{
id: 'deep-search',
name: 'TKMind Deep Search',
kind: 'orchestrator',
adapter: 'research-http',
capabilities: ['search.web', 'research.plan', 'research.execute'],
endpoint: 'http://127.0.0.1:20100',
healthPath: '/health',
enabled: false,
timeoutMs: 120000,
priority: 100,
},
]);
export const MINDSEARCH_DEFAULT_CONFIG = Object.freeze({
@@ -50,7 +62,7 @@ export const MINDSEARCH_DEFAULT_CONFIG = Object.freeze({
providers: { searxng: false, github: false, reader: false },
settings: { searxngEndpoint: '', maxResults: 10, timeoutMs: 8000, readerMaxChars: 12000 },
services: BUILTIN_SERVICES,
routes: { web: 'searxng', news: 'searxng', code: 'github', read: 'reader', research: '' },
routes: { web: 'searxng', news: 'searxng', code: 'github', read: 'reader', research: 'deep-search' },
});
const clone = (value) => JSON.parse(JSON.stringify(value));
@@ -115,7 +127,9 @@ function builtinsFromLegacy(input = {}) {
endpoint: service.adapter === 'searxng'
? String(settings.searxngEndpoint ?? service.endpoint)
: service.endpoint,
timeoutMs: settings.timeoutMs ?? service.timeoutMs,
timeoutMs: service.adapter === 'research-http'
? service.timeoutMs
: (settings.timeoutMs ?? service.timeoutMs),
}, service));
}
@@ -185,7 +199,12 @@ export async function probeMindSearchService(service, { fetchImpl = fetch } = {}
try {
const response = await fetchImpl(url, {
signal: AbortSignal.timeout(normalized.timeoutMs),
headers: { accept: 'application/json,text/plain' },
headers: {
accept: 'application/json,text/plain',
...(normalized.adapter === 'research-http' && process.env.TKMIND_DEEP_SEARCH_SECRET
? { 'x-secret-key': process.env.TKMIND_DEEP_SEARCH_SECRET }
: {}),
},
});
let resultCount = null;
if (normalized.adapter === 'searxng' && response.ok) {