mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-15 19:29:16 +02:00
Auto-réglage GPU : détection, num_ctx optimal et bouton Réglage auto
Backend : - agent_config : num_ctx dans la config, envoyé à Ollama (0 = défaut modèle) - ollama_client : méthode ps() (placement GPU/CPU via /api/ps) - autotune : placement() lit size vs size_vram pour savoir si le modèle est sur GPU - routes/config : POST /api/config/auto (détecte GPU + modèle, calcule et applique num_ctx/max_tokens, renvoie la détection et le placement) Frontend : - client/store : autoTune(), état tuning + résultat - SettingsView : bouton ⚡ Réglage auto, bannière de détection (GPU/VRAM, contexte, placement GPU/CPU), slider Contexte (num_ctx) Config : - GPU_VRAM_MB / GPU_NAME pour déclarer la VRAM si Ollama est distant Tests : recommandation (8B sur 12 Go -> ctx 32768), route /auto + persistance, transmission num_ctx aux options Ollama, placement via /api/ps. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SVay7z3y7q2gEe54ByAE6N
This commit is contained in:
10 files changed
+231
-5
No files matched your search
@@ -61,10 +61,39 @@ export interface AgentConfig {
|
||||
top_p: number;
|
||||
top_k: number;
|
||||
max_tokens: number;
|
||||
num_ctx: number;
|
||||
tools: Record<string, boolean>;
|
||||
confirm_shell: boolean;
|
||||
}
|
||||
|
||||
export interface AutoTuneResult {
|
||||
detection: {
|
||||
gpu: { available: boolean; name: string; vram_total_mb: number; source: string };
|
||||
model_profile: {
|
||||
context_length: number | null;
|
||||
parameter_size: string | null;
|
||||
quantization: string | null;
|
||||
size_mb: number | null;
|
||||
};
|
||||
recommended: { num_ctx: number; max_tokens: number };
|
||||
rationale: string;
|
||||
};
|
||||
placement: { loaded: boolean; where?: string; gpu_percent?: number };
|
||||
config: AgentConfig;
|
||||
}
|
||||
|
||||
export async function autoTune(
|
||||
model: string,
|
||||
apply = true
|
||||
): Promise<AutoTuneResult> {
|
||||
const res = await fetch("/api/config/auto", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ model, apply }),
|
||||
});
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function runShell(
|
||||
command: string
|
||||
): Promise<{ command: string; exit_code: number; output: string }> {
|
||||
|
||||
Reference in new issue
Block a user