~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
/**
* Tests for pages/note-detail.js — startResearchFromNote link-failure notice.
*
* The research run starts via /api/start_research, then linkResearchToNote
* attaches it to the note. linkResearchToNote returns false (and only logs) on
* failure; pre-fix startResearchFromNote discarded that boolean and navigated
* away regardless, so a failed link silently orphaned the note↔research
* association with no user-facing signal. The fix surfaces a non-fatal notice
* (and still navigates, since the run itself is valid).
*
* Driven via the production-inert window.__noteDetailTest hook.
*/
let hook;
beforeAll(async () => {
window.__VITEST_TEST__ = true;
globalThis.safeFetch = vi.fn(() =>
Promise.resolve({ ok: true, json: () => Promise.resolve({ success: true }) })
);
globalThis.getCSRFToken = () => 'csrf';
window.RESEARCH_STATUS = { QUEUED: 'queued' };
await import('@js/pages/note-detail.js');
hook = window.__noteDetailTest;
});
afterAll(() => {
delete window.__VITEST_TEST__;
delete window.RESEARCH_STATUS;
});
beforeEach(() => {
document.body.innerHTML =
'<input id="research-query" value="my query" />' +
'<select id="research-mode"><option value="quick" selected>quick</option></select>';
window.URLValidator = { safeAssign: vi.fn() };
window.ui = { showMessage: vi.fn() };
hook.setNote({ id: 'note-1', title: 'T', content: 'body' });
hook.setResearchModal({ hide: vi.fn() });
});
function fetchImpl({ linkOk }) {
return (url) => {
if (url.includes('/api/start_research')) {
return Promise.resolve({
ok: true,
json: () => Promise.resolve({ status: 'success', research_id: 'r1' }),
});
}
// The note-link POST.
return Promise.resolve({
ok: linkOk,
json: () => Promise.resolve(linkOk ? { success: true } : { error: 'nope' }),
});
};
}
describe('startResearchFromNote — link-failure notice', () => {
it('surfaces a notice (and still navigates) when linking the research fails', async () => {
globalThis.safeFetch = vi.fn(fetchImpl({ linkOk: false }));
await hook.startResearchFromNote();
// The user is told the run could not be linked...
expect(window.ui.showMessage).toHaveBeenCalledTimes(1);
const [msg, level] = window.ui.showMessage.mock.calls[0];
expect(msg.toLowerCase()).toContain('could not be linked');
expect(level).toBe('error');
// ...and navigation to the (valid) research still happens.
expect(window.URLValidator.safeAssign).toHaveBeenCalledWith(
window.location, 'href', '/results/r1'
);
});
it('shows no link-failure notice when linking succeeds', async () => {
globalThis.safeFetch = vi.fn(fetchImpl({ linkOk: true }));
await hook.startResearchFromNote();
expect(window.ui.showMessage).not.toHaveBeenCalled();
expect(window.URLValidator.safeAssign).toHaveBeenCalledWith(
window.location, 'href', '/results/r1'
);
});
});