Skip to content
Snippets Groups Projects
Commit 7659fe57 authored by Sivert2101's avatar Sivert2101
Browse files

added back the for loop

parent e89060ac
Branches
No related tags found
No related merge requests found
......@@ -43,6 +43,13 @@ func main() {
// break
//}
for {
if userPrompt == "exit" {
fmt.Println("Exiting the program.")
break
}
var modifiedPrompt = userPrompt + extraction.GoPrompt
fmt.Println("Prompt received. Generating response...")
......@@ -64,21 +71,26 @@ func main() {
// Update the conversation context with the response
conversationContext = updatedContext
//fmt.Println(updatedContext)
generatedCode, _ := extraction.Extract(response) // Handle error with string
generatedCode, err_extract := extraction.Extract(response) // Handle error with string
if err_extract != nil {
fmt.Printf("The LLM gave a improper string in response: %v", response)
userPrompt = "exit"
continue
}
fmt.Println("Ollama's response:", generatedCode)
output, err := compiler.CompileStringToGo(generatedCode)
if err != nil {
fmt.Println("There were an error in the code that was compiled")
userPrompt = output + "\nFollowing are the errors, please fix the code. Write it again, and write only source code along with same test cases with no further explanation. The format should be ```rust <yourcode + testcases> ```"
} else {
fmt.Println("Compiled successfully. Here is the output: %v", output)
//userPrompt = "exit"
fmt.Printf("Compiled successfully. Here is the output: %v", output)
userPrompt = "exit"
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment