mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-11 17:26:57 +02:00
Marqueur de version + fix bench JSON
- config/main : LOKI_VERSION (git sha), exposé via /api/health et /api/version ; affiché dans la barre du haut. Permet de vérifier que l'image déployée est bien à jour (cause fréquente de 'les nouveautés n'apparaissent pas'). - Dockerfile : ARG/ENV LOKI_VERSION ; workflow : build-arg = github.sha. - bench : corrige un bug de précédence d'opérateur dans l'épreuve JSON (le tuple de retour était malformé quand l'extraction était partielle). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVay7z3y7q2gEe54ByAE6N
This commit is contained in:
6 files changed
+42
-2
No files matched your search
@@ -41,6 +41,8 @@ jobs:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
build-args: |
|
||||
LOKI_VERSION=${{ github.sha }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
|
||||
@@ -29,6 +29,10 @@ COPY --from=frontend /app/frontend/dist ./backend/static
|
||||
|
||||
RUN mkdir -p /workspace /data
|
||||
|
||||
# Marqueur de version (git sha court), injecté par le workflow de build.
|
||||
ARG LOKI_VERSION=dev
|
||||
ENV LOKI_VERSION=${LOKI_VERSION}
|
||||
|
||||
# NB : on tourne en root par défaut pour rester compatible avec les volumes
|
||||
# montés d'Unraid (/mnt/user/appdata/...), souvent détenus par root. Pour
|
||||
# durcir, surcharge l'utilisateur côté compose (ex. user: "99:100").
|
||||
|
||||
@@ -11,6 +11,10 @@ class Settings(BaseSettings):
|
||||
data_dir: str = "/data"
|
||||
port: int = 8080
|
||||
|
||||
# Marqueur de build injecté à la construction de l'image (git sha court).
|
||||
# Permet de vérifier que l'image déployée est bien à jour.
|
||||
loki_version: str = "dev"
|
||||
|
||||
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
|
||||
|
||||
|
||||
|
||||
+7
-1
@@ -75,7 +75,13 @@ app.include_router(benchmark.router)
|
||||
|
||||
@app.get("/api/health")
|
||||
async def health() -> dict:
|
||||
return {"status": "ok", "service": "loki"}
|
||||
return {"status": "ok", "service": "loki", "version": settings.loki_version}
|
||||
|
||||
|
||||
@app.get("/api/version")
|
||||
async def version() -> dict:
|
||||
"""Marqueur de build — pour vérifier que l'image déployée est à jour."""
|
||||
return {"version": settings.loki_version}
|
||||
|
||||
|
||||
# ── Service du frontend compilé (présent uniquement en image Docker) ─────
|
||||
|
||||
@@ -41,6 +41,15 @@ export async function getSystemStats(): Promise<SystemStats> {
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function getVersion(): Promise<string> {
|
||||
try {
|
||||
const res = await fetch("/api/version");
|
||||
return (await res.json()).version ?? "?";
|
||||
} catch {
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
export interface LoadedModel {
|
||||
name: string;
|
||||
on_gpu: boolean;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useStore } from "../store/useStore";
|
||||
import { getVersion } from "../api/client";
|
||||
import { ChevronDown, LokiMark } from "./Icon";
|
||||
import { ModelSelector } from "./ModelSelector";
|
||||
|
||||
@@ -7,13 +9,26 @@ export function TopBar() {
|
||||
const status = useStore((s) => s.status);
|
||||
const stats = useStore((s) => s.systemStats);
|
||||
const connected = status?.connected ?? false;
|
||||
const [version, setVersion] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
getVersion().then(setVersion);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="flex h-[54px] flex-none items-center gap-3.5 border-b-[3px] border-line bg-bar px-4">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<LokiMark />
|
||||
<div className="font-pixel text-[14px] text-white">LOKI</div>
|
||||
<div className="text-[13px] leading-none text-on-dark-2">agent local</div>
|
||||
<div
|
||||
className="text-[13px] leading-none text-on-dark-2"
|
||||
title={version ? `build ${version}` : undefined}
|
||||
>
|
||||
agent local
|
||||
{version && version !== "dev" && (
|
||||
<span className="ml-1.5 text-on-dark-3">· {version.slice(0, 7)}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-6 w-[3px] bg-chrome-3" />
|
||||
|
||||
Reference in new issue
Block a user