From 94425a8c94f241be9b28d4d6cbc8df95447a35fe Mon Sep 17 00:00:00 2001 From: markstad Date: Mon, 13 Jan 2025 17:58:00 +0100 Subject: [PATCH] brainrot har implementerats --- .gitignore | 1 + api/api.go | 6 ++++++ api/api.go.ref | 6 ++++++ command/brainrot/brainrot.go | 42 ++++++++++++++++++++++++++++++++++++ command/command.go | 3 +++ go.mod | 5 +++++ go.sum | 12 +++++++++++ 7 files changed, 75 insertions(+) create mode 100644 .gitignore create mode 100644 api/api.go create mode 100644 api/api.go.ref create mode 100644 command/brainrot/brainrot.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a256c8f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./api/api.go \ No newline at end of file diff --git a/api/api.go b/api/api.go new file mode 100644 index 0000000..ef3f2b8 --- /dev/null +++ b/api/api.go @@ -0,0 +1,6 @@ +package api + +func Api() string { + apiString := "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" + return apiString +} diff --git a/api/api.go.ref b/api/api.go.ref new file mode 100644 index 0000000..b33f5b2 --- /dev/null +++ b/api/api.go.ref @@ -0,0 +1,6 @@ +package api + +func Api() string { + apiString := + return apiString +} diff --git a/command/brainrot/brainrot.go b/command/brainrot/brainrot.go new file mode 100644 index 0000000..f6f13ac --- /dev/null +++ b/command/brainrot/brainrot.go @@ -0,0 +1,42 @@ +package brainrot + +import ( + "bbash/api" + "bbash/environment" + "bbash/input_parser" + "context" + "fmt" + "os" + "path/filepath" + + "github.com/openai/openai-go" + "github.com/openai/openai-go/option" +) + +func Brainrot(in input_parser.Input, env *environment.Env) { + file := filepath.Join(env.Path, in.Args_raw) + bytea_str, err := os.ReadFile(file) + //Skicka string(bytea_str) + if err != nil { + fmt.Print(fmt.Sprintf("L Rizz", err.Error())) + return + } + //Send to chatgpt + + client := openai.NewClient( + option.WithAPIKey(api.Api()), // defaults to os.LookupEnv("OPENAI_API_KEY") + ) + prompt := fmt.Sprintf("Rewrite the text I will provide you to brainrot. Make sure to use some of the words skibidi gyatt rizz only in ohio duke dennis did you pray today livvy dunne rizzing up baby gronk sussy imposter pibby glitch in real life sigma alpha omega male grindset andrew tate goon cave freddy fazbear colleen ballinger smurf cat vs strawberry elephant blud dawg shmlawg ishowspeed a whole bunch of turbulence ambatukam bro really thinks he's carti literally hitting the griddy the ocky way kai cenat fanum tax garten of banban no edging in class not the mosquito again bussing axel in harlem whopper whopper whopper whopper 1 2 buckle my shoe goofy ahh aiden ross sin city monday left me broken quirked up white boy busting it down sexual style goated with the sauce john pork grimace shake kiki do you love me huggy wuggy nathaniel b lightskin stare biggest bird omar the referee amogus uncanny wholesome reddit chungus keanu reeves pizza tower zesty poggers kumalala savesta quandale dingle glizzy rose toy ankha zone thug shaker morbin time dj khaled sisyphus oceangate shadow wizard money gang ayo the pizza here PLUH nair butthole waxing t-pose ugandan knuckles family guy funny moments compilation with subway surfers gameplay at the bottom nickeh30 ratio uwu delulu opium bird cg5 mewing fortnite battle pass all my fellas gta 6 backrooms gigachad based cringe kino redpilled no nut november pokénut november foot fetish F in the chat i love lean looksmaxxing gassy social credit bing chilling xbox live mrbeast kid named finger better caul saul i am a surgeon hit or miss i guess they never miss huh i like ya cut g ice spice gooning fr we go gym kevin james josh hutcherson coffin of andy and leyley metal pipe falling. Rewrite this text: %s", string(bytea_str)) + + chatCompletion, err := client.Chat.Completions.New(context.TODO(), openai.ChatCompletionNewParams{ + Messages: openai.F([]openai.ChatCompletionMessageParamUnion{ + openai.UserMessage(prompt), + }), + Model: openai.F(openai.ChatModelGPT4oMini), + }) + if err != nil { + panic(err.Error()) + } + fmt.Print(chatCompletion.Choices[0].Message.Content) + +} diff --git a/command/command.go b/command/command.go index ef4b76d..639afbf 100644 --- a/command/command.go +++ b/command/command.go @@ -1,6 +1,7 @@ package command import ( + "bbash/command/brainrot" "bbash/command/cat" "bbash/command/cd" "bbash/command/cp" @@ -59,6 +60,8 @@ func Run_command(in input_parser.Input, env *environment.Env) { help.Help(in, env) case "tail": tail.Tail(in, env) + case "brainrot": + brainrot.Brainrot(in, env) default: if !run_by_path(in, env) { fmt.Println(fmt.Sprintf("No such command! (%s)", in.Instruction)) diff --git a/go.mod b/go.mod index 06b5da9..42fe8bd 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,11 @@ module bbash go 1.23.4 require ( + github.com/openai/openai-go v0.1.0-alpha.44 // indirect + github.com/tidwall/gjson v1.18.0 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.1 // indirect + github.com/tidwall/sjson v1.2.5 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/term v0.28.0 // indirect ) diff --git a/go.sum b/go.sum index f05f63b..1258444 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,15 @@ +github.com/openai/openai-go v0.1.0-alpha.44 h1:p0OZp+sGEBcKlCIjEWIO5+R3cZEz34C3iw/MM5gAHoo= +github.com/openai/openai-go v0.1.0-alpha.44/go.mod h1:3SdE6BffOX9HPEQv8IL/fi3LYZ5TUpRYaqGQZbyk11A= +github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= +github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= +github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY= +github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=