mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-21 14:08:11 +02:00
v0.3.3 : mode application Windows (double-clic → UI + icône de notification + splash, icône sur l'exe), catalogue de modèles servi par ajean.link (/api/catalog + détection RAM), correctif des fenêtres de console qui clignotaient sous Windows, version affichée dans l'UI
This commit is contained in:
1 parent
0c4ff12a00
commit
cd58382d73
23 files changed
+810
-30
No files matched your search
@@ -8,7 +8,9 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
)
|
||||
@@ -20,6 +22,54 @@ func defaultJeanHome() string { return "/etc/jean" }
|
||||
// defaultEditor is used by `jean edit` when $EDITOR is unset.
|
||||
func defaultEditor() string { return "nano" }
|
||||
|
||||
// hideCmd : no-op sur Unix (pas de fenêtre de console à masquer).
|
||||
func hideCmd(cmd *exec.Cmd) *exec.Cmd { return cmd }
|
||||
|
||||
// openBrowser ouvre l'URL dans le navigateur par défaut (macOS: open, Linux:
|
||||
// xdg-open). Best-effort.
|
||||
func openBrowser(url string) error {
|
||||
bin := "xdg-open"
|
||||
if runtime.GOOS == "darwin" {
|
||||
bin = "open"
|
||||
}
|
||||
return exec.Command(bin, url).Start()
|
||||
}
|
||||
|
||||
// totalRAMGB renvoie la RAM physique totale en Go (Linux: /proc/meminfo,
|
||||
// macOS: sysctl hw.memsize).
|
||||
func totalRAMGB() float64 {
|
||||
if runtime.GOOS == "darwin" {
|
||||
out, err := exec.Command("sysctl", "-n", "hw.memsize").Output()
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
if v, err := strconv.ParseFloat(strings.TrimSpace(string(out)), 64); err == nil {
|
||||
return v / (1024 * 1024 * 1024)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
b, err := os.ReadFile("/proc/meminfo")
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
for _, line := range strings.Split(string(b), "\n") {
|
||||
if strings.HasPrefix(line, "MemTotal:") {
|
||||
f := strings.Fields(line)
|
||||
if len(f) >= 2 {
|
||||
if kb, err := strconv.ParseFloat(f[1], 64); err == nil {
|
||||
return kb / (1024 * 1024) // kB → Go
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// launchedByDoubleClick : sur Unix, jean tourne en service/CLI, on ne déclenche
|
||||
// jamais le mode app sur un simple no-arg (éviterait de surprendre un serveur).
|
||||
// L'expérience app double-clic est propre à Windows/macOS (coque native, phase 3).
|
||||
func launchedByDoubleClick() bool { return false }
|
||||
|
||||
// setLibraryPath ensures llama-server can load shared libs bundled next to the
|
||||
// binary by prepending dir to LD_LIBRARY_PATH. It also appends the CUDA runtime
|
||||
// lib directories: a CUDA-enabled build links against libcudart/libcublas, which
|
||||
|
||||
Reference in new issue
Block a user