Skip to content

Commit

Permalink
Merge pull request #3 from kristofer/main
Browse files Browse the repository at this point in the history
Adds `data` directory creation IfNoExist
  • Loading branch information
sedwards2009 authored Jun 13, 2024
2 parents 491a993 + 95b05f4 commit 672b2e5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/frontend/node_modules
/backend/resources
/backend/llm-multitool
/data/
/frontend/dist/
/dist/
3 changes: 3 additions & 0 deletions backend.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
- name: Ollama
address: "http://localhost:11434"
variant: ollama
- name: LocalAI
address: "http://127.0.0.1:5001/v1"
- name: OpenAI
Expand Down
9 changes: 9 additions & 0 deletions backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"net/http"
"os"
"path"
"path/filepath"
"time"
Expand Down Expand Up @@ -37,6 +38,14 @@ var sessionBroadcaster *broadcaster.Broadcaster = nil
var templates *template.TemplateDatabase = nil

func setupStorage(storagePath string) *mem_storage.SimpleStorage {
if _, err := os.Stat(storagePath); os.IsNotExist(err) {
err := os.MkdirAll(storagePath, 0755) // Create data directory
if err != nil {
fmt.Println("Error creating directory:", err)
} else {
fmt.Println("Data directory created.")
}
}
return mem_storage.New(storagePath)
}

Expand Down

0 comments on commit 672b2e5

Please sign in to comment.