feat: add safe tensor model type to SBOM output (#4844)

---------
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Christopher Angelo Phillips
2026-07-15 17:14:03 -04:00
committed by GitHub
co-authored by Alex Goodman
parent ed499fd2d0
commit aff2c247db
37 changed files with 7829 additions and 89 deletions
+22
View File
@@ -0,0 +1,22 @@
package ai
import "path"
// pickSafeTensorsName implements the documented naming precedence chain:
func pickSafeTensorsName(nameOrPath, fallbackName string) string {
if nameOrPath != "" {
return path.Base(nameOrPath)
}
return fallbackName
}
// safeTensorsDirName returns the directory-scan naming fallback: the base name
// of the group's parent directory (the group key is already that directory).
func safeTensorsDirName(directory string) string {
base := path.Base(directory)
switch base {
case "/", ".", "":
return ""
}
return base
}