reorganise files

This commit is contained in:
lehel 2025-10-07 21:47:59 +02:00
parent e7b9144838
commit f442a07237
No known key found for this signature in database
GPG Key ID: 9C4F9D6111EE5CFA
15 changed files with 19 additions and 19 deletions

View File

@ -43,12 +43,12 @@ COPY --from=builder /build/${BINARY_NAME} ./app
# Copy migrations directory
COPY --from=builder /build/migrations ./migrations
COPY config.yaml .
COPY db.yaml .
COPY ui.html .
COPY ui_dbedit.html .
COPY ui_admin_chats.html .
COPY ui_admin_login.html .
# Create necessary directories
RUN mkdir -p config web_templates
# Copy config and template files
COPY --from=builder /build/config/ ./config/
COPY --from=builder /build/web_templates/ ./web_templates/
EXPOSE 8080
# Run binary directly
ENTRYPOINT ["./app"]

View File

@ -32,7 +32,7 @@ DB_SSLMODE ?= disable
db_env = PGHOST=$(DB_HOST) PGPORT=$(DB_PORT) PGUSER=$(DB_USER) PGPASSWORD=$(DB_PASSWORD) PGDATABASE=$(DB_NAME) PGSSLMODE=$(DB_SSLMODE)
# Run the Go server (assumes Ollama is running) with DB env vars
run: ollama-pull
run:
$(db_env) OPENAI_API_KEY=ollama OPENAI_BASE_URL=http://localhost:11434/api/chat OPENAI_MODEL=qwen3:latest go run .
# Run without pulling model (faster if already present)

View File

@ -67,7 +67,7 @@ func (ctrl *Controller) AdminUI(c *gin.Context) {
// Handler for download db.yaml
func (ctrl *Controller) DownloadDB(c *gin.Context) {
c.File("db.yaml")
c.File("config/db.yaml")
}
// Handler for saving knowledgeModel (snapshot)

4
db.go
View File

@ -45,9 +45,9 @@ func (vdb *VisitDB) init() {
} else {
panic(err)
}
err := vdb.loadYAMLDB("db.yaml")
err := vdb.loadYAMLDB("config/db.yaml")
if err != nil {
logrus.Fatalf("Failed to load db.yaml: %v", err)
logrus.Fatalf("Failed to load config/db.yaml: %v", err)
panic(err)
}
}

18
main.go
View File

@ -27,22 +27,22 @@ func main() {
logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true})
logrus.SetLevel(logrus.InfoLevel)
if err := loadConfig("config.yaml"); err != nil {
logrus.Fatalf("Failed to load config.yaml: %v", err)
if err := loadConfig("config/config.yaml"); err != nil {
logrus.Fatalf("Failed to load config/config.yaml: %v", err)
}
logrus.Infof("Loaded config: %+v", appConfig)
visitDB := NewVisitDB()
if err := loadUITemplate("ui.html"); err != nil {
logrus.Fatalf("Failed to load ui.html: %v", err)
if err := loadUITemplate("web_templates/ui.html"); err != nil {
logrus.Fatalf("Failed to load web_templates/ui.html: %v", err)
}
if err := loadDBEditTemplate("ui_dbedit.html"); err != nil {
logrus.Fatalf("Failed to load ui_dbedit.html: %v", err)
if err := loadDBEditTemplate("web_templates/ui_dbedit.html"); err != nil {
logrus.Fatalf("Failed to load web_templates/ui_dbedit.html: %v", err)
}
if err := loadAdminChatsTemplate("ui_admin_chats.html"); err != nil {
logrus.Fatalf("Failed to load ui_admin_chats.html: %v", err)
if err := loadAdminChatsTemplate("web_templates/ui_admin_chats.html"); err != nil {
logrus.Fatalf("Failed to load web_templates/ui_admin_chats.html: %v", err)
}
uiAdminLoginTmpl := &TemplateWrapper{Tmpl: template.Must(template.ParseFiles("ui_admin_login.html"))}
uiAdminLoginTmpl := &TemplateWrapper{Tmpl: template.Must(template.ParseFiles("web_templates/ui_admin_login.html"))}
// Initialize PostgreSQL repository first
dsn := buildDefaultDSN()