Spaces:
Running
Running
File size: 691 Bytes
e3e0a75 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | // src/agent/projectGenerator.js
import { api } from "../apiClient";
export async function generateProject(file, frontend, backend, database) {
const formData = new FormData();
formData.append("file", file);
formData.append("frontend", frontend);
formData.append("backend", backend);
formData.append("database", database);
const res = await api.post("/chat-stream-doc", formData, {
responseType: "blob", // you’re getting ZIP back
});
// trigger download
const url = window.URL.createObjectURL(new Blob([res.data]));
const a = document.createElement("a");
a.href = url;
a.download = "generated_project.zip";
a.click();
window.URL.revokeObjectURL(url);
}
|