Skip to main content

Using GPT-4 to Build a Search Interface for Saved Conversations

I have been saving my ChatGPT conversations as HTML files and wanted a way to search and browse them. I do not care about front-end work. Never have. But GPT-4 makes it easy enough that I do not have to.

The conversation where GPT-4 built it is here. The resulting interface is here. It is not fancy. (I also forgot to reindex the database before deploying, so search was initially broken. That is about right for a quick hack.)

What I Built

A Flask app with Whoosh for full-text search over a directory of HTML files. The pieces:

  1. Flask app: Basic routes for search and browsing.
  2. Whoosh indexing: Indexes the HTML files, groups them by directory. Handles the search.
  3. Search and browse routes: Search by query, or navigate the file hierarchy directly.
  4. Templates: Jinja2 with Bootstrap. I would not have written this styling myself, but GPT-4 generated it and it looks fine.
  5. Search history: Tracks the last 10 queries and shows popular searches across sessions.

The Process

I told GPT-4 what I wanted, it wrote the code, I ran it, we iterated on bugs and features. The whole thing took a couple of hours. Most of that was me describing what I wanted, not writing code.

This is the kind of task I would have put off indefinitely because the actual work (Flask routing, HTML templates, CSS) is tedious and outside my interests. GPT-4 turned it from “I should do this eventually” into “done.”

I am not going to pretend the result is impressive software. It is a simple search interface for local HTML files. But that is exactly what I needed, and I did not have to write the boring parts myself.

Discussion