Use new new immer and fix unload/status (#116)

This commit is contained in:
ryan-the-crayon
2024-12-02 12:45:59 -05:00
committed by GitHub
parent 6dbce7f3be
commit caee9dbda3
3 changed files with 6 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import {
type SimpleLogger,
type StripNotAvailable,
} from "@lmstudio/lms-common";
import { existsSync, writeFileSync } from "fs";
import { mkdir, readFile, watch } from "fs/promises";
import path from "path";

View File

@ -41,7 +41,9 @@ export const status = command({
content += "\n\n";
const client = await createClient(logger, args);
const loadedModels = await client.llm.listLoaded();
const loadedModels = (
await Promise.all([client.llm.listLoaded(), client.embedding.listLoaded()])
).flat();
const downloadedModels = await client.system.listDownloadedModels();
content += chalk.cyanBright("Loaded Models");
if (loadedModels.length === 0) {

View File

@ -45,7 +45,9 @@ export const unload = command({
).message,
);
}
const models = await client.llm.listLoaded();
const models = (
await Promise.all([client.llm.listLoaded(), client.embedding.listLoaded()])
).flat();
const modelSearchStrings = models.map(({ identifier, path }) => {
// The question mark here is a hack to apply gray color to the path part of the string.
// It cannot be a part of the path, so we can find it by .lastIndexOf.