API View
This module contains views to implement the React.
LLMHost list view in the Smarter Dashboard.
- class smarter.apps.llmhost.views.listview.api.LLMHostListApiCloneView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewClone a llmhost 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 LLMHost.
Validates input parameters, checks for the existence of the LLMHost to be cloned, and creates a new LLMHost with the specified name. Invalidates the cache for the user’s LLMHosts 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:
llmhost_id (str): The ID of the LLMHost to be cloned.
new_name (str): The new name for the cloned LLMHost.
- Returns:
A JsonResponse containing the serialized data of the newly cloned LLMHost if successful, or an error message if the cloning fails.
- Return type:
- class smarter.apps.llmhost.views.listview.api.LLMHostListApiDeleteView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewDelete a llmhost 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 LLMHost.
Validates input parameters, checks for the existence of the LLMHost to be deleted, and deletes the LLMHost 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:
llmhost_id (str): The ID of the LLMHost to be deleted.
- Returns:
A JsonResponse indicating the success or failure of the deletion.
- Return type:
- class smarter.apps.llmhost.views.listview.api.LLMHostListApiRenameView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewRename a llmhost 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 LLMHost.
Validates input parameters, checks for the existence of the LLMHost to be renamed, and renames the LLMHost 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:
llmhost_id (str): The ID of the LLMHost to be renamed.
new_name (str): The new name for the LLMHost.
- Returns:
A JsonResponse indicating the success or failure of the renaming.
- Return type:
- class smarter.apps.llmhost.views.listview.api.LLMHostListApiView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewRender the llmhost list view for the Smarter Workbench web console.
This view displays all llmhosts available to the authenticated user as cards, providing a quick overview and access to llmhost details.
- Parameters:
- Returns:
Rendered HTML page with a card for each llmhost, 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.