Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

813 B
Raw Blame
import type { ChatModelRow } from "../types/runtime";

export type QueuedModelCapabilities = Pick<
  ChatModelRow,
  | "isVision"
  | "isGguf"
  | "isMlx"
  | "isAudio"
  | "audioType"
  | "hasAudioInput"
  | "hasVideoInput"
  | "speaks"
>;

export function mergeQueuedModelCapabilities(
  models: ChatModelRow[],
  checkpoint: string,
  capabilities: QueuedModelCapabilities | null,
): ChatModelRow[] {
  if (!capabilities) {
    return models;
  }

  const index = models.findIndex((model) => model.id === checkpoint);
  if (index < 0) {
    return [
      ...models,
      {
        id: checkpoint,
        name: checkpoint,
        isLora: false,
        ...capabilities,
      },
    ];
  }

  return models.map((model, modelIndex) =>
    modelIndex === index ? { ...model, ...capabilities } : model,
  );
}