The easy way to do it was, and may still be to turn on the Enable hidden setting to include S3 uploads in the backups setting, make a backup, and then restore on a server that does not have s3 configured (I would do it on a fresh server to avoid breaking the old one if something goes wrong). But it sounds like the production site is broken too, so that likely won’t help at all.
If you’ve mucked up the Uploads table so that it has multiple S3 paths in it, the job is much harder.
Rather than ChatGPT, I’d recommend https://ask.discourse.com/, which at least knows about Discourse, but probably still won’t be much help.
I would look at Uploads.pluck(:url)
and see what’s there.