Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0ac5cbc00e | ||
|
12209bd021 | ||
|
be2c5fd71a |
@ -493,7 +493,7 @@ func ListHandler(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
for _, m := range models.Models {
|
for _, m := range models.Models {
|
||||||
if len(args) == 0 || strings.HasPrefix(m.Name, args[0]) {
|
if len(args) == 0 || strings.HasPrefix(m.Name, args[0]) {
|
||||||
data = append(data, []string{m.Name, m.Digest[:12], format.HumanBytes(m.Size), format.HumanTime(m.ModifiedAt, "Never")})
|
data = append(data, []string{m.Name[:len(m.Name)], m.Digest[:12], format.HumanBytes(m.Size), format.HumanTime(m.ModifiedAt, "Never")})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 5921b8f089d3b7bda86aac5a66825df6a6c10603
|
Subproject commit 7c26775adb579e92b59c82e8084c07a1d0f75e9c
|
@ -747,8 +747,8 @@ 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: n.DisplayShortest(),
|
Model: trimLatest(n.DisplayShortest()),
|
||||||
Name: n.DisplayShortest(),
|
Name: trimLatest(n.DisplayShortest()),
|
||||||
Size: m.Size(),
|
Size: m.Size(),
|
||||||
Digest: m.digest,
|
Digest: m.digest,
|
||||||
ModifiedAt: m.fi.ModTime(),
|
ModifiedAt: m.fi.ModTime(),
|
||||||
@ -1156,8 +1156,8 @@ func (s *Server) ProcessHandler(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mr := api.ProcessModelResponse{
|
mr := api.ProcessModelResponse{
|
||||||
Model: model.ShortName,
|
Model: trimLatest(model.ShortName),
|
||||||
Name: 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,
|
||||||
@ -1178,6 +1178,13 @@ func (s *Server) ProcessHandler(c *gin.Context) {
|
|||||||
c.JSON(http.StatusOK, api.ProcessResponse{Models: models})
|
c.JSON(http.StatusOK, api.ProcessResponse{Models: models})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func trimLatest(s string) string {
|
||||||
|
if strings.HasSuffix(s, ":latest") {
|
||||||
|
return s[:len(s)-7]
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
// ChatPrompt builds up a prompt from a series of messages for the currently `loaded` model
|
// ChatPrompt builds up a prompt from a series of messages for the currently `loaded` model
|
||||||
func chatPrompt(ctx context.Context, runner *runnerRef, template string, messages []api.Message, numCtx int) (string, error) {
|
func chatPrompt(ctx context.Context, runner *runnerRef, template string, messages []api.Message, numCtx int) (string, error) {
|
||||||
encode := func(s string) ([]int, error) {
|
encode := func(s string) ([]int, error) {
|
||||||
|
@ -16,12 +16,12 @@ func TestList(t *testing.T) {
|
|||||||
expectNames := []string{
|
expectNames := []string{
|
||||||
"mistral:7b-instruct-q4_0",
|
"mistral:7b-instruct-q4_0",
|
||||||
"zephyr:7b-beta-q5_K_M",
|
"zephyr:7b-beta-q5_K_M",
|
||||||
"apple/OpenELM:latest",
|
"apple/OpenELM",
|
||||||
"boreas:2b-code-v1.5-q6_K",
|
"boreas:2b-code-v1.5-q6_K",
|
||||||
"notus:7b-v1-IQ2_S",
|
"notus:7b-v1-IQ2_S",
|
||||||
// TODO: host:port currently fails on windows (#4107)
|
// TODO: host:port currently fails on windows (#4107)
|
||||||
// "localhost:5000/library/eurus:700b-v0.5-iq3_XXS",
|
// "localhost:5000/library/eurus:700b-v0.5-iq3_XXS",
|
||||||
"mynamespace/apeliotes:latest",
|
"mynamespace/apeliotes",
|
||||||
"myhost/mynamespace/lips:code",
|
"myhost/mynamespace/lips:code",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ func Test_Routes(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
assert.Len(t, modelList.Models, 1)
|
assert.Len(t, modelList.Models, 1)
|
||||||
assert.Equal(t, "test-model:latest", modelList.Models[0].Name)
|
assert.Equal(t, "test-model", modelList.Models[0].Name)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user