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 BAZAAR_CARD_BATCH_SIZE = 24;
export const filterBazaarPackagesByThemeMode = <T extends {modes?: string[]}>(
packages: T[],
bazaarType: TBazaarType,
themeModeValue?: string,
) => {
if (bazaarType !== "themes" || !["0", "1"].includes(themeModeValue || "")) {
return packages;
}
const themeMode = themeModeValue === "0" ? "light" : "dark";
return packages.filter((item) => !item.modes?.length || item.modes.includes(themeMode));
};
export const getNextBazaarCardBatch = <T>(packages: T[], cursor: number, batchSize = BAZAAR_CARD_BATCH_SIZE) => {
const nextCursor = Math.min(cursor + batchSize, packages.length);
return {
packages: packages.slice(cursor, nextCursor),
nextCursor,
complete: nextCursor >= packages.length,
};
};