MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / readModelList

Function readModelList

graph-ui/src/llm/sidecar.ts:253–300  ·  view source on GitHub ↗
(payload: unknown)

Source from the content-addressed store, hash-verified

251 * Eintrag ist eine Liste.
252 */
253export function readModelList(payload: unknown): CacheModel[] {
254 const data = asRecord(payload)['data'];
255 if (!Array.isArray(data)) {
256 return [];
257 }
258 const out: CacheModel[] = [];
259 for (const entry of data) {
260 const record = asRecord(entry);
261 const id = asString(record['id']);
262 if (id.length === 0) {
263 continue;
264 }
265 const status = asRecord(record['status']);
266 const stateWord = asString(status['value']);
267 const meta = asRecord(record['meta']);
268 const model: CacheModel = {
269 id,
270 name: modelDisplayName(id),
271 // Ein Eintrag ohne `status` kommt aus dem Einzel-Modus, wo genau
272 // dieses eine Modell geladen IST. Ein `meta` gibt es nur fuer
273 // geladene Instanzen, also ist es hier das ehrlichere Merkmal.
274 loaded: stateWord.length > 0 ? stateWord === 'loaded' : Object.keys(meta).length > 0,
275 status: stateWord,
276 };
277 const size = asNumber(meta['size']);
278 if (size !== undefined) {
279 model.weightsBytes = size;
280 }
281 const params = asNumber(meta['n_params']);
282 if (params !== undefined) {
283 model.parameters = params;
284 }
285 const trained = asNumber(meta['n_ctx_train']);
286 if (trained !== undefined) {
287 model.trainedContextTokens = trained;
288 }
289 const context = asNumber(meta['n_ctx']);
290 if (context !== undefined) {
291 model.contextTokens = context;
292 }
293 const ftype = asString(meta['ftype']);
294 if (ftype.length > 0) {
295 model.quantization = ftype;
296 }
297 out.push(model);
298 }
299 return out;
300}
301
302/**
303 * Welches Modell die Karte zeigt, wenn der Router mehrere fuehrt.

Callers 2

sidecar.test.tsFile · 0.90
probeSidecarFunction · 0.85

Calls 6

asStringFunction · 0.85
modelDisplayNameFunction · 0.85
keysMethod · 0.80
asRecordFunction · 0.70
asNumberFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected