Skip to content

[Bug]: Historical data is not actually deleted #11478

@0x000-0

Description

@0x000-0

Note

This issue/comment/review was translated by Claude.

Issue Checklist

  • I understand that issues are for feedback and problem solving, not for complaining in the comment section, and will provide as much information as possible to help solve the problem.
  • My issue is not listed in the FAQ.
  • I've looked at pinned issues and searched for existing Open Issues, Closed Issues, and Discussions, no similar issue or discussion was found.
  • I've filled in short, clear headings so that developers can quickly identify a rough idea of what to expect when flipping through the list of issues. And not "a suggestion", "stuck", etc.
  • I've confirmed that I am using the latest version of Cherry Studio.

Platform

Windows

Version

v1.6.7

Bug Description

Deleting chats does not actually delete the data, the data is still in indexedDB, which involves privacy leakage and space occupation.

PDFs and images are all in there, seriously taking up space.

Currently need to manually write scripts to delete PDF messages:

(async function() {
    let dbName = 'CherryStudio';
    let storeName = 'message_blocks';

    let dbRequest = indexedDB.open(dbName);

    dbRequest.onsuccess = (event) => {
        let db = event.target.result;
        let transaction = db.transaction(storeName, 'readwrite'); //注意 readwrite
        let store = transaction.objectStore(storeName);

        let getAllRequest = store.getAll();

        getAllRequest.onsuccess = function(e) {
            let allItems = e.target.result;

            // 包含 "pdf" 的记录
            let toDelete = allItems.filter(item => typeof item.title === 'string' && item.title.toLowerCase().includes("pdf"));
            toDelete.forEach(item => {
                store.delete(item.id); // 根据 id 删除
            });

            transaction.oncomplete = () => {
                console.log("删除完成");
            };

            transaction.onerror = (err) => {
                console.error("删除过程中出错", err);
            };
        };

        getAllRequest.onerror = function(err) {
            console.error("读取失败", err);
        };
    };

    dbRequest.onerror = function(err) {
        console.error("打开数据库失败", err);
    };
})();

Steps To Reproduce

  1. Send message
  2. Delete message
  3. Check indexedDB and find that the message is still there

Expected Behavior

After deletion in the UI, the message records in the local database should also be deleted together.

Relevant Log Output

Additional Context

No response


Original Content

Issue Checklist

  • I understand that issues are for feedback and problem solving, not for complaining in the comment section, and will provide as much information as possible to help solve the problem.
  • My issue is not listed in the FAQ.
  • I've looked at pinned issues and searched for existing Open Issues, Closed Issues, and Discussions, no similar issue or discussion was found.
  • I've filled in short, clear headings so that developers can quickly identify a rough idea of what to expect when flipping through the list of issues. And not "a suggestion", "stuck", etc.
  • I've confirmed that I am using the latest version of Cherry Studio.

Platform

Windows

Version

v1.6.7

Bug Description

删除聊天并没有真正删除数据,数据仍在indexedDB中,涉及隐私泄露和空间占用。

PDF,图片都在里面,严重占用空间。

目前需要自己手动写脚本删除PDF消息:

(async function() {
    let dbName = 'CherryStudio';
    let storeName = 'message_blocks';

    let dbRequest = indexedDB.open(dbName);

    dbRequest.onsuccess = (event) => {
        let db = event.target.result;
        let transaction = db.transaction(storeName, 'readwrite'); // 注意 readwrite
        let store = transaction.objectStore(storeName);

        let getAllRequest = store.getAll();

        getAllRequest.onsuccess = function(e) {
            let allItems = e.target.result;

            // 包含 "pdf" 的记录
            let toDelete = allItems.filter(item => typeof item.title === 'string' && item.title.toLowerCase().includes("pdf"));
            toDelete.forEach(item => {
                store.delete(item.id); // 根据 id 删除
            });

            transaction.oncomplete = () => {
                console.log("删除完成");
            };

            transaction.onerror = (err) => {
                console.error("删除过程中出错", err);
            };
        };

        getAllRequest.onerror = function(err) {
            console.error("读取失败", err);
        };
    };

    dbRequest.onerror = function(err) {
        console.error("打开数据库失败", err);
    };
})();

Steps To Reproduce

  1. 发送消息
  2. 删除消息
  3. 去indexeddb查看,发现message还在

Expected Behavior

UI里删除后,本地数据库的message记录也应该一同删除。

Relevant Log Output

Additional Context

No response

Metadata

Metadata

Assignees

Labels

BUGCategorizes issue or PR as related to a bugDataCategorizes an issue or PR as relevant to SIG Data

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions