Upload 3 files
Browse files- tsconfig.json +20 -0
- types.ts +31 -0
- vite.config.ts +15 -0
tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"target": "ES2020",
|
| 4 |
+
"useDefineForClassFields": true,
|
| 5 |
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
| 6 |
+
"module": "ESNext",
|
| 7 |
+
"skipLibCheck": true,
|
| 8 |
+
"moduleResolution": "bundler",
|
| 9 |
+
"allowImportingTsExtensions": true,
|
| 10 |
+
"resolveJsonModule": true,
|
| 11 |
+
"isolatedModules": true,
|
| 12 |
+
"noEmit": true,
|
| 13 |
+
"jsx": "react-jsx",
|
| 14 |
+
"strict": true,
|
| 15 |
+
"noUnusedLocals": false,
|
| 16 |
+
"noUnusedParameters": false,
|
| 17 |
+
"noFallthroughCasesInSwitch": true
|
| 18 |
+
},
|
| 19 |
+
"include": ["**/*.ts", "**/*.tsx"]
|
| 20 |
+
}
|
types.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
export type RepoType = 'model' | 'dataset' | 'space';
|
| 2 |
+
|
| 3 |
+
export interface HFConfig {
|
| 4 |
+
token: string;
|
| 5 |
+
repo: string;
|
| 6 |
+
repoType: RepoType;
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
export enum UploadStatus {
|
| 10 |
+
IDLE = 'IDLE',
|
| 11 |
+
UPLOADING = 'UPLOADING',
|
| 12 |
+
SUCCESS = 'SUCCESS',
|
| 13 |
+
ERROR = 'ERROR',
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
export interface FileItem {
|
| 17 |
+
id: string;
|
| 18 |
+
file: File;
|
| 19 |
+
status: UploadStatus;
|
| 20 |
+
path: string; // Destination path in repo
|
| 21 |
+
error?: string;
|
| 22 |
+
url?: string; // URL to the file after upload
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
export interface RemoteFile {
|
| 26 |
+
path: string;
|
| 27 |
+
size: number;
|
| 28 |
+
url: string;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
export type UploadCallback = (id: string, status: UploadStatus, error?: string, url?: string) => void;
|
vite.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { defineConfig } from 'vite';
|
| 2 |
+
import react from '@vitejs/plugin-react';
|
| 3 |
+
|
| 4 |
+
export default defineConfig({
|
| 5 |
+
plugins: [react()],
|
| 6 |
+
server: {
|
| 7 |
+
proxy: {
|
| 8 |
+
'/api': {
|
| 9 |
+
target: 'http://localhost:3001',
|
| 10 |
+
changeOrigin: true,
|
| 11 |
+
secure: false,
|
| 12 |
+
},
|
| 13 |
+
},
|
| 14 |
+
},
|
| 15 |
+
});
|