How to add a search function to your ChatGPT chats
Private and easy
I have quite a few chats in my history now.
Mostly that doesn’t bother me, but sometimes I want to find that image or that code snippet, and… how?
Scrolling down, looking at the names? That is not the efficiency I want when using ChatGPT.
For reasons that escape me, OpenAI have not implemented this. There are a number of Chrome extensions, but I really didn’t have the patience to research each one and see if they are private or not. And frankly, I have ChatGPT at my fingertips, why not ask it for some JavaScript code that I can copy-paste into my console? You don’t get more private than that :) (Important: only do things like this if you actually speak JavaScript!)
So after a bit of inspecting and back and forth, here is the JavaScript snippet:
// Create the search input element
const searchInput = document.createElement('input');
searchInput.setAttribute('type', 'text');
searchInput.setAttribute('placeholder', 'Search chats...');
searchInput.style.margin = '10px';
searchInput.style.padding = '5px';
// Function to filter chat names based on search input
const filterChats = () => {
const searchTerm = searchInput.value.toLowerCase();
const chatItems = document.querySelectorAll('nav li'); // This…