Tell HN: I asked ChatGPT to build a login form in React and it gave me the code
172 points| jerrygoyal | 3 years ago | reply
I thought Copilot was fairly advanced, but this chatGPT takes it to a whole other level. What are your thoughts?
172 points| jerrygoyal | 3 years ago | reply
I thought Copilot was fairly advanced, but this chatGPT takes it to a whole other level. What are your thoughts?
[+] [-] romanhn|3 years ago|reply
Sure, here is a possible rap song about a guy named Roman writing .NET APIs:
[+] [-] frobolo|3 years ago|reply
[+] [-] dyingkneepad|3 years ago|reply
[+] [-] jw1224|3 years ago|reply
Here's how it went: https://i.imgur.com/PS6oPsq.png
A pretty incredible developer experience, if you ask me!
[+] [-] rstarast|3 years ago|reply
It's lying though when it claims its regexes match the empty parameter cases, right? (The regexes do what's asked, just explanation seems buggy.)
[+] [-] spaceman_2020|3 years ago|reply
[+] [-] cm277|3 years ago|reply
[+] [-] j2kun|3 years ago|reply
[+] [-] unknown|3 years ago|reply
[deleted]
[+] [-] roflyear|3 years ago|reply
[+] [-] satvikpendem|3 years ago|reply
Prompts:
- Write a simple CRDT implementation in Swift
- How can I make a GraphQL server using Rust using the async-graphql and actix-web libraries?
- Write code to create a Dropbox clone in Rust
- How do I make an HTTP request in Javascript?
However, just like with Copilot, it can introduce subtle bugs. For example, in the Dropbox example, notice how it uses synchronous code in an async function. Also, longer prompts will reach the token limit and get cut off.
Interestingly, this must be what Replit is also using for their AI codegen service too (https://replit.com/site/ghostwriter) since I believe they have some connection to OpenAI, as they got early access to OpenAI's service last year with their previous Codex product (https://blog.replit.com/codex).
[+] [-] dcolkitt|3 years ago|reply
[+] [-] slake|3 years ago|reply
[+] [-] ignoramous|3 years ago|reply
Sam Altman <--> Paul Graham <--> Amjad Masad might be it.
[+] [-] patwolf|3 years ago|reply
I did ask it something more basic: "how to use fetch to download and parse a csv", and the code was helpful, although not much different from what I could find with google/stackoverflow. However, this next part was what really impressed me. The results used Papa for parsing, so I then asked it to do it with csv-parse instead, and it worked! That seems like the advantage over something like Copilot--it has contextual history of the question which can be used conversationally to tweak the results.
[+] [-] superfrank|3 years ago|reply
Sounds exactly like some of my co-workers :)
[+] [-] unknown|3 years ago|reply
[deleted]
[+] [-] slake|3 years ago|reply
[+] [-] tmaly|3 years ago|reply
1. those that can specify concise requirements for the AI
2. those that can check correctness of the code the AI generated.
[+] [-] mprovost|3 years ago|reply
[+] [-] triyambakam|3 years ago|reply
[+] [-] riffraff|3 years ago|reply
[0] quasicitation https://www.commitstrip.com/en/2016/08/25/a-very-comprehensi...
[+] [-] WandaVision|3 years ago|reply
[+] [-] nonameiguess|3 years ago|reply
It's annoying blog spam that will hijack your attempt to scroll back with a modal asking you to enter an e-mail and subscribe, but it seems to be roughly the same thing, except the entire article appeared at once and I didn't need to interact with it and wait five minutes for the full answer.
[+] [-] BoiledCabbage|3 years ago|reply
We've come up with a new pedagogical method to teach 4 year olds arithmetic. With two months of study they can easily multiply two 15 digit numbers in their heads.
Well I can multiply those two numbers in a calculator to get the same result, and I don't have to feed or take care of it.
[+] [-] renewiltord|3 years ago|reply
[+] [-] zug_zug|3 years ago|reply
From a practical perspective I do think a lot of programmers are doing copy-paste in their day jobs, which means they should be reusing existing code (I would imagine there are numerous reusable customizable login forms).
---
For example I asked it this:
Can you write a javascript function that takes a callback and returns the value of that callback, but returns a cached value if that function has been called less than 5 seconds ago?
And it produces code that looks right but doesn't work (doesn't handle arguments, failing its own example implementation). However, upon reminding it to support arguments it does work. I guess this is actually potentially useful.
[+] [-] dmd|3 years ago|reply
https://shot.3e.org/ss-20221201_153225.png
[+] [-] tropicalbeach|3 years ago|reply
Not to mention the copyright issues with this. It's just regurgitating what's already on the internet not sure why it's ok for them to copy people's work but if you do it you will get sued.
[+] [-] c0eos|3 years ago|reply
``` One Elf has the important job of loading all of the rucksacks with supplies for the jungle journey. Unfortunately, that Elf didn't quite follow the packing instructions, and so a few items now need to be rearranged.
Each rucksack has two large compartments. All items of a given type are meant to go into exactly one of the two compartments. The Elf that did the packing failed to follow this rule for exactly one item type per rucksack.
The Elves have made a list of all of the items currently in each rucksack (your puzzle input), but they need your help finding the errors. Every item type is identified by a single lowercase or uppercase letter (that is, a and A refer to different types of items).
The list of items for each rucksack is given as characters all on a single line. A given rucksack always has the same number of items in each of its two compartments, so the first half of the characters represent items in the first compartment, while the second half of the characters represent items in the second compartment.
For example, suppose you have the following list of contents from six rucksacks:
vJrwpWtwJgWrhcsFMMfFFhFp jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL PmmdzqPrVvPwwTWBwg wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn ttgJtRGJQctTZtZT CrZsJsPPZsGzwwsLwLmpwMDw
To help prioritize item rearrangement, every item type can be converted to a priority: In the above example, the priority of the item type that appears in both compartments of each rucksack is 16 (p), 38 (L), 42 (P), 22 (v), 20 (t), and 19 (s); the sum of these is 157. ```Adding the question: "Write a solution in JavaScript to find the sum of the priorities of those item types." got me:
``` const input = vJrwpWtwJgWrhcsFMMfFFhFp jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL PmmdzqPrVvPwwTWBwg wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn ttgJtRGJQctTZtZT CrZsJsPPZsGzwwsLwLmpwMDw;
const rucksacks = input.split('\n');
const sumOfPriorities = rucksacks .map(rucksack => { const half = rucksack.length / 2; const firstHalf = rucksack.slice(0, half); const secondHalf = rucksack.slice(half); return [...firstHalf].filter(item => secondHalf.includes(item)); }) .reduce((total, common) => { const priority = common[0].charCodeAt(0) <= 122 ? common[0].charCodeAt(0) - 96 : common[0].charCodeAt(0) - 38; return total + priority; }, 0);
console.log(sumOfPriorities); // 157 ```
Which is almost perfect, even though it's a new puzzle.
[+] [-] ilaksh|3 years ago|reply
For a few of them it made a small error of one line that I had to fix. But also in a few cases I was able to just reply that there was a bug and what it was doing incorrectly and to fix it, and it worked.
It gave me code that was very specific such as using the methods as I named and described them in the request for the class.
[+] [-] quonn|3 years ago|reply
[+] [-] CJefferson|3 years ago|reply
One easy way of catching out is to ask "write X in language Y", where X isn't something most people would write in Y -- it usually got it wrong for me.
[+] [-] beepbooptheory|3 years ago|reply
Ill stick to man pages and blogs for now. I like learning!
[+] [-] chironjit|3 years ago|reply
Been playing with it the whole day - got an idea on how to fix an old bug in an old programme of mine(that is still running).
But, here's the thing, how good it is depends on the available knowledge out there.
I've now tried, js, python, solidity, appscript(not tested the code), Excel and google sheets.
When you're building common js, python, etc stuff, it's really handy to have one screen that basically gives you the answer rather than having to google it, parse through the posts, etc.
However, if you're on the bleeding edge of tech, or looking for more obscure topics, it really starts showing its limitations.
I managed to run into that for example looking for Jupiter notebook commands, optimisations, versioning (giving me python2 results instead of python3 with obsolete/unmaintained packages).
Its limit is basically what has been created and knowledge already available.
Depending on what you're building, would suggest understanding what you're copy pasting and possible vulnerabilities that may arise from the code.
Overall, I'm sold - defo wouldn't mind paying 20 to 40 a month for this. If it's pricier, not so sure.
[+] [-] throwawaygo|3 years ago|reply
[+] [-] batch12|3 years ago|reply
[+] [-] Waterluvian|3 years ago|reply
https://ibb.co/KwGLy9C
[+] [-] anupamchugh|3 years ago|reply
Here's my convo with ChatGPT: https://imgur.com/a/eIjvh8C
If the text and code are just random stuff making no sense then I wonder how different it is from the Copilot results (besides the convincing style of answers).
[+] [-] sethd|3 years ago|reply
[+] [-] kelnos|3 years ago|reply
The big question is: whose code is this? Is it, verbatim, someone else's copyrighted code (assuming a snippet like that is novel enough to be copyrightable)? Or is it derived from someone else's code? And if it's derived, is it a derivative work in the legal sense, or is it no more derivative than if a human had read a tutorial or some documentation and then later written code like it?
[+] [-] thedangler|3 years ago|reply
[+] [-] krageon|3 years ago|reply
[+] [-] unknown|3 years ago|reply
[deleted]
[+] [-] CrackpotGonzo|3 years ago|reply
[+] [-] sasha_fishter|3 years ago|reply
Maybe it can substitute StackOverflow, we will get better and faster code / explanation. But in the next 30-50 years, who knows. I guess it can write a lot of code for us, maybe we will be obsolete in that period of time, but as we know, prediction of the future often times goes really really wrong.
[+] [-] htorsdfd22|3 years ago|reply