mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-15 19:29:16 +02:00
Add per-model GPU and context profiles
This commit is contained in:
1 parent
cdbb5f03fa
commit
e24d397d31
12 files changed
+224
-215
No files matched your search
@@ -62,38 +62,12 @@ export interface AgentConfig {
|
||||
top_k: number;
|
||||
max_tokens: number;
|
||||
num_ctx: number;
|
||||
num_gpu: number;
|
||||
num_batch: 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 }> {
|
||||
@@ -105,18 +79,21 @@ export async function runShell(
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function getConfig(): Promise<{
|
||||
export async function getConfig(model?: string): Promise<{
|
||||
config: AgentConfig;
|
||||
available_tools: string[];
|
||||
}> {
|
||||
const res = await fetch("/api/config");
|
||||
const query = model ? `?model=${encodeURIComponent(model)}` : "";
|
||||
const res = await fetch(`/api/config${query}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function saveConfig(
|
||||
patch: Partial<AgentConfig>
|
||||
patch: Partial<AgentConfig>,
|
||||
model?: string
|
||||
): Promise<AgentConfig> {
|
||||
const res = await fetch("/api/config", {
|
||||
const query = model ? `?model=${encodeURIComponent(model)}` : "";
|
||||
const res = await fetch(`/api/config${query}`, {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(patch),
|
||||
|
||||
Reference in new issue
Block a user