Skip to content

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

634 B
Raw Blame
export const hasDataTransferFiles = (types: ArrayLike<string>) => Array.from(types).includes("Files");

export const getLocalDropFiles = (files: FileList | File[], getPath: (file: File) => string) => {
    const localFiles: ILocalFiles[] = [];
    for (let index = 0; index < files.length; index++) {
        const file = files[index];
        const path = getPath(file);
        if (!path) {
            return undefined;
        }
        localFiles.push({
            path,
            size: file.size,
            isDir: file.size === 0 && file.type === "" && !file.name.includes("."),
        });
    }
    return localFiles;
};