Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

557 B
Raw Blame
import {isEncryptedBox} from "../util/pathName";

export const getImageOCRAvailability = (path: string, notebookId: string) => {
    const reference = (path || "").split("#", 1)[0];
    const [pathname, query = ""] = reference.split("?", 2);
    const boxId = new URLSearchParams(query).get("box")?.trim();
    const text = !isEncryptedBox(notebookId) && !isEncryptedBox(boxId);
    const local = text && pathname.startsWith("assets/");
    const ai = local && /\.(png|jpe?g|gif|webp|bmp|tiff?|heic|heif)$/i.test(pathname);
    return {text, local, ai};
};