3 ms·
Thanks for the reminder, I've been meaning to try it out. Just to get started, I asked ChatGPT to write an htmx app to show a 10-day weather forecast. It descr
by themodelplumber 3y ago
Thanks for the reminder, I've been meaning to try it out. Just to get started, I asked ChatGPT to write an htmx app to show a 10-day weather forecast.
It described the general steps and seemed to be able to describe how htmx works pretty well, including hx-get and hx-target, etc., but then said "As an AI language model, I am not able to write full applications with code".
I replied "do the same thing in bash" (which I knew would be different in significant ways, but just to check) and it provided the code.
I wonder, is this a function of recency of htmx or something else? Do other htmx developers encounter this? I imagine it's at least a little bit of a pain for these boilerplate cases, if it's consistent vs. access to the same GPT tooling for other languages.
- yawaramin 3y agoYou can write an htmx app in bash: https://www.youtube.com/watch?v=Jzcu4JheCtY https://www.youtube.com/watch?v=Jzcu4JheCtY
- themodelplumber 3y agoSo are you saying that ChatGPT will probably offer to write an htmx app in bash? > I'm sorry, but it's not possible to write a weather forecast app using bash and htmx as htmx is a client-side technology and bash is a command-line shell. htmx is typically used in conjunction with HTML and JavaScript to create dynamic web applications. Cuz that didn't work. It straight up forged ahead and wrote a bash script to show the weather though. I really wonder today if ChatGPT is going to cause a bash renaissance (If you are telling me I can do this myself plz reread posts thx)
- listenallyall 3y agoHTMX is quite easy to code. Your prompt sounds rather generic, I mean, you can just serve 10 days of weather forecasts without any interaction whatsoever. https://www.wunderground.com/forecast/us/ak/north-pole https://www.wunderground.com/forecast/us/ak/north-pole It isn't clear what you were asking ChatGPT to provide, therefore not surprised it didn't come up with the exact answer you expected. I'd suggest learning HTMX by reading the docs, the majority is just a single page.
- themodelplumber 3y agoChatGPT made it very clear it understood exactly what I wanted, short of writing the code. The steps it offered were long, and far from generic. So. Why no code? It offers code for other langs all the time, even unprompted. It was like...if you've ever been mansplained before, when you know how to code something, but are asking a specific question that interests you, related to the process of having a service do that part for you--and someone comes along like, "well, it's easy to code that yourself!" Not sure if you've experienced that before but it's very similar.
- listenallyall 3y agoI don't really use ChatGPT but regardless, it seems strange to evaluate the merits of a JS library based upon ChatGPT's prowess with it. Your time would be far better spent, I think, by reviewing the docs yourself and building a basic site.
- nirav72 3y agoWas it with gpt 3.5 or 4?
- themodelplumber 3y ago3.5. I actually just tried the same prompt in playground > text-davinci-003 and it wrote the front end in htmx without any endpoint code, then when prompted it provided endpoint code. Still looks to be missing something aside from just the api key... <script> htmx.on('load', () => { const apiKey = '<your-api-key>'; }); </script> ...maybe 4 is way better. I thought I had a Plus account but it looks like API only. Edit: Just tried 4 and it is better in the sense that it writes a more complete app for you, but it strangely separates the sections of the front end into discrete textareas w/ code, so if you are new to front end it'll be confusing for sure. "Where do I put all this" "oh actually it all gets run together; specifically these two sections of code are concatenated and placed in the body area of the first code section." It also writes the endpoint code in Python and Flask by default, but with one more prompt it seems to have fixed all that. I really wonder why 3.5, the common public interface, did what it did, when "actually writes code for more languages by default" isn't exactly on the Plus features list.