🔥 refactor(store.py): remove unused code for creating component metadata
The code was previously responsible for creating metadata for a component based on the nodes it contains. However, this functionality is no longer needed and has been removed to simplify the code and improve maintainability.
This commit is contained in:
parent
b0492f3adc
commit
07e8e318ee
1 changed files with 0 additions and 16 deletions
|
|
@ -64,22 +64,6 @@ def create_component(
|
|||
store_api_Key: str = Depends(get_user_store_api_key),
|
||||
):
|
||||
try:
|
||||
# We need to add the metadata using the Component.data
|
||||
# data is a dict that contains 'nodes' key.
|
||||
# each node has an id like "SomeType-RANDOMSTRING"
|
||||
# we need to create a metadata dict with SomeType as key
|
||||
# and the value is the count this type appears in the nodes
|
||||
# e.g.
|
||||
# {
|
||||
# "SomeType": {
|
||||
# "count": 2
|
||||
# },
|
||||
# "total": 2
|
||||
# }
|
||||
names = [node["id"].split("-")[0] for node in component.data["nodes"]]
|
||||
metadata = {name: {"count": names.count(name)} for name in names}
|
||||
metadata["total"] = len(names)
|
||||
component.metadata = metadata
|
||||
return store_service.upload(store_api_Key, component)
|
||||
except Exception as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue