From fa64557e0ea8138d29b37bb7b03ed75bc26b986b Mon Sep 17 00:00:00 2001 From: Sivert2101 <89571140+Sivert2101@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:15:51 +0100 Subject: [PATCH] started making the automatic promptloist modular --- llama/main_automatic.go | 23 +++++++---------------- llama/promptList.txt | 4 ---- llama/promptlist/promptList.txt | 4 ++++ llama/promptlist/promptlist.go | 27 +++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 20 deletions(-) delete mode 100644 llama/promptList.txt create mode 100644 llama/promptlist/promptList.txt create mode 100644 llama/promptlist/promptlist.go diff --git a/llama/main_automatic.go b/llama/main_automatic.go index 906d6ef..aad0c2c 100644 --- a/llama/main_automatic.go +++ b/llama/main_automatic.go @@ -2,13 +2,11 @@ package main import ( "fmt" - "io" "llama/compiler" displayindicator "llama/display-indicator" "llama/extraction" ollamaimplementation "llama/ollama-implementation" - "os" - "strings" + "llama/promptlist" ) func main() { @@ -18,20 +16,9 @@ func main() { //fmt.Print("Enter your prompt (or type 'exit' to quit): ") //userPrompt, _ := reader.ReadString('\n') //userPrompt = strings.TrimSpace(userPrompt) - promptText, err := os.Open("promptList.txt") - if err != nil { - fmt.Println("Error opening file", err) - } - - text, err := io.ReadAll(promptText) - if err != nil { - fmt.Println("Error reading file:", err) - return - } - prompt := string(text) - - promptList := strings.Split(prompt, "\n") + promptList := promptlist.PromptList() + fmt.Println(promptList) var userPrompt = "" for i := range promptList { @@ -94,3 +81,7 @@ func main() { } } } + +func promptList() { + panic("unimplemented") +} diff --git a/llama/promptList.txt b/llama/promptList.txt deleted file mode 100644 index 083807e..0000000 --- a/llama/promptList.txt +++ /dev/null @@ -1,4 +0,0 @@ -write a code that ads 1 and 1 -make a output with numbers from 1 to 10 -make a output with prime numbers from 1 to 20 -make a bubble sort and input to run it from main \ No newline at end of file diff --git a/llama/promptlist/promptList.txt b/llama/promptlist/promptList.txt new file mode 100644 index 0000000..d32542d --- /dev/null +++ b/llama/promptlist/promptList.txt @@ -0,0 +1,4 @@ +write a code that ads 1 and 1, +make a output with numbers from 1 to 10, +make a output with prime numbers from 1 to 20, +make a bubble sort and input to run it from main \ No newline at end of file diff --git a/llama/promptlist/promptlist.go b/llama/promptlist/promptlist.go new file mode 100644 index 0000000..d3ef9b6 --- /dev/null +++ b/llama/promptlist/promptlist.go @@ -0,0 +1,27 @@ +package promptlist + +import ( + "fmt" + "io" + "os" + "strings" +) + +func PromptList() []string { + promptText, err := os.Open("promptlist/promptList.txt") + if err != nil { + fmt.Println("Error opening file", err) + } + + text, err := io.ReadAll(promptText) + if err != nil { + fmt.Println("Error reading file:", err) + return nil + } + + prompt := string(text) + + promptList := strings.Split(prompt, ",") + fmt.Print(promptList) + return promptList +} -- GitLab