mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-14 05:03:43 +08:00
chore: temp commit
This commit is contained in:
@@ -1,7 +1,16 @@
|
||||
import { getHeaders } from "../api";
|
||||
|
||||
export interface FileInfo {
|
||||
originalFilename: string;
|
||||
fileName: string;
|
||||
filePath: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export class FileApi {
|
||||
async upload(file: any): Promise<any> {
|
||||
async upload(file: any): Promise<FileInfo> {
|
||||
const fileName = file.name;
|
||||
const fileSize = file.size;
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
var headers = getHeaders(true);
|
||||
@@ -16,6 +25,8 @@ export class FileApi {
|
||||
const resJson = await res.json();
|
||||
console.log(resJson);
|
||||
return {
|
||||
originalFilename: fileName,
|
||||
size: fileSize,
|
||||
fileName: resJson.fileName,
|
||||
filePath: resJson.filePath,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user