henk/main.go

59 lines
1.5 KiB
Go
Raw Normal View History

2025-02-21 10:53:24 +01:00
package main
import (
"fmt"
2025-02-28 13:04:00 +01:00
"os"
2025-02-21 15:22:17 +01:00
2025-02-28 14:08:48 +01:00
"go-mod.ewintr.nl/henk/llm"
2025-02-28 13:07:29 +01:00
"go-mod.ewintr.nl/henk/parse"
2025-02-25 09:22:10 +01:00
)
2025-02-21 15:22:17 +01:00
func main() {
2025-02-25 09:22:10 +01:00
filePath := "." // Replace with your Go file path
2025-02-21 15:22:17 +01:00
2025-02-28 13:07:29 +01:00
project, err := parse.NewProject(filePath)
2025-02-21 15:22:17 +01:00
if err != nil {
fmt.Println(err)
2025-02-28 13:04:00 +01:00
os.Exit(1)
2025-02-21 15:22:17 +01:00
}
2025-02-28 13:04:00 +01:00
fmt.Printf("%s\n", project.Tree())
2025-02-25 09:22:10 +01:00
2025-02-28 14:08:48 +01:00
f, err := parse.NewFile("./llm/memory.go")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
ollamaClient := llm.NewOllama("http://192.168.1.12:11434", "nomic-embed-text:latest", "qwen2.5-coder:32b-instruct-q8_0")
short, long, err := parse.Describe(f, ollamaClient)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("short: %s\n\nlong: %s\n", short, long)
2025-02-25 09:22:10 +01:00
// err := structure.ProcessGoFile(filePath)
// if err != nil {
// fmt.Println(err)
// }
2025-02-21 15:22:17 +01:00
}
// startDir := "."
// err := filepath.Walk(startDir, walkFunc)
// if err != nil {
// log.Fatalf("Error walking the path: %v\n", err)
// }
// response, err := ollamaClient.Complete("You are a nice person.", "Say Hi!")
// if err != nil {
// fmt.Println("Error:", err)
// return
// }
// fmt.Println(response)
// prompt := fmt.Sprintf("The following is a file with Go source code. Split the code up into logical snippets. Snippets are either a function, a type, a constant or a variable. List the identifier and the line range for each snippet. Respond in JSON. \n\n Here comes the source code:\n\n```\n%s\n```", sourceDoc)
// response, err := ollamaClient.CompleteWithSnippets(systemMessage, prompt)
// if err != nil {
// fmt.Println("Error:", err)
// return
// }
// fmt.Printf("%+v\n", response)