Loading a custom provider in code #154
-
Hi there! I'm interested in extending your fantastic library by forking it and incorporating some custom providers. Currently, I'm utilizing the custom provider flow outlined in the documentation. However, I'm looking for a more streamlined approach to ensure that my providers are always loaded without the need for manual intervention like drag-and-drop. Presently, I'm accomplishing this by calling initCustomProvider(mycode) when the application first renders. I'm curious if there's a more efficient method, such as placing the code in a designated folder on the backend API and registering the provider programmatically in the code. I appreciate your guidance on this matter! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi, thank you for the interest! Actually once you drop a custom provider in the front-end UI once, it should be cached on the backend —meaning it loads up everytime you load the application. You can take a look at that part of the code (probably its in the Python side) to see where exactly the folder is, in case you’d want to manage it manually. Lmk if this isn’t the case and we can debug. |
Beta Was this translation helpful? Give feedback.
Np... The function called on load is here: https://github.com/ianarawjo/ChainForge/blob/0b32792d07b3b607bd0f1d614afb145ae0f7ed36/chainforge/flask_app.py#L589C16-L589C16
The folder is relative to the package, I believe:
So where the flask_app.py file is located, then
/cache/provider_scripts
The app calls
loadCachedCustomProviders
upon load:ChainForge/chainforge/react-server/src/GlobalSettingsModal.js
Line 146 in 0b32792