janhq / jan

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer. Multiple engine support (llama.cpp, TensorRT-LLM)
https://jan.ai/
GNU Affero General Public License v3.0
23.81k stars 1.39k forks source link

fix: model params settings local api server #4077

Closed urmauur closed 1 week ago

urmauur commented 1 week ago

Describe Your Changes

  1. Slider Component Enhancements:

    • Added twMerge from tailwind-merge to conditionally apply Tailwind CSS classes.
    • Modified the className prop of the SliderPrimitive.Root component to use twMerge for dynamic class names based on whether the slider is disabled.
  2. Slider Styles:

    • Added styles for a disabled state in styles.scss, making the cursor unavailable and reducing opacity when the slider is disabled.
  3. Atom Updates:

    • Added a new atom LocalAPIserverModelParamsAtom in LocalServer.atom.ts.
    • Updated imports and uses of serverEnabledAtom and selectedModelAtom across various components to ensure consistency and access to these atoms.
  4. Left Panel Enhancements:

    • Imported necessary types from @janhq/core for better type safety.
    • Used EngineManager and Model to manage model loading more effectively.
    • Enhanced the logic to handle overridden settings, specifically setting ctx_len to 4096 if it's greater than 2048.
  5. Right Panel Enhancements:

    • Added a new state management function onUpdateParams to update the LocalAPIserverModelParamsAtom.
    • Ensured that the disabled prop is passed down to ModelSetting and EngineSetting components to reflect the server's enabled status.

These changes aim to improve the user interface, enhance type safety, and provide more dynamic control over model settings in a local server environment.

Fixes Issues

Screenshot 2024-11-21 at 22 31 34

Self Checklist

github-actions[bot] commented 1 week ago

Barecheck - Code coverage report

Total: 69.27% Your code coverage diff: 0.01% ▴ ✅ All code changes are covered