Added ID filter to LangFlow
This commit is contained in:
parent
95ef164f83
commit
12d6b4746a
5 changed files with 48 additions and 8 deletions
|
|
@ -102,6 +102,7 @@ async def share_component(
|
|||
|
||||
@router.get("/components/", response_model=ListComponentResponseModel)
|
||||
async def get_components(
|
||||
component_id: Annotated[Optional[str], Query()] = None,
|
||||
search: Annotated[Optional[str], Query()] = None,
|
||||
private: Annotated[Optional[bool], Query()] = None,
|
||||
is_component: Annotated[Optional[bool], Query()] = None,
|
||||
|
|
@ -117,6 +118,7 @@ async def get_components(
|
|||
):
|
||||
try:
|
||||
return await store_service.get_list_component_response_model(
|
||||
component_id=component_id,
|
||||
search=search,
|
||||
private=private,
|
||||
is_component=is_component,
|
||||
|
|
|
|||
|
|
@ -171,6 +171,7 @@ class StoreService(Service):
|
|||
|
||||
def build_filter_conditions(
|
||||
self,
|
||||
component_id: Optional[str] = None,
|
||||
search: Optional[str] = None,
|
||||
private: Optional[bool] = None,
|
||||
tags: Optional[List[str]] = None,
|
||||
|
|
@ -191,7 +192,8 @@ class StoreService(Service):
|
|||
if tags:
|
||||
tags_filter = self.build_tags_filter(tags)
|
||||
filter_conditions.append(tags_filter)
|
||||
|
||||
if component_id is not None:
|
||||
filter_conditions.append({"id": {"_eq": component_id}})
|
||||
if is_component is not None:
|
||||
filter_conditions.append({"is_component": {"_eq": is_component}})
|
||||
if liked and store_api_Key:
|
||||
|
|
@ -412,6 +414,7 @@ class StoreService(Service):
|
|||
|
||||
async def get_list_component_response_model(
|
||||
self,
|
||||
component_id: Optional[str] = None,
|
||||
search: Optional[str] = None,
|
||||
private: Optional[bool] = None,
|
||||
tags: Optional[List[str]] = None,
|
||||
|
|
@ -426,6 +429,7 @@ class StoreService(Service):
|
|||
):
|
||||
async with user_data_context(api_key=store_api_key, store_service=self):
|
||||
filter_conditions: List[Dict[str, Any]] = self.build_filter_conditions(
|
||||
component_id=component_id,
|
||||
search=search,
|
||||
private=private,
|
||||
tags=tags,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue