Files
LocalAI/core/schema/animation.go
T
Richard Palethorpe 2facfc0d88 feat: Add kimodo.cpp and 3D animation API/UI (#12095)
* fix(vulkan): preserve host ICD discovery for packaged backends

Add bundled Mesa manifests through VK_ADD_DRIVER_FILES instead of replacing the system driver list. Merge inherited and model-specific additive paths while preserving explicit operator overrides, with regression coverage.

Assisted-by: Codex:gpt-5 golangci-lint

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Richard Palethorpe <io@richiejp.com>

* feat(3d): add Kimodo CPU and Vulkan animation backend

Introduce a distinct animation capability and model-described 3D operations, with a typed /3d/animate API, RPC transport, distributed media staging, permissions, and tracing.

Add a persistent kimodo.cpp adapter, skeleton GLB export, CPU/Vulkan packages, model and backend galleries, importer support, CI builds, and documentation. Adapt Studio inputs to each model and provide real-time skeleton playback, seeking, and history.

Cover backend validation, packaging, API behavior, importer inventories, distributed staging, and Studio workflows. Validate real-model CPU/Vulkan generation and deploy the integration to the local QA instance.

Assisted-by: Codex:gpt-5 golangci-lint

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Richard Palethorpe <io@richiejp.com>

* feat(kimodocpp): adopt monolithic encoders and resident inference

Update upstream for resident weights, packed execution paths, and cached motion graphs. Default to all 32 text layers while retaining configurable streaming and legacy bundle support.

Use monolithic Q8_0 encoders by default and offer all six published quantizations through the gallery and importer. Refresh pinned hashes, tests, and documentation; remove the obsolete thread patch and ensure cached source checkouts follow the upstream pin.

Validated CPU and Vulkan generation, lower-bit streaming, gallery/importer suites, packaging, lint, and cold/warm Studio generation on localai-dev.

Assisted-by: Codex:gpt-5 golangci-lint

Assisted-by: Codex:gpt-5.6-sol
Signed-off-by: Richard Palethorpe <io@richiejp.com>

---------

Signed-off-by: Richard Palethorpe <io@richiejp.com>
2026-09-18 06:12:03 +01:00

76 lines
2.2 KiB
Go

// SPDX-License-Identifier: MIT
package schema
import (
"fmt"
"math"
"slices"
"strconv"
)
// AnimationInput describes one named conditioning input. Media data uses the
// same URL/base64 conventions as the other media APIs; text is literal UTF-8.
type AnimationInput struct {
Type string `json:"type"`
Data string `json:"data"`
}
type Model3DAnimationRequest struct {
BasicModelRequest
Inputs map[string]AnimationInput `json:"inputs"`
Params map[string]string `json:"params,omitempty"`
ResponseFormat string `json:"response_format,omitempty"`
}
// ThreeDOperation describes a supported workflow, including the complete set
// of inputs required together. Different workflows may share an endpoint.
type ThreeDOperation struct {
ID string `json:"id"`
Label string `json:"label"`
Endpoint string `json:"endpoint"`
Output string `json:"output"`
Inputs []ThreeDInput `json:"inputs"`
Parameters []ThreeDParameter `json:"parameters"`
}
type ThreeDInput struct {
MaxBytes int `json:"max_bytes,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Label string `json:"label"`
Required bool `json:"required"`
}
type ThreeDParameter struct {
Name string `json:"name"`
Label string `json:"label"`
Type string `json:"type"`
Default string `json:"default,omitempty"`
Min float64 `json:"min,omitempty"`
Max float64 `json:"max,omitempty"`
Options []string `json:"options,omitempty"`
Advanced bool `json:"advanced,omitempty"`
}
func (p ThreeDParameter) Validate(value string) error {
valid := false
switch p.Type {
case "enum":
valid = slices.Contains(p.Options, value)
case "uint64":
_, err := strconv.ParseUint(value, 10, 64)
valid = err == nil
case "integer", "number":
number, err := strconv.ParseFloat(value, 64)
if p.Type == "integer" {
_, err = strconv.ParseInt(value, 10, 64)
}
valid = err == nil && !math.IsNaN(number) && !math.IsInf(number, 0) &&
number >= p.Min && (p.Max == 0 || number <= p.Max)
}
if !valid {
return fmt.Errorf("invalid parameter %q", p.Name)
}
return nil
}