API View
This module contains views to implement the React.
Provider list view in the Smarter Dashboard.
- class smarter.apps.provider.views.listview.api.ProviderListApiCloneView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewClone a provider for the authenticated user.
- property formatted_class_name: str
Returns a formatted string of the class name for logging purposes.
- post(request, *args, **kwargs)[source]
Handle POST requests to clone an existing Provider.
Validates input parameters, checks for the existence of the Provider to be cloned, and creates a new Provider with the specified name. Invalidates the cache for the user’s Providers after cloning.
- Parameters:
request (
HttpRequest) – The HTTP request object containing the parameters for cloning.args – Additional positional arguments (not used).
kwargs –
Additional keyword arguments, including:
provider_id (str): The ID of the Provider to be cloned.
new_name (str): The new name for the cloned Provider.
- Returns:
A JsonResponse containing the serialized data of the newly cloned Provider if successful, or an error message if the cloning fails.
- Return type:
- class smarter.apps.provider.views.listview.api.ProviderListApiDeleteView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewDelete a provider for the authenticated user.
- property formatted_class_name: str
Returns a formatted string of the class name for logging purposes.
- post(request, *args, **kwargs)[source]
Handle POST requests to delete an existing Provider.
Validates input parameters, checks for the existence of the Provider to be deleted, and deletes the Provider if it exists. Invalidates the cache for the user’s LLMClients after deletion.
- Parameters:
request (
HttpRequest) – The HTTP request object containing the parameters for deletion.args – Additional positional arguments (not used).
kwargs –
Additional keyword arguments, including:
provider_id (str): The ID of the Provider to be deleted.
- Returns:
A JsonResponse indicating the success or failure of the deletion.
- Return type:
- class smarter.apps.provider.views.listview.api.ProviderListApiRenameView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewRename a provider for the authenticated user.
- property formatted_class_name: str
Returns a formatted string of the class name for logging purposes.
- post(request, *args, **kwargs)[source]
Handle POST requests to rename an existing Provider.
Validates input parameters, checks for the existence of the Provider to be renamed, and renames the Provider if it exists. Invalidates the cache for the user’s LLMClients after renaming.
- Parameters:
request (
HttpRequest) – The HTTP request object containing the parameters for renaming.args – Additional positional arguments (not used).
kwargs –
Additional keyword arguments, including:
provider_id (str): The ID of the Provider to be renamed.
new_name (str): The new name for the Provider.
- Returns:
A JsonResponse indicating the success or failure of the renaming.
- Return type:
- class smarter.apps.provider.views.listview.api.ProviderListApiView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewRender the provider list view for the Smarter Workbench web console.
This view displays all providers available to the authenticated user as cards, providing a quick overview and access to provider details.
- Parameters:
- Returns:
Rendered HTML page with a card for each provider, or a 404 error page if the user is not authenticated.
- Return type:
HttpResponse
- property formatted_class_name: str
Returns a formatted string of the class name for logging purposes.