An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
export const GLOBAL_BACKLINK_PAGE_SIZE = 50;
export const GLOBAL_BACKLINK_PAGE_WINDOW = 5;
export const globalBacklinkPageOffset = (index: number) =>
Math.floor(Math.max(0, index) / GLOBAL_BACKLINK_PAGE_SIZE) * GLOBAL_BACKLINK_PAGE_SIZE;
export const globalBacklinkPageWindow = (center: number, total: number) => {
const last = globalBacklinkPageOffset(Math.max(0, total - 1));
const start = Math.max(0, Math.min(center - 2 * GLOBAL_BACKLINK_PAGE_SIZE,
last - (GLOBAL_BACKLINK_PAGE_WINDOW - 1) * GLOBAL_BACKLINK_PAGE_SIZE));
return {start, end: Math.min(total, start + GLOBAL_BACKLINK_PAGE_WINDOW * GLOBAL_BACKLINK_PAGE_SIZE)};
};