• 陪伴互联网运营小白共同探索成长,与IT爱好者共享探索乐趣
  • 建站只为分享,欢迎在PC端文章面打赏支持
  • 使用Ctrl+D 可收藏本站

批量删除Chat GPT历史会话窗口

好玩有趣 陆子方 2个月前 (05-29) 169次浏览 0个评论 扫描二维码

Chat GPT会话多了,打开会有点慢。因此只能删除,重新训练。为此涉及批量删除工作。

1、打开chatgpt

2、在页面的任何空白区域上点击右键,然后从选项中选择“检查”。在调试窗口中点击控制台菜单console。

3、粘贴以下代码,并按回车执行。过几秒刷新可以看到会话已经全部清空。粘贴代码可以会被禁用,按提示先输入确认字符,就可以粘贴了。

const anchors = document.querySelectorAll(".flex.items-center.gap-2.p-2");
const ids = Array.from(anchors)
  .map((a) => a.href?.split("/").slice(-1)[0])
  .filter((id) => !!id);

const deleteAllConversations = async () => {
  const { accessToken } = await fetch("https://chatgpt.com/api/auth/session", {
    method: "GET",
    credentials: "include",
  }).then(res => res.json());
  const idPromises = ids.map(async (id) => {
    fetch(`https://chatgpt.com/backend-api/conversation/${id}`, {
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${accessToken}`
      },
      body: JSON.stringify({is_visible: false}),
      method: "PATCH",
      credentials: "include",
    });
  });
  Promise.all(idPromises);
};

deleteAllConversations();

 


子方有料原创丨转载请注明原文链接
期待您的评论或捐赠,这是最好的鼓励和支持!
喜欢 (0)
[赞赏使我快乐]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到