Download frontend/src/models/document.js from leowuming/rag: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/leowuming/rag/resolve/main/frontend/src/models/document.js
- Command line
-
hf download hf://spaces/leowuming/rag/frontend/src/models/document.js
-
curl -L -o document.js https://huggingface.co/spaces/leowuming/rag/resolve/main/frontend/src/models/document.js
1.03 kB
| import { API_BASE } from "@/utils/constants"; | |
| import { baseHeaders } from "@/utils/request"; | |
| const Document = { | |
| createFolder: async (name) => { | |
| return await fetch(`${API_BASE}/document/create-folder`, { | |
| method: "POST", | |
| headers: baseHeaders(), | |
| body: JSON.stringify({ name }), | |
| }) | |
| .then((res) => res.json()) | |
| .catch((e) => { | |
| console.error(e); | |
| return { success: false, error: e.message }; | |
| }); | |
| }, | |
| moveToFolder: async (files, folderName) => { | |
| const data = { | |
| files: files.map((file) => ({ | |
| from: file.folderName ? `${file.folderName}/${file.name}` : file.name, | |
| to: `${folderName}/${file.name}`, | |
| })), | |
| }; | |
| return await fetch(`${API_BASE}/document/move-files`, { | |
| method: "POST", | |
| headers: baseHeaders(), | |
| body: JSON.stringify(data), | |
| }) | |
| .then((res) => res.json()) | |
| .catch((e) => { | |
| console.error(e); | |
| return { success: false, error: e.message }; | |
| }); | |
| }, | |
| }; | |
| export default Document; | |