wong2 / chatgpt-google-extension

This project is deprecated. Check my new project ChatHub:
https://github.com/chathub-dev/chathub
GNU General Public License v3.0
13.26k stars 1.49k forks source link

Conversation Logs on ChatGPT (Main Site) Not Deleting #301

Closed zsxkib closed 1 year ago

zsxkib commented 1 year ago

Bug: Search creates a new conversation log that isn't automatically deleted

Description

When using the ChatGPT Chrome extension, a new conversation log is created every time a search is performed. However, the extension does not automatically delete these logs, which means that over time there can be many logs created, cluttering up the user's ChatGPT account.

Steps to Reproduce

Install the ChatGPT Chrome extension Perform a search using Google Navigate to the ChatGPT website (https://chat.openai.com/chat) Notice that a new conversation log has been created for the search

Expected Behavior

The extension should not create new conversation logs for searches, or it should automatically delete them after a certain amount of time to avoid cluttering the user's ChatGPT account.

Actual Behavior

The extension creates a new conversation log for each search and does not automatically delete them.

Environment

Operating System: MacOS 13.2.1 Browser: Edge

Additional Information

This issue can cause a buildup of unnecessary conversation logs in the user's ChatGPT account, potentially leading to confusion and decreased usability.

Possible Solution

One possible solution would be to add functionality to the extension that automatically deletes conversation logs created from searches after a certain amount of time, such as 24 hours.

ImSingee commented 1 year ago

I don't know if it's a recent bug or just a bug for ChatGPT Plus. I met this problem only after I upgraded to ChatGPT Plus.

zsxkib commented 1 year ago

Agreed.

I've only ever used this extension with ChatGPT Plus, but your comment probably helps confirm that it's only present with ChatGPT Plus.

ImSingee commented 1 year ago

Before the bug is fixed, you can execute this script in the console to delete the auto-generated conversations (which name is 'New chat')

async function getToken() {
    const session = await (await fetch('https://chat.openai.com/api/auth/session')).json();
    return session.accessToken;
}   

var TOKEN = await getToken();

async function getConversations() {
    return (await (await fetch('https://chat.openai.com/backend-api/conversations?offset=0&limit=100', { headers: {'authorization': `Bearer ${TOKEN}`} })).json()).items;
}

async function deleteConversation(id) {
    const response = await fetch(`https://chat.openai.com/backend-api/conversation/${id}`, { 
        method: 'PATCH', 
        headers: {
            'authorization': `Bearer ${TOKEN}`,
            'content-type': 'application/json',
        },
        body: JSON.stringify({"is_visible": false}),
    })
    return await response.json();
}

conversations = await getConversations();
toClear = conversations.filter(c => c.title === 'New chat')
await Promise.allSettled(toClear.map(c => deleteConversation(c.id)))
zsxkib commented 1 year ago

Niceee work @ImSingee!!! It works great!!