i think I’m going to price up a open ai account, see if i can train gpt chat on the haiku api, what a incredible tool. I’m not very good with most programming languages, but man 2hrs with gpt, like 6 months of classes, simply amazing.
could be invaluable for porting software !! creating gui apps etc
In the #haiku_os_chat on matrix, Gerasim Troeglazov wrote a simple calculator app with GPT. The only thing they added to the generated code was a line to create the BApplication
By the way, which chatroom is the best place for Haiku user, non-dev questions? It’s ok if it’s Telegram, matrix, irc… or should I ask in the dev chat rooms?
#include <Application.h>
#include <Bitmap.h>
#include <File.h>
#include <TranslatorRoster.h>
#include <stdio.h>
int main(int argc, char** argv) {
// Crea un oggetto BApplication per poter utilizzare le API di Haiku
BApplication app("application/x-vnd.Screenshot");
// Prendi lo screenshot dello schermo intero
BRect bounds(BScreen().Frame());
BBitmap bitmap(bounds, B_RGB32, true);
BView* view = new BView(bounds, "Screenshot view", B_FOLLOW_NONE, B_WILL_DRAW);
bitmap.AddChild(view);
view->SetHighColor(0, 0, 0);
view->FillRect(view->Bounds());
view->Sync();
app.Driver()->DrawBitmap(&bitmap, bounds, bounds);
// Salva lo screenshot come file PNG
BFile file("screenshot.png", B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
BTranslatorRoster().Translate(&bitmap, NULL, NULL, &file, B_PNG_FORMAT);
return 0;
}
Some comments:
Potentially it takes portions from GitHub. Allegedly GPT-3 is pre-trained with billion lines of code from existing repositories.
The astonishing thing is that it puts comments in the same language of the request
This is super interesting topic for developing at least simple BeOS-like applets that extend the OS. Something like TuneTracker was at start could be achievable relatively easy and safe - no?
I see it more suitable for creating simple snippets or skeleton classes very quickly to speed things up a bit.
The other interesting use case is for showing online documentation and examples of Haiku API.
I presume ChatGPT has been trained with a subset if not all the content of BeBook and Haiku Book and code from GitHub (like Copilot)
I would not trust it in an automated way. And I do not think it is evolved enough to reply by itself to code review comments on Gerrit.
If someone wants to try to use it to improve documentation, they will have to take responsibility for any issues resulting (that means getting it past code review and applying changes as requested, with or without assistance).
Writing code is not the most important part in an application, doing the proper architecture and design is. And then debugging. And doing debugging and evolutions on code you didn’t write is a bit more difficult than on code you designed yourself.
Is that what we’re going to get? People trying to write applications this way with code they don’t fully understand? I can’t say I have a problem with that, I did it in some way with different tools (writing apps in Delphi when I was 12 years old or so, I had no idea what a variable was, it was quite a mess).
So let’s see where it can be useful and how far it can get before reaching its limitations (or at which point it becomes more annoying and verbose to tell chatGPT what you want than write the code yourself).
In fact, if you point out errors in the generated code to the AI, then the AI starts to take that into account and writes better. For example, now it already creates an instance of the application, generates the correct message handling.