mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-29 17:48:59 -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>
36 lines
1.5 KiB
JavaScript
36 lines
1.5 KiB
JavaScript
// The core routes the Face add-on uses, reached with the signed-in user's own
|
|
// session (sdk.core.fetch). Paths and bodies are the ones of faceApi in
|
|
// core/http/react-ui/src/utils/api.js; only the transport changed. register
|
|
// takes { model, name, img, labels }, identify { model, img, ... }.
|
|
import { createIdentityApi } from '../../../internal/identity-ui/src/registry.js'
|
|
|
|
export function createApi(ctx) {
|
|
const { json } = ctx
|
|
const query = (params = {}) => {
|
|
const q = new URLSearchParams()
|
|
for (const [k, v] of Object.entries(params)) if (v !== undefined && v !== null && v !== '') q.set(k, String(v))
|
|
const s = q.toString()
|
|
return s ? `?${s}` : ''
|
|
}
|
|
// /v1/voice/* and /v1/face/*: the shared views read both kinds; the page only
|
|
// uses the face one. A failed call keeps its status (a 404 on forget reads as
|
|
// already gone).
|
|
const identity = createIdentityApi(ctx)
|
|
return {
|
|
identity,
|
|
face: identity.face,
|
|
models: {
|
|
listCapabilities: () => json('/api/models/capabilities'),
|
|
// The gallery list, as modelsApi.list builds it: empty parameters are left out.
|
|
list: (params) => json(`/api/models${query(params)}`),
|
|
// Starts a gallery install (modelsApi.install).
|
|
install: (id) => json(`/api/models/install/${encodeURIComponent(id)}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: '{}' }),
|
|
},
|
|
// The running installs, polled while one is in progress.
|
|
operations: {
|
|
list: () => json('/api/operations'),
|
|
},
|
|
raw: ctx.core,
|
|
}
|
|
}
|