iyaja / llama-fs

A self-organizing file system with llama 3
MIT License
4.49k stars 259 forks source link

buildTree handleBranch #42

Open YorkyPoo opened 2 weeks ago

YorkyPoo commented 2 weeks ago

I have not been able to get the llama-fs running yet. With the help of GPT, I was able to get down to only two error messages:

Call Stack  buildTree   renderer.dev.js:49482:11  handleBatch   renderer.dev.js:49532:26

GPT is telling me to do these two more things but I'm not sure where they will go or if it will fix it.

async function handleBatch() { try { const response = await fetch("http://127.0.0.1:8000/batch", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ base_path: "C:\Users\slyre\Downloads\", src_path: "src_folder", dst_path: "dst_folder" }) });

    if (!response.ok) {
        const errorText = await response.text();
        console.error('Error:', errorText);
        throw new Error(`Failed to fetch: ${response.statusText}`);
    }

    const data = await response.json();
    console.log('Response Data:', data);

    if (!Array.isArray(data.paths)) {
        throw new Error('Expected an array for paths');
    }

    buildTree(data.paths); // Ensure data.paths is an array
} catch (error) {
    console.error('Error in handleBatch:', error);
}

}


function buildTree(paths) { if (!Array.isArray(paths)) { console.error('Expected an array for paths, but got:', paths); return; }

paths.forEach(path => {
    console.log('Path:', path);
    // Your tree-building logic here
});

}