Skip to content

Commit c41dfc0

Browse files
committed
Get Objects enabled for SelectAI
1 parent bed51b1 commit c41dfc0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/client/content/config/databases.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,22 @@ def patch_database(name: str, user: str, password: str, dsn: str, wallet_passwor
7272
)
7373
logger.info("SelectAI enabled: %s", selectai["enabled"])
7474
state.database_config[name]["selectai"] = selectai["enabled"]
75+
76+
# Check if SelectAI is enabled and get objects if so
77+
if selectai["enabled"]:
78+
try:
79+
endpoint = "v1/selectai/objects"
80+
selectai_objects = api_call.get(
81+
endpoint=endpoint,
82+
)
83+
logger.info("SelectAI objects retrieved: %d objects", len(selectai_objects))
84+
state.database_config[name]["selectai_objects"] = selectai_objects
85+
except api_call.ApiError as ex:
86+
logger.error("Failed to retrieve SelectAI objects: %s", ex)
87+
state.database_config[name]["selectai_objects"] = []
88+
else:
89+
state.database_config[name]["selectai_objects"] = None
90+
7591
except api_call.ApiError as ex:
7692
logger.error("Database not updated: %s (%s)", name, ex)
7793
state.database_config[name]["connected"] = False

0 commit comments

Comments
 (0)