-
Notifications
You must be signed in to change notification settings - Fork 80
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
Download Button [1/n]: Setup UI on the editor client #1061
Conversation
9a06fea
to
7ddfc1d
Compare
If the download callback is defined (not for local editor or VSCode, but will be for Gradio), then we display it and use the loading state to disable you from clicking on the button. I'm making the signature of the callback take in an AIConfig object parameter, because we have function `clientConfigToAIConfig` within the editor pacakge: https://github.com/lastmile-ai/aiconfig/blob/c838856f36941b0796c8f12edcf846cc18ebdaa1/python/src/aiconfig/editor/client/src/shared/types.ts#L37 ## Test Plan Rebase onto #1045 Go to `aiconfig/python/src/aiconfig/editor/client` and run this command: ``` rm -rf node_modules && yarn && yarn build ``` Then go to `aiconfig` dir and run this command: ``` aiconfig_path=./cookbooks/Gradio/huggingface.aiconfig.json parsers_path=./cookbooks/Gradio/hf_model_parsers.py aiconfig edit --aiconfig-path=$aiconfig_path --server-port=8080 --server-mode=debug_servers --parsers-module-path=$parsers_path ``` https://github.com/lastmile-ai/aiconfig/assets/151060367/123319cf-2e92-49e8-8f93-2d930a3b0ac7
return; | ||
} | ||
try { | ||
await downloadCallback(config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is kind of strange -- here we are using the client config as the source of truth and I guess sending it to the server to initiate the download? Can't we just use the server-copy similar to share?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r.e. using server link. If we had an endpoint for the server to give us the download we would be able to just use the download property for an anchor element: https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/download
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint for the server to give us the download
You mean give us the AIConfig from server? This is similar to the load()
endpoint which we could re-use if desired (but we'd have to refactor it to accept sessionId to get the right AIConfig instance)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I think this is fine for now. In gradio we can just fetch from the server and download. It won't actually be 2 hops since it's just one server request (to download the config) and then the browser -> user machine is a synchronous (local) operation, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synced over slack. I think this is good for now
Download Button [1/n]: Setup UI on the editor client
If the download callback is defined (not for local editor or VSCode, but will be for Gradio), then we display it and use the loading state to disable you from clicking on the button.
I'm making the signature of the callback take in an AIConfig object parameter, because we have function
clientConfigToAIConfig
within the editor pacakge:aiconfig/python/src/aiconfig/editor/client/src/shared/types.ts
Line 37 in c838856
Test Plan
Rebase onto #1045
Go to
aiconfig/python/src/aiconfig/editor/client
and run this command:Then go to
aiconfig
dir and run this command:3460ce7d-5164-4ec1-9bee-be70b9758724.mp4