Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildTree handleBranch #42

Open
YorkyPoo opened this issue Jun 13, 2024 · 0 comments
Open

buildTree handleBranch #42

YorkyPoo opened this issue Jun 13, 2024 · 0 comments

Comments

@YorkyPoo
Copy link

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
});

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant