mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-01 10:34:36 -04:00
feat(failover): add MCP tools to list chains and pin targets
Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
1 parent
ea55e2ffc3
commit
191d2d6301
19 files changed
+536
-20
No files matched your search
@@ -101,6 +101,13 @@ type Application struct {
|
||||
// is set; otherwise initialised in start() after galleryService.
|
||||
localAIAssistant *mcpTools.LocalAIAssistantHolder
|
||||
|
||||
// assistantClient is the concrete inproc client backing localAIAssistant.
|
||||
// start() constructs it before failoverManager exists (see New() in
|
||||
// startup.go), so New() sets assistantClient.Failover once the manager
|
||||
// is built, using this field to reach back into the already-registered
|
||||
// MCP tool set. nil when DisableLocalAIAssistant is set.
|
||||
assistantClient *localaiInproc.Client
|
||||
|
||||
// startupComplete flips to true once New() has finished its whole startup
|
||||
// sequence. It backs the /readyz probe.
|
||||
//
|
||||
@@ -598,6 +605,12 @@ func (a *Application) start() error {
|
||||
assistantClient.RouterEmbedder = a.Embedder
|
||||
assistantClient.RouterEmbedderFingerprint = a.EmbedderFingerprint
|
||||
assistantClient.RouterVectorStore = a.VectorStore
|
||||
// Failover chains: failoverManager does not exist yet at this point
|
||||
// in startup (New() in startup.go builds it after start() returns),
|
||||
// so it can't be wired here like the fields above. New() sets
|
||||
// assistantClient.Failover directly once the manager is built;
|
||||
// stash the client so it can reach back into it.
|
||||
a.assistantClient = assistantClient
|
||||
if err := holder.Initialize(a.applicationConfig.Context, assistantClient, localaitools.Options{}); err != nil {
|
||||
// Why log+continue instead of fail: the assistant is an optional
|
||||
// feature; a failure here must not take down the whole server.
|
||||
|
||||
@@ -262,6 +262,12 @@ func New(opts ...config.AppOption) (*Application, error) {
|
||||
})),
|
||||
failover.WithOnWarmChanged(application.applyFailoverWarmTargets),
|
||||
)
|
||||
// The assistant client was built in start() (above), before this
|
||||
// manager existed; wire it now so list_failover_chains /
|
||||
// pin_failover_target / unpin_failover_target see real chains.
|
||||
if application.assistantClient != nil {
|
||||
application.assistantClient.Failover = application.failoverManager
|
||||
}
|
||||
|
||||
// Subsystem 5: admission control. Limiter is always wired so a
|
||||
// model that gains a limits: block via gallery install or YAML
|
||||
|
||||
Reference in new issue
Block a user