Saturday, 20 January 2024

New Show Hacker News story: latest news

Show HN: I Built a Hacker News Simulator Powered by GPTs
2 by skeetmtp | 0 comments on Hacker News.
Hello HN! I'm excited to share a project I've been working on: a Hacker News simulator powered by GPT. Why create this, you ask? Well, sometimes "Why not?" is the most compelling reason to dive into a new endeavor! The idea is simple: give the simulator a URL, and it generates a complete Hacker News discussion thread, complete with debates and varied opinions. Although it might seem like just a fun experiment, the journey of building this simulator taught me a lot. Here’s how I did it: 1. Crafting the UI with v0.dev I utilized v0.dev from Vercel to construct a React-based clone of the Hacker News main page. This was my second attempt using v0.dev, and it was far more successful than the first. My approach was: Step 1: I started by taking a screenshot of the Hacker News site and submitting it to v0.dev with the prompt: "The thread page of hacker news site. Topics with some comments." Step 2: Next, I imported the original Hacker News CSS into ChatGPT and asked it to "summarize" to retain the key elements. Step 3: Finally, I iterated on v0 using the CSS suggestions from ChatGPT. The result? A React component that closely mimics the style of Hacker News. You can check out the v0.dev iterations here: https://ift.tt/5ivxcp0 2. Building the App with Me and ChatGPT With the UI ready, it was time to develop the actual Hacker News simulator using Vercel Next.js. As a first-time user of Next.js, ChatGPT was invaluable in guiding me through the process. Step 1: I started by transferring the code generated by v0.dev into ChatGPT, asking it to refactor all hardcoded values to use a JSON data source. Step 2: Then, I replaced the JSON with a function that pulls data from Redis KV. Step 3: Lastly, I added an API to post articles. 3. Crafting the Custom GPT This part was relatively straightforward for me, as I've built various GPT models before. The key was simply providing the API through an OpenAPI specification. Asking GPT to browse given URL and posting through the API a typical HN discussion about it. 4. Navigating the Challenge of Increasing GPT Bot Blockages A big challenge I faced after getting the first version up and running was that more and more websites started blocking GPT bots. When I started a month ago, most URLs worked well for creating simulations, except for those behind paywalls or captchas. But recently, I've noticed that more websites are stopping GPT bots from accessing their content. They're doing this either by recognizing and blocking the GPT bot's user agent or by using rules in their robots.txt files to keep bots out. It also seems like Bing/OpenAI is now following these robots.txt rules more closely, which means there are fewer websites we can access. This change has made it harder to simulate content from a wider range of sites. I'm currently trying to figure out how to deal with these new challenges as more websites react to bots like GPT. 5. The Result And there you have it! Feel free to give it a try and simulate your own Hacker News discussions (GPT Plus subscription needed) Custom GPT: https://ift.tt/Y95BF7A App: https://ift.tt/f9asTG7 Looking forward to your feedback and seeing how the community engages with this just for fun project!

No comments:

Post a Comment