From f036324ea33ec52ac479c8f3b5bc0f3da62352b2 Mon Sep 17 00:00:00 2001
From: ammar68 <ammaa@stud.ntnu.no>
Date: Tue, 29 Oct 2024 12:26:34 +0100
Subject: [PATCH] connected modules except database

---
 llama/main_automatic.go | 130 ++++++++++++++++++++--------------------
 1 file changed, 65 insertions(+), 65 deletions(-)

diff --git a/llama/main_automatic.go b/llama/main_automatic.go
index aad0c2c..879be4f 100644
--- a/llama/main_automatic.go
+++ b/llama/main_automatic.go
@@ -1,87 +1,87 @@
-package main
+// package main
 
-import (
-	"fmt"
-	"llama/compiler"
-	displayindicator "llama/display-indicator"
-	"llama/extraction"
-	ollamaimplementation "llama/ollama-implementation"
-	"llama/promptlist"
-)
+// import (
+// 	"fmt"
+// 	"llama/compiler"
+// 	displayindicator "llama/display-indicator"
+// 	"llama/extraction"
+// 	ollamaimplementation "llama/ollama-implementation"
+// 	"llama/promptlist"
+// )
 
-func main() {
-	//reader := bufio.NewReader(os.Stdin)
-	var conversationContext []int // Variable to store conversation context
+// func main() {
+// 	//reader := bufio.NewReader(os.Stdin)
+// 	var conversationContext []int // Variable to store conversation context
 
-	//fmt.Print("Enter your prompt (or type 'exit' to quit): ")
-	//userPrompt, _ := reader.ReadString('\n')
-	//userPrompt = strings.TrimSpace(userPrompt)
+// 	//fmt.Print("Enter your prompt (or type 'exit' to quit): ")
+// 	//userPrompt, _ := reader.ReadString('\n')
+// 	//userPrompt = strings.TrimSpace(userPrompt)
 
-	promptList := promptlist.PromptList()
-	fmt.Println(promptList)
+// 	promptList := promptlist.PromptList()
+// 	fmt.Println(promptList)
 
-	var userPrompt = ""
-	for i := range promptList {
-		fmt.Println(promptList[i])
-		userPrompt = promptList[i]
+// 	var userPrompt = ""
+// 	for i := range promptList {
+// 		fmt.Println(promptList[i])
+// 		userPrompt = promptList[i]
 
-		//if userPrompt == "exit" {
-		//	fmt.Println("Exiting the program.")
-		//	break
-		//}
+// 		//if userPrompt == "exit" {
+// 		//	fmt.Println("Exiting the program.")
+// 		//	break
+// 		//}
 
-		for {
+// 		for {
 
-			if userPrompt == "exit" {
-				fmt.Println("Exiting the program.")
-				break
-			}
+// 			if userPrompt == "exit" {
+// 				fmt.Println("Exiting the program.")
+// 				break
+// 			}
 
-			var modifiedPrompt = userPrompt + extraction.GoPrompt
+// 			var modifiedPrompt = userPrompt + extraction.GoPrompt
 
-			fmt.Println("Prompt received. Generating response...")
+// 			fmt.Println("Prompt received. Generating response...")
 
-			// Start a go routine to display a waiting indicator while the response is being generated
-			done := make(chan bool)
-			go displayindicator.DisplayLoadingIndicator(done)
+// 			// Start a go routine to display a waiting indicator while the response is being generated
+// 			done := make(chan bool)
+// 			go displayindicator.DisplayLoadingIndicator(done)
 
-			// Generate response using Ollama API, passing the context
-			response, updatedContext, err := ollamaimplementation.GetOllamaResponse(modifiedPrompt, conversationContext)
+// 			// Generate response using Ollama API, passing the context
+// 			response, updatedContext, err := ollamaimplementation.GetOllamaResponse(modifiedPrompt, conversationContext)
 
-			// Signal the waiting indicator to stop
-			done <- true
+// 			// Signal the waiting indicator to stop
+// 			done <- true
 
-			if err != nil {
-				fmt.Println("Error generating response:", err)
-				continue
-			}
+// 			if err != nil {
+// 				fmt.Println("Error generating response:", err)
+// 				continue
+// 			}
 
-			// Update the conversation context with the response
-			conversationContext = updatedContext
+// 			// Update the conversation context with the response
+// 			conversationContext = updatedContext
 
-			generatedCode, err_extract := 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
-			}
+// 			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)
+// 			fmt.Println("Ollama's response:", generatedCode)
 
-			output, err := compiler.CompileStringToGo(generatedCode)
+// 			output, err := compiler.CompileStringToGo(generatedCode)
 
-			if err != nil {
-				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.Printf("Compiled successfully. Here is the output: %v", output)
-				userPrompt = "exit"
-			}
+// 			if err != nil {
+// 				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.Printf("Compiled successfully. Here is the output: %v", output)
+// 				userPrompt = "exit"
+// 			}
 
-		}
-	}
-}
+// 		}
+// 	}
+// }
 
-func promptList() {
-	panic("unimplemented")
-}
+// func promptList() {
+// 	panic("unimplemented")
+// }
-- 
GitLab