Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add download stop API for download service #1460

Merged
merged 6 commits into from
Oct 16, 2024
Merged

Conversation

namchuai
Copy link
Collaborator

@namchuai namchuai commented Oct 14, 2024

Describe Your Changes

  • Refactor to add download stop API.
  • Using multi interface from libcurl.
  • Throttle event by 1 sec
  • Return DownloadTask when calling download API.

API:

curl --location --request DELETE 'http://127.0.0.1:39281/models/pull' \
--header 'Content-Type: application/json' \
--data '{
    "taskId": <your_download_task_id>
}'

Response when calling Download API

{
    "message": "Model start downloading!",
    "task": {
        "id": "Mistral-7B-Instruct-v0.1-GGUF",
        "items": [
            {
                "bytes": 3822024352,
                "checksum": "N/A",
                "downloadUrl": "https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/resolve/main/mistral-7b-instruct-v0.1.Q3_K_L.gguf",
                "downloadedBytes": 0,
                "id": "TheBloke:Mistral-7B-Instruct-v0.1-GGUF:mistral-7b-instruct-v0.1.Q3_K_L.gguf",
                "localPath": "/Users/jamesnguyen/cortexcpp/models/huggingface.co/TheBloke/Mistral-7B-Instruct-v0.1-GGUF/mistral-7b-instruct-v0.1.Q3_K_L.gguf"
            }
        ],
        "type": "Model"
    }
}

Issue

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

@namchuai namchuai force-pushed the j/refactor-download-service branch 4 times, most recently from 0c0fea0 to 4dad79a Compare October 15, 2024 07:40
@namchuai namchuai marked this pull request as ready for review October 15, 2024 12:13
@namchuai namchuai force-pushed the j/refactor-download-service branch from 116b675 to afeda20 Compare October 15, 2024 12:16
@dan-menlo
Copy link
Contributor

@namchuai At the conclusion of this issue, please make sure we add this to the API Reference (i.e. swagger). cc @gabrielle-ong

Copy link
Contributor

@vansangpfiev vansangpfiev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@namchuai namchuai merged commit cc01530 into dev Oct 16, 2024
4 checks passed
@namchuai namchuai deleted the j/refactor-download-service branch October 16, 2024 03:03
@gabrielle-ong
Copy link
Contributor

@namchuai can I check if this new endpoint DELETE models/pull is added to Swagger?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants