fix: Resolve Auth field issue in Composio component and bump Composio (#5357)
* fix: replace single quotes with double quotes * feat: update Composio component fields
This commit is contained in:
parent
01c1d47ff5
commit
fb9825ee65
3 changed files with 28 additions and 19 deletions
|
|
@ -8,7 +8,6 @@ from composio.client.exceptions import NoItemsFound
|
|||
from composio_langchain import Action, App, ComposioToolSet
|
||||
from langchain_core.tools import Tool
|
||||
from loguru import logger
|
||||
from typing_extensions import override
|
||||
|
||||
# Local imports
|
||||
from langflow.base.langchain_utilities.model import LCToolComponent
|
||||
|
|
@ -30,16 +29,17 @@ class ComposioAPIComponent(LCToolComponent):
|
|||
name="api_key",
|
||||
display_name="Composio API Key",
|
||||
required=True,
|
||||
# refresh_button=True,
|
||||
info="Refer to https://docs.composio.dev/faq/api_key/api_key",
|
||||
real_time_refresh=True,
|
||||
),
|
||||
DropdownInput(
|
||||
name="app_names",
|
||||
display_name="App Name",
|
||||
options=list(App.__annotations__),
|
||||
options=[str(app).replace("App.", "") for app in App.all()],
|
||||
value="",
|
||||
info="The app name to use. Please refresh after selecting app name",
|
||||
refresh_button=True,
|
||||
required=True,
|
||||
),
|
||||
# Authentication-related inputs (initially hidden)
|
||||
SecretStrInput(
|
||||
|
|
@ -49,6 +49,7 @@ class ComposioAPIComponent(LCToolComponent):
|
|||
dynamic=True,
|
||||
show=False,
|
||||
info="Credentials for app authentication (API Key, Password, etc)",
|
||||
load_from_db=False,
|
||||
),
|
||||
MessageTextInput(
|
||||
name="username",
|
||||
|
|
@ -220,19 +221,24 @@ class ComposioAPIComponent(LCToolComponent):
|
|||
"""
|
||||
return self.app_names.replace(" ✅", "").replace("_connected", "")
|
||||
|
||||
@override
|
||||
def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict:
|
||||
def update_build_config(self, build_config: dict, field_value: Any, field_name: str | None = None) -> dict: # noqa: ARG002
|
||||
# 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:
|
||||
if field in build_config:
|
||||
if build_config[field]["value"] is None or build_config[field]["value"] == "":
|
||||
build_config[field]["show"] = False
|
||||
build_config[field]["advanced"] = True # Hide from main view
|
||||
build_config[field]["advanced"] = True
|
||||
build_config[field]["load_from_db"] = False
|
||||
else:
|
||||
build_config[field]["show"] = True
|
||||
build_config[field]["advanced"] = False
|
||||
|
||||
if field_name == "app_names" and (not hasattr(self, "app_names") or not self.app_names):
|
||||
build_config["auth_status"]["show"] = True
|
||||
build_config["auth_status"]["value"] = "Please select an app first"
|
||||
return build_config
|
||||
|
||||
if field_name == "app_names" and hasattr(self, "api_key") and self.api_key != "":
|
||||
# app_name = self._get_normalized_app_name()
|
||||
app_name = self.app_names
|
||||
|
|
@ -285,7 +291,7 @@ class ComposioAPIComponent(LCToolComponent):
|
|||
|
||||
# Update action names if connected
|
||||
if build_config["auth_status"]["value"] == "✅":
|
||||
all_action_names = list(Action.__annotations__)
|
||||
all_action_names = [str(action).replace("Action.", "") for action in Action.all()]
|
||||
app_action_names = [
|
||||
action_name
|
||||
for action_name in all_action_names
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue