mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-31 18:49:22 -04:00
Add the add-on runtime to LocalAI: manifests, the host operation broker, admin gating by account role, the add-on UI bundle builder and the SDK for add-on pages. Move the navigation to Chat, Models, Add-ons and Settings, with pinned add-ons in the sidebar and an Add-ons drawer. Ship the first-party add-ons (voice, face, fine-tuning, quantization) as packages for linux/amd64, linux/arm64 and darwin/arm64. Intel macOS (darwin/amd64) is enabled in the platform files. Squashed from the review branch. The tree is unchanged; the pre-squash history is kept on a local backup branch. Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
48 lines
1.3 KiB
Go
48 lines
1.3 KiB
Go
// SPDX-License-Identifier: MIT
|
|
|
|
// Package packaging builds, checks, merges and publishes first-party add-on
|
|
// OCI packages. It is the code behind scripts/addons/package.sh,
|
|
// scripts/addons/channel.sh and the add-on package workflow, so the rules
|
|
// that workflow relies on are code that a test can run.
|
|
//
|
|
// Every operation fails closed: a missing input is an error, never a default.
|
|
package packaging
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
// stdout receives the key=value result lines of the subcommands.
|
|
var stdout io.Writer = os.Stdout
|
|
|
|
var commands = map[string]func(args []string) error{
|
|
"matrix": cmdMatrix,
|
|
"channel": cmdChannel,
|
|
"build": cmdBuild,
|
|
"verify": cmdVerify,
|
|
"extract": cmdExtract,
|
|
"native-check": cmdNativeCheck,
|
|
"merge": cmdMerge,
|
|
"publish": cmdPublish,
|
|
"promote": cmdPromote,
|
|
"catalog": cmdCatalog,
|
|
"policy": cmdPolicy,
|
|
}
|
|
|
|
// Run executes one subcommand of the addonpkg command line.
|
|
func Run(args []string, out io.Writer) error {
|
|
if len(args) == 0 {
|
|
return fmt.Errorf("usage: addonpkg <subcommand> [flags]")
|
|
}
|
|
cmd, ok := commands[args[0]]
|
|
if !ok {
|
|
return fmt.Errorf("unknown subcommand %q", args[0])
|
|
}
|
|
previous := stdout
|
|
stdout = out
|
|
defer func() { stdout = previous }()
|
|
return cmd(args[1:])
|
|
}
|