refactor: file slice size

This commit is contained in:
Tristan Yang
2023-06-06 08:14:47 +08:00
parent d53167d734
commit 117875ffbf
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -12,8 +12,9 @@ let prices: Price[] = [
}
];
const official_dev = `https://dev.voce.chat`;
// const local_dev = `https://dev.voce.chat`;
const local_dev = `http://localhost:3000`;
const local_dev = `https://dev.voce.chat`;
// const local_dev = `https://vocechat.yangerxiao.com`;
// const local_dev = `http://localhost:3000`;
const dev_origin = process.env.REACT_APP_OFFICIAL_DEMO ? official_dev : local_dev;
// const local_dev = `http://07333.qicp.vip:3030`;
@@ -108,7 +109,7 @@ export const ChatPrefixes = {
};
export const vapidKey = `BOmzyZhw-DcIGYQ77mzQUVqLlcvn0bm_76P_kc7rpwRxzXNbui-JP8iPyEQYfyoxyJeq43Ud4IiIsJSMNHNujn0`;
export const tokenHeader = "X-API-Key";
export const FILE_SLICE_SIZE = 1000 * 200 * 8; //200kb
export const FILE_SLICE_SIZE = 1000 * 1000; //
export const FILE_IMAGE_SIZE = 1000 * 10000 * 8; //10mb
export const KEY_MOBILE_APP_TIP = "MOBILE_APP_TIP";
export const KEY_LOGIN_USER = "VOCECHAT_LOGIN_USER";
+1 -1
View File
@@ -67,7 +67,7 @@ const useUploadFile = (props?: IProps) => {
sliceUploadedCountRef.current = 0;
// setUploadingFile(true);
// 2MB
if (file_size <= 1000 * 1000 * 2) {
if (file_size <= FILE_SLICE_SIZE) {
// 一次性上传文件
uploadResult = await uploadChunk({ file_id, chunk: file, is_last: true });
sliceUploadedCountRef.current = 1;