mirror of
https://github.com/lmstudio-ai/lms.git
synced 2025-07-31 05:53:16 +08:00
Use new new immer and fix unload/status (#116)
This commit is contained in:
@ -5,7 +5,6 @@ import {
|
|||||||
type SimpleLogger,
|
type SimpleLogger,
|
||||||
type StripNotAvailable,
|
type StripNotAvailable,
|
||||||
} from "@lmstudio/lms-common";
|
} from "@lmstudio/lms-common";
|
||||||
|
|
||||||
import { existsSync, writeFileSync } from "fs";
|
import { existsSync, writeFileSync } from "fs";
|
||||||
import { mkdir, readFile, watch } from "fs/promises";
|
import { mkdir, readFile, watch } from "fs/promises";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
@ -41,7 +41,9 @@ export const status = command({
|
|||||||
content += "\n\n";
|
content += "\n\n";
|
||||||
|
|
||||||
const client = await createClient(logger, args);
|
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();
|
const downloadedModels = await client.system.listDownloadedModels();
|
||||||
content += chalk.cyanBright("Loaded Models");
|
content += chalk.cyanBright("Loaded Models");
|
||||||
if (loadedModels.length === 0) {
|
if (loadedModels.length === 0) {
|
||||||
|
@ -45,7 +45,9 @@ export const unload = command({
|
|||||||
).message,
|
).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 }) => {
|
const modelSearchStrings = models.map(({ identifier, path }) => {
|
||||||
// The question mark here is a hack to apply gray color to the path part of the string.
|
// 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.
|
// It cannot be a part of the path, so we can find it by .lastIndexOf.
|
||||||
|
Reference in New Issue
Block a user