Greasy Fork is available in English.

Google AI Studio | Clear Chat Button

Automates clicking chat turn options and delete buttons in Gemini.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
piknockyou
今日安裝
2
安裝總數
201
評價
3 0 0
版本
1.8
建立日期
2025-09-03
更新日期
2026-01-01
尺寸
12.1 KB
授權條款
AGPL-3.0
腳本執行於

See screenshot at the bottom

Google AI Studio | Clear Chat Button

Restores the missing clear chat button that Google removed in their August 2025 AI Studio interface revamp.

Why You Need This

Google's August 2025 AI Studio update removed the native clear chat button, making it tedious to clear conversation history:

  • Manual deletion: Must click the options menu (⋯) on each chat turn individually.
  • Multiple steps: Select delete from dropdown, then confirm for every single turn.
  • No bulk action: No way to clear all turns at once.

This script automates the entire process with a single toolbar button click.

Key Features

  • One-Click Clearing: Instantly clear all chat turns in your current prompt session.
  • Native Integration: Adds a refresh icon (🔄) to the toolbar that matches Google's Material Design.
  • SPA-Aware: Automatically re-applies the button when navigating between chats.
  • Error Handling: Robust error handling with console logging for debugging.

How to Use

Action Result
Click refresh button (🔄) Automatically clicks all option menus and delete buttons to clear the entire chat

The button appears in the top toolbar next to the "More options" (⋮) button.

Performance Notes

  • MutationObserver: Watches for toolbar changes to ensure button persists during SPA navigation.
  • Efficient targeting: Uses specific CSS selectors to only click chat turn options and delete buttons.

Installation

  1. Install Violentmonkey (recommended), Tampermonkey, or Greasemonkey.
  2. Install this script.
  3. Visit aistudio.google.com.

Works immediately. The refresh button appears in the toolbar on all prompt pages.

Technical Details

  • Automation: Sequentially clicks ms-chat-turn-options buttons, then clicks delete buttons in the menu.
  • Selectors: Configurable CSS selectors in case Google changes their DOM structure: javascript const CHAT_TURN_OPTIONS_SELECTOR = 'ms-chat-turn-options span[...]'; const DELETE_BUTTON_MENU_SELECTOR = 'div.mat-mdc-menu-content > button:first-of-type';
  • CSP Compliant: Uses DOM manipulation instead of innerHTML to avoid Content Security Policy restrictions.