Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Show No Op adapters in UI only for zipstack and unstract domain emails #1046

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 10 additions & 2 deletions backend/adapter_processor_v2/adapter_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,25 @@ def get_json_schema(adapter_id: str) -> dict[str, Any]:
return schema_details

@staticmethod
def get_all_supported_adapters(type: str) -> list[dict[Any, Any]]:
def get_all_supported_adapters(user_email: str, type: str) -> list[dict[Any, Any]]:
"""Function to return list of all supported adapters."""
supported_adapters = []
updated_adapters = []
updated_adapters = AdapterProcessor.__fetch_adapters_by_key_value(
AdapterKeys.ADAPTER_TYPE, type
)
is_zipstack_or_unstract_user = (
"@zipstack.com" in user_email or "@unstract.com" in user_email
jagadeeswaran-zipstack marked this conversation as resolved.
Show resolved Hide resolved
)

for each_adapter in updated_adapters:
adapter_id = each_adapter.get(AdapterKeys.ID)
if not is_zipstack_or_unstract_user and adapter_id.startswith("noOp"):
continue

supported_adapters.append(
{
AdapterKeys.ID: each_adapter.get(AdapterKeys.ID),
AdapterKeys.ID: adapter_id,
AdapterKeys.NAME: each_adapter.get(AdapterKeys.NAME),
AdapterKeys.DESCRIPTION: each_adapter.get(AdapterKeys.DESCRIPTION),
AdapterKeys.ICON: each_adapter.get(AdapterKeys.ICON),
Expand Down
2 changes: 1 addition & 1 deletion backend/adapter_processor_v2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def list(
or adapter_type == AdapterKeys.OCR
):
json_schema = AdapterProcessor.get_all_supported_adapters(
jagadeeswaran-zipstack marked this conversation as resolved.
Show resolved Hide resolved
type=adapter_type
type=adapter_type, user_email=request.user.email
)
return Response(json_schema, status=status.HTTP_200_OK)
else:
Expand Down
Loading