-
Notifications
You must be signed in to change notification settings - Fork 997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
消息清除时网站卡死 #350
Comments
额 好的 |
我一直 试不出来 就奇怪了 我在mac上 |
edge和谷歌浏览器都有这个问题,浏览器全是最新版本。Safari、火狐还没试过 |
操作系统是 window 么? |
Windows 10 专业版22H2 |
看来得搞台win来测试下了 |
得有聊天记录,清除的时候~~~~才会卡住网页 |
都试过 而且是非常多的聊天记录 |
手机端貌似也会卡住 |
@Dooy @heiyyint 我的情况是对话中加载的base64图像太大就会卡死,我调整了src/api/mjsave.ts的两个函数(用chatgpt写的,写的糟糕见笑了),加载图片时也转换成blob对象能够缓解卡的情况: //本地存储获取
export const localGet = async (key: string): Promise<any> => {
const value = await localforage.getItem<any>(key);
if (typeof value === 'string') {
let base64Data;
let mimeType;
let isNested = false;
if (value.startsWith('["data:image/')) {
// 数据以 ["data:image/ 开头,处理嵌套的情况
isNested = true;
base64Data = value.split('["')[1].split('"]')[0].split(',')[1];
mimeType = value.split('["')[1].split('"]')[0].split(',')[0].match(/:(.*?);/)[1];
} else if (value.startsWith('data:image/')) {
// 数据以 data:image/ 开头,处理非嵌套的情况
base64Data = value.split(',')[1];
mimeType = value.split(',')[0].match(/:(.*?);/)[1];
}
if (base64Data && mimeType) {
const byteString = atob(base64Data);
const ab = new ArrayBuffer(byteString.length);
const ia = new Uint8Array(ab);
for (let i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
const blob = new Blob([ab], { type: mimeType });
const blobUrl = URL.createObjectURL(blob);
return isNested ? `["${blobUrl}"]` : blobUrl;
}
}
return value;
} export function url2base64More(url: string, key?: string): Promise<{key: string, blob: Blob}> {
return new Promise<{key: string, blob: Blob}>((resolve, reject) => {
const img = new Image();
img.crossOrigin = "anonymous";
img.onload = () => {
const base64 = img2base64(img);
const mimeType = base64.split(',')[0].match(/:(.*?);/)[1];
const base64Data = base64.split(',')[1];
// 将 Base64 数据转换为 Blob 对象
const byteString = atob(base64Data);
const ab = new ArrayBuffer(byteString.length);
const ia = new Uint8Array(ab);
for (let i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
const blob = new Blob([ab], { type: mimeType });
localSaveAny(base64, key).then(d => resolve({key: d, blob})).catch(e => reject(e));
};
img.onerror = (e) => reject(e);
img.src = url;
});
} |
+1,也是清除消息时卡死,经常发生,windows,最新chrome |
消息不多时,只有七八条,单独删除一条,也会卡住,经常发生,一天可以发生十来次 |
+1 也是清除消息时卡死,基本都会发生,windows,最新chrome |
windows chrome下这个问题出现频繁,+1 |
帮忙测试下 v2.18.2 版本找到卡死的地方了 自己测试了 不会了;请大家帮忙在测下 |
我更新完以后卡的更频繁了,有人遇到一样的情况么? |
额 卡得更频繁? |
我这边的情况是这样,看看其他人的情况怎么样,我现在临时把deleteChatByUuid(uuid: number, index: number)函数改成了调用clearChatByUuid(uuid: number),变相先清空对话历史用着。。。 |
大家可以 再测试看看 |
单独清除也会卡,全部清除也是会卡死,浏览器为谷歌浏览器
The text was updated successfully, but these errors were encountered: