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.
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.
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.
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.
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?
rholinshead
left a comment
There was a problem hiding this comment.
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
clientConfigToAIConfigwithin 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/clientand run this command:Then go to
aiconfigdir and run this command:3460ce7d-5164-4ec1-9bee-be70b9758724.mp4