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
9 changes: 5 additions & 4 deletions src/backend/base/langflow/components/vectorstores/astradb.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,14 @@ def get_vectorize_providers(self):

def _initialize_database_options(self):
try:
database_list = self.get_database_list() # Cache the result of get_database_list
return [
{
"name": name,
"collections": info["collections"],
"api_endpoint": info["api_endpoint"],
}
for name, info in self.get_database_list().items()
for name, info in database_list.items()
]
except Exception as e:
msg = f"Error fetching database options: {e}"
Expand Down Expand Up @@ -496,12 +497,12 @@ def reset_collection_list(self, build_config: dict):

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()
database_options = self._initialize_database_options() # Utilize caching here

# If we retrieved options based on the token, show the dropdown
# Create options and options metadata using list comprehensions
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
{"collections": db["collections"], "api_endpoint": db["api_endpoint"]} for db in database_options
]

# Reset the selected database
Expand Down
Loading
Loading