Table of Contents

Class LocalModelRegistry

Namespace
JD.AI.Core.LocalModels
Assembly
JD.AI.Core.dll

Manages the local model registry (JSON manifest) and coordinates model sources.

public sealed class LocalModelRegistry
Inheritance
LocalModelRegistry
Inherited Members

Constructors

LocalModelRegistry(string?, ILogger?)

public LocalModelRegistry(string? modelsDir = null, ILogger? logger = null)

Parameters

modelsDir string
logger ILogger

Properties

Models

public IReadOnlyList<ModelMetadata> Models { get; }

Property Value

IReadOnlyList<ModelMetadata>

ModelsDirectory

public string ModelsDirectory { get; }

Property Value

string

Methods

Add(ModelMetadata)

Add a model metadata record directly.

public void Add(ModelMetadata model)

Parameters

model ModelMetadata

AddFileAsync(string, CancellationToken)

Add a single model file to the registry.

public Task AddFileAsync(string filePath, CancellationToken ct = default)

Parameters

filePath string
ct CancellationToken

Returns

Task

Find(string)

Find a model by ID (exact or substring match).

public ModelMetadata? Find(string query)

Parameters

query string

Returns

ModelMetadata

LoadAsync(CancellationToken)

Load the registry from disk and scan configured directories.

public Task LoadAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

Remove(string, bool)

Remove a model by ID.

public bool Remove(string id, bool deleteFile = false)

Parameters

id string
deleteFile bool

Returns

bool

SaveAsync(CancellationToken)

Persist the registry to disk.

public Task SaveAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task

ScanDirectoryAsync(string?, CancellationToken)

Scan a directory and merge discovered models into the registry.

public Task ScanDirectoryAsync(string? directory = null, CancellationToken ct = default)

Parameters

directory string
ct CancellationToken

Returns

Task