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.

1.6 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0

// Own file: per-model-params-hydration.test.ts shares store state across tests.

import assert from "node:assert/strict";
import { register } from "node:module";
import test from "node:test";

import { installLocalStorageFake } from "./helpers/kit.ts";

const { store: localStorageFake } = installLocalStorageFake();
localStorageFake.set("unsloth_chat_settings_imported_to_studio_db", "true");
register("./store-settings-resolver.mjs", import.meta.url);

const { settingsHttp } = await import("./helpers/store-stubs/settings-http.ts");
const { useChatRuntimeStore } = await import(
  "../src/features/chat/stores/chat-runtime-store.ts"
);

const QWEN = "unsloth/Qwen3.5-9B-GGUF";

test("hydration does not replay a maxSeqLength an entry happens to carry", async () => {
  // maxSeqLength belongs to the load config and is never remembered.
  settingsHttp.settings = {
    inferenceParamsByModel: {
      [QWEN]: { temperature: 0.2, maxSeqLength: 131072 },
    },
  };
  useChatRuntimeStore.setState({
    params: {
      ...useChatRuntimeStore.getState().params,
      checkpoint: QWEN,
      maxSeqLength: 4096,
    },
  });

  await useChatRuntimeStore.getState().hydratePersistedSettings();

  const { params } = useChatRuntimeStore.getState();
  assert.equal(
    params.temperature,
    0.2,
    "the remembered temperature should still replay",
  );
  assert.equal(
    params.maxSeqLength,
    4096,
    "the loaded context must survive the hydration replay",
  );
});