LLMTool Plugin List API Views
This module contains views to implement the React.
Plugin list view in the Smarter Dashboard.
- smarter.apps.llmtool.views.listview.api.EXTENSION_SEARCH_FIELDS = ('slug', 'display_name', 'description', 'publisher')
The fields of an Extension that a search of the Extension list matches.
('slug', 'display_name', 'description', 'publisher')
- smarter.apps.llmtool.views.listview.api.EXTENSION_SORT_FIELDS = {'createdAt': 'created_at', 'description': 'description', 'displayName': 'display_name', 'enabled': 'enabled', 'publisher': 'publisher', 'trustBadge': 'trust_badge', 'updatedAt': 'updated_at', 'version': 'installed_version__version'}
The columns of the Extension list that it may be sorted by, and the fields that sort them.
{ 'createdAt': 'created_at', 'description': 'description', 'displayName': 'display_name', 'enabled': 'enabled', 'publisher': 'publisher', 'trustBadge': 'trust_badge', 'updatedAt': 'updated_at', 'version': 'installed_version__version', }
- class smarter.apps.llmtool.views.listview.api.PluginListApiCloneView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewClone a plugin 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 PluginMeta.
Validates input parameters, checks for the existence of the PluginMeta to be cloned, and creates a new PluginMeta with the specified name. Invalidates the cache for the user’s LLMClients 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:
llmclient_id (str): The ID of the PluginMeta to be cloned.
new_name (str): The new name for the cloned PluginMeta.
- Returns:
A JsonResponse containing the serialized data of the newly cloned PluginMeta if successful, or an error message if the cloning fails.
- Return type:
- class smarter.apps.llmtool.views.listview.api.PluginListApiDeleteView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewDelete a plugin 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 PluginMeta.
Validates input parameters, checks for the existence of the PluginMeta to be deleted, and deletes the PluginMeta 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:
llmclient_id (str): The ID of the PluginMeta to be deleted.
- Returns:
A JsonResponse indicating the success or failure of the deletion.
- Return type:
- class smarter.apps.llmtool.views.listview.api.PluginListApiExtensionsView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewList the installed Extensions that the authenticated user’s account may use, read-only.
This is the api of the LLMTool list’s Extensions tab. An extension is listed if it has an installed version and is available to the user’s account, whether or not it is enabled: an LLMClient may list a disabled extension, whose tools are offered once an administrator enables it (see the LLMClient broker’s
resolve_extension()). A superuser sees every installed extension.It has no clone, rename or delete: superusers manage extensions in the Extensions console. The response is paginated, searched and sorted like the plugin list’s, with
paginate_listview(), and is anExtensionListPage, whose JSON Schema@smarter/llmtool-listgenerates its types from.- available_extensions(request)[source]
Return the installed extensions that the user’s account may use.
This is the queryset form of
is_available_to().
- property formatted_class_name: str
Returns a formatted string of the class name for logging purposes.
- post(request, *args, **kwargs)[source]
Handle POST requests for a page of the extensions that the user may use.
- Parameters:
request (
ASGIRequest) – The HTTP request, whose query parameters arepage,page_size,searchandordering. Seepaginate_listview().- Returns:
An
ExtensionListPage:{"objects": [...], "pagination": {...}}.- Return type:
- class smarter.apps.llmtool.views.listview.api.PluginListApiRenameView(**kwargs)[source]
Bases:
SmarterAuthenticatedNeverCachedWebViewRename a plugin 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 PluginMeta.
Validates input parameters, checks for the existence of the PluginMeta to be renamed, and renames the PluginMeta 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:
llmclient_id (str): The ID of the PluginMeta to be renamed.
new_name (str): The new name for the PluginMeta.
- Returns:
A JsonResponse indicating the success or failure of the renaming.
- Return type:
- class smarter.apps.llmtool.views.listview.api.PluginListApiView(**kwargs)[source]
Bases:
SmarterListApiViewRender the plugin list view for the Smarter Workbench web console.
This view displays all plugins available to the authenticated user as cards, providing a quick overview and access to plugin details.
- Parameters:
- Returns:
Rendered HTML page with a card for each plugin, or a 404 error page if the user is not authenticated.
- Return type:
HttpResponse
- listview_cache_kind: ClassVar[str] = 'Plugin'
The list’s name in the cache, as
connect_listview_cache()invalidates it, e.g.LLMClient.
- model
alias of
PluginMeta
The forward relations that the serializer reads, besides the owner’s.
- serializer_class
alias of
PluginSerializer
- smarter.apps.llmtool.views.listview.api.SORT_FIELDS = {'createdAt': 'created_at', 'description': 'description', 'kind': 'plugin_class', 'name': 'name', 'selector': 'plugin_selector_plugin__directive', 'updatedAt': 'updated_at'}
The columns of the Plugin list that it may be sorted by, and the fields that sort them.
{ 'createdAt': 'created_at', 'description': 'description', 'kind': 'plugin_class', 'name': 'name', 'selector': 'plugin_selector_plugin__directive', 'updatedAt': 'updated_at', }