fix: fetch composio apps list dynamically (#5427)

* fix: fetch composio apps list dynamically

* Ensure apps only get loaded once API key is entered

* Add comment

* typo fix

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
tushar-composio 2024-12-27 16:08:18 -08:00 committed by GitHub
commit c4de1da4d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 29 deletions

View file

@ -35,7 +35,7 @@ class ComposioAPIComponent(LCToolComponent):
DropdownInput(
name="app_names",
display_name="App Name",
options=[str(app).replace("App.", "") for app in App.all()],
options=[],
value="",
info="The app name to use. Please refresh after selecting app name",
refresh_button=True,
@ -222,6 +222,11 @@ class ComposioAPIComponent(LCToolComponent):
return self.app_names.replace("", "").replace("_connected", "")
def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict: # noqa: ARG002
# Update the available apps options from the API
if hasattr(self, "api_key") and self.api_key != "":
toolset = self._build_wrapper()
build_config["app_names"]["options"] = list(App.iter())
# First, ensure all dynamic fields are hidden by default
dynamic_fields = ["app_credentials", "username", "auth_link", "auth_status", "action_names"]
for field in dynamic_fields: