MCPcopy
hub / github.com/mudler/LocalAI / BroadcastModelsChanged

Method BroadcastModelsChanged

core/services/galleryop/service.go:215–220  ·  view source on GitHub ↗

BroadcastModelsChanged notifies peer replicas that a model config was created, edited, or removed out-of-band of the gallery install/delete channel (e.g. the admin /models/edit, /models/import and models/toggle-state endpoints, which write the YAML and reload only the local in-memory loader). Peers

(element, op string)

Source from the content-addressed store, hash-verified

213// disk) or "delete" for a removal (the element must be pruned from memory,
214// which a reload-from-path cannot do because the loader is additive).
215func (g *GalleryService) BroadcastModelsChanged(element, op string) {
216 g.publishCacheInvalidate(messaging.SubjectCacheInvalidateModels, messaging.CacheInvalidateEvent{
217 Element: element,
218 Op: op,
219 })
220}
221
222// mergeStatus is the broadcast-side merge: it updates the in-memory map from
223// a peer's GalleryProgressEvent without re-publishing to NATS or re-writing

Callers 5

EditModelEndpointFunction · 0.80
PatchConfigEndpointFunction · 0.80
ToggleStateModelEndpointFunction · 0.80
ImportModelEndpointFunction · 0.80

Calls 1

Tested by

no test coverage detected