separate deprecation changes

This commit is contained in:
Roy Han 2024-06-28 13:22:37 -07:00
parent 12209bd021
commit 0ac5cbc00e
4 changed files with 7 additions and 3 deletions

View File

@ -293,6 +293,7 @@ type ProcessResponse struct {
// ListModelResponse is a single model description in [ListResponse]. // ListModelResponse is a single model description in [ListResponse].
type ListModelResponse struct { type ListModelResponse struct {
Name string `json:"name"` Name string `json:"name"`
Model string `json:"model"`
ModifiedAt time.Time `json:"modified_at"` ModifiedAt time.Time `json:"modified_at"`
Size int64 `json:"size"` Size int64 `json:"size"`
Digest string `json:"digest"` Digest string `json:"digest"`
@ -301,6 +302,7 @@ type ListModelResponse struct {
// ProcessModelResponse is a single model description in [ProcessResponse]. // ProcessModelResponse is a single model description in [ProcessResponse].
type ProcessModelResponse struct { type ProcessModelResponse struct {
Name string `json:"name"`
Model string `json:"model"` Model string `json:"model"`
Size int64 `json:"size"` Size int64 `json:"size"`
Digest string `json:"digest"` Digest string `json:"digest"`

View File

@ -525,7 +525,7 @@ func ListRunningHandler(cmd *cobra.Command, args []string) error {
var data [][]string var data [][]string
for _, m := range models.Models { for _, m := range models.Models {
if len(args) == 0 || strings.HasPrefix(m.Model, args[0]) { if len(args) == 0 || strings.HasPrefix(m.Name, args[0]) {
var procStr string var procStr string
switch { switch {
case m.SizeVRAM == 0: case m.SizeVRAM == 0:
@ -539,7 +539,7 @@ func ListRunningHandler(cmd *cobra.Command, args []string) error {
cpuPercent := math.Round(float64(sizeCPU) / float64(m.Size) * 100) cpuPercent := math.Round(float64(sizeCPU) / float64(m.Size) * 100)
procStr = fmt.Sprintf("%d%%/%d%% CPU/GPU", int(cpuPercent), int(100-cpuPercent)) procStr = fmt.Sprintf("%d%%/%d%% CPU/GPU", int(cpuPercent), int(100-cpuPercent))
} }
data = append(data, []string{m.Model, m.Digest[:12], format.HumanBytes(m.Size), procStr, format.HumanTime(m.ExpiresAt, "Never")}) data = append(data, []string{m.Name, m.Digest[:12], format.HumanBytes(m.Size), procStr, format.HumanTime(m.ExpiresAt, "Never")})
} }
} }

@ -1 +1 @@
Subproject commit 5921b8f089d3b7bda86aac5a66825df6a6c10603 Subproject commit 7c26775adb579e92b59c82e8084c07a1d0f75e9c

View File

@ -747,6 +747,7 @@ func (s *Server) ListModelsHandler(c *gin.Context) {
// tag should never be masked // tag should never be masked
models = append(models, api.ListModelResponse{ models = append(models, api.ListModelResponse{
Model: trimLatest(n.DisplayShortest()),
Name: trimLatest(n.DisplayShortest()), Name: trimLatest(n.DisplayShortest()),
Size: m.Size(), Size: m.Size(),
Digest: m.digest, Digest: m.digest,
@ -1156,6 +1157,7 @@ func (s *Server) ProcessHandler(c *gin.Context) {
mr := api.ProcessModelResponse{ mr := api.ProcessModelResponse{
Model: trimLatest(model.ShortName), Model: trimLatest(model.ShortName),
Name: trimLatest(model.ShortName),
Size: int64(v.estimatedTotal), Size: int64(v.estimatedTotal),
SizeVRAM: int64(v.estimatedVRAM), SizeVRAM: int64(v.estimatedVRAM),
Digest: model.Digest, Digest: model.Digest,