Skip to content

fix: start and stop ollama #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"os"
"os/exec"
"path/filepath"

"github.com/tlehman/git-llama/ollm"
Expand All @@ -15,7 +14,7 @@ import (
const BUFSIZE = 1024

const ERR_NOT_SINGLE_PROMPT = 1
const ERR_OLLAMA_NOT_INSTALLED = 2
const ERR_OLLAMA_NOT_RUNNING = 2
const ERR_VECTORDB_OPEN_FAIL = 3
const ERR_GIT_ERROR = 4

Expand Down Expand Up @@ -65,27 +64,7 @@ func ensureDbIsGitExcluded() {
}
}

/*
- start ollama
- check git/vec delta
-- update vec db if changed
- semantic search
- stop ollama
*/

func startOllama() {
ollamaPath := Which("ollama")
fmt.Printf("which ollama = %s\n", ollamaPath)
cmd := exec.Command(ollamaPath, "serve", "&")
err := cmd.Run()
if err != nil {
fmt.Printf("ollama not installed: %s\n", err)
os.Exit(ERR_OLLAMA_NOT_INSTALLED)
}
}

func main() {
startOllama()
// open or create the vector database
vectordb, err := vdb.Open(dbfilename(), ollm.LLM_MODEL_NAME)
if err != nil {
Expand Down Expand Up @@ -114,5 +93,4 @@ func main() {
fmt.Printf("failed inserting embedding vector: %s\n", err)
}
fmt.Println(response)
// TODO stop ollama
}