Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions src/backend/base/langflow/components/vectorstores/astradb.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,14 +444,13 @@

def _initialize_database_options(self):
try:
return [
{
"name": name,
"collections": info["collections"],
"api_endpoint": info["api_endpoint"],
}
for name, info in self.get_database_list().items()
]
database_list = self.get_database_list()
database_options = []
for name, info in database_list.items():
database_options.append(
{"name": name, "collections": info["collections"], "api_endpoint": info["api_endpoint"]}
)
return database_options

Check failure on line 453 in src/backend/base/langflow/components/vectorstores/astradb.py

View workflow job for this annotation

GitHub Actions / Ruff Style Check (3.12)

Ruff (TRY300)

src/backend/base/langflow/components/vectorstores/astradb.py:453:13: TRY300 Consider moving this statement to an `else` block
except Exception as e:
msg = f"Error fetching database options: {e}"
raise ValueError(msg) from e
Expand Down Expand Up @@ -495,16 +494,17 @@
return build_config

def reset_database_list(self, build_config: dict):
# Get the list of options we have based on the token provided
database_options = self._initialize_database_options()

# If we retrieved options based on the token, show the dropdown
build_config["api_endpoint"]["options"] = [db["name"] for db in database_options]
build_config["api_endpoint"]["options_metadata"] = [
{k: v for k, v in db.items() if k not in ["name"]} for db in database_options
]
api_endpoint_options = []
api_endpoint_metadata = []

for db in database_options:
api_endpoint_options.append(db["name"])
api_endpoint_metadata.append({"collections": db["collections"], "api_endpoint": db["api_endpoint"]})

# Reset the selected database
build_config["api_endpoint"]["options"] = api_endpoint_options
build_config["api_endpoint"]["options_metadata"] = api_endpoint_metadata
build_config["api_endpoint"]["value"] = ""

return build_config
Expand Down
Loading
Loading