feat: add api-asset-client crate and /v1/assets/models API endpoint#4067
Draft
feat: add api-asset-client crate and /v1/assets/models API endpoint#4067
Conversation
Introduces a new `api-asset-client` crate to resolve model asset URLs from the Hyprnote API, falling back to hardcoded URLs when the API is unavailable. Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Deploy Preview for hyprnote-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
…pps/api Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
api-asset-clientcrate that fetches model asset metadata (URL, checksum, size) fromhttps://api.hyprnote.com/v1/assets/modelsOnceCellto avoid repeated network calls; exposes aresolve_modelconvenience function via a global default clientlocal-sttplugin to resolve model download URLs from the API, falling back to the hardcodedtar_url/model_urlif the API call failslocal-llmplugin to resolve model download URLs from the API, with the same fallback patternamcrate'sdownloadmethod to resolve URLs from the API instead of using hardcoded S3 URLs directlystrum::Displayderive tolocal-llm::SupportedModelto enableto_string()for asset ID resolutionapi-assetcrate that servesGET /modelswith the full model manifest (13 models across AmModel, WhisperModel, SupportedModel)apps/apiat/v1/assets/models(no auth required, as clients need this pre-authentication)Review & Testing Checklist for Human
idincrates/api-asset/src/lib.rsexactly matches theto_string()output of the corresponding model enum variant. EspeciallySupportedModelvariants (Llama3p2_3bQ4,Gemma3_4bQ4,HyprLLM) which use default strum Display (no custom serialization)api-assetare hardcoded copies fromam/src/model.rs,whisper-local-model/src/lib.rs, andlocal-llm/src/model.rs. Verify all 13 entries match their source. If any source values have changed onmainsince this branch, the API data is staleModelAssetdefinition:api-asset(server) andapi-asset-client(client) each define their ownModelAssetstruct with the same shape — confirm the field names/types match so serialization round-trips correctlyGET /v1/assets/models, then test model downloads for each plugin (local-stt, local-llm, am) against the live endpointNotes
The
/v1/assets/modelsendpoint is unauthenticated — this is intentional since desktop clients call it before auth. Thechecksumfield isu32in both server and client; note thatSupportedModel::model_checksum()returnsu64(current values fit inu32but this could diverge).Requested by: @yujonglee
Link to Devin run