rename /api/tags to /api/list

This commit is contained in:
Jeffrey Morgan 2023-11-22 23:11:47 -05:00
parent d77dde126b
commit 7396030d60
4 changed files with 6 additions and 5 deletions

View File

@ -262,7 +262,7 @@ func (c *Client) Create(ctx context.Context, req *CreateRequest, fn CreateProgre
func (c *Client) List(ctx context.Context) (*ListResponse, error) {
var lr ListResponse
if err := c.do(ctx, http.MethodGet, "/api/tags", nil, &lr); err != nil {
if err := c.do(ctx, http.MethodGet, "/api/list", nil, &lr); err != nil {
return nil, err
}
return &lr, nil

View File

@ -157,7 +157,7 @@ def push(model_name, insecure=False, callback=None):
# List models that are available locally.
def list():
try:
response = requests.get(f"{BASE_URL}/api/tags")
response = requests.get(f"{BASE_URL}/api/list")
response.raise_for_status()
data = response.json()
models = data.get('models', [])

View File

@ -372,10 +372,10 @@ curl -T model.bin -X POST http://localhost:11434/api/blobs/sha256:29fdb92e57cf08
Return 201 Created if the blob was successfully created.
## List Local Models
## List Models
```shell
GET /api/tags
GET /api/list
```
List models that are available locally.
@ -385,7 +385,7 @@ List models that are available locally.
#### Request
```shell
curl http://localhost:11434/api/tags
curl http://localhost:11434/api/list
```
#### Response

View File

@ -771,6 +771,7 @@ func Serve(ln net.Listener, allowOrigins []string) error {
c.String(http.StatusOK, "Ollama is running")
})
r.Handle(method, "/api/list", ListModelsHandler)
r.Handle(method, "/api/tags", ListModelsHandler)
}