Skip to content

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

784 B
Raw Blame
import {createAVLocationReplacement} from "./locationValue";

interface IAVCellValueTarget {
    id: string;
    keyID: string;
    blockID: string;
}

export const rebindAVCellValue = (source: IAVCellValue, target: IAVCellValueTarget) => {
    const value = JSON.parse(JSON.stringify(source,
        (key, item) => key === "renderedContent" ? undefined : item)) as IAVCellValue & {
        createdAt?: number;
        updatedAt?: number;
    };
    value.id = target.id;
    value.keyID = target.keyID;
    value.blockID = target.blockID;
    if (value.type === "location") {
        value.location = createAVLocationReplacement(value.location);
    }
    delete value.createdAt;
    delete value.updatedAt;
    return value;
};

export const genAVDragFillValue = rebindAVCellValue;