1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-08 17:06:42 +00:00

better searching

This commit is contained in:
Laura
2025-08-14 03:53:14 +02:00
parent 8a790df2af
commit c740cd293d
14 changed files with 582 additions and 143 deletions

20
env.go
View File

@@ -2,14 +2,16 @@ package main
import (
"errors"
"fmt"
"os"
"strconv"
"github.com/joho/godotenv"
)
var (
Debug bool
NoOpen bool
MaxIterations int
OpenRouterToken string
)
@@ -17,7 +19,21 @@ func init() {
log.MustPanic(godotenv.Load())
Debug = os.Getenv("DEBUG") == "true"
NoOpen = os.Getenv("NO_OPEN") == "true"
if env := os.Getenv("MAX_ITERATIONS"); env != "" {
iterations, err := strconv.Atoi(env)
if err != nil {
log.Panic(fmt.Errorf("invalid max iterations: %v", err))
}
if iterations < 1 {
log.Panic(errors.New("max iterations has to be 1 or more"))
}
MaxIterations = iterations
} else {
MaxIterations = 3
}
if OpenRouterToken = os.Getenv("OPENROUTER_TOKEN"); OpenRouterToken == "" {
log.Panic(errors.New("missing openrouter token"))