mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-29 01:25:03 -04:00
* feat(system): report per-model DRM VRAM Expose optional resident device memory for local backend process trees. Deduplicate DRM clients and omit unsupported or incomplete readings. Document accounting limits and preserve a measured zero in JSON. Closes #11970. Assisted-by: Codex:gpt-6 * fix(system): document trusted procfs reads Scope G304 annotations to paths built from the fixed procfs root, integer process IDs, and kernel directory entries. These reads accept no user-controlled path components. Assisted-by: Codex:GPT-6 gosec --------- Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
26 lines
678 B
Go
26 lines
678 B
Go
// SPDX-License-Identifier: MIT
|
|
package schema_test
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/mudler/LocalAI/core/schema"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("SysInfoModel memory", func() {
|
|
It("omits unavailable VRAM while preserving a measured zero", func() {
|
|
entry := schema.SysInfoModel{ID: "model"}
|
|
encoded, err := json.Marshal(entry)
|
|
Expect(err).NotTo(HaveOccurred())
|
|
Expect(string(encoded)).To(MatchJSON(`{"id":"model"}`))
|
|
|
|
zero := uint64(0)
|
|
entry.SizeVRAM = &zero
|
|
encoded, err = json.Marshal(entry)
|
|
Expect(err).NotTo(HaveOccurred())
|
|
Expect(string(encoded)).To(MatchJSON(`{"id":"model","size_vram":0}`))
|
|
})
|
|
})
|