Web Console Views

The JSON API of the React Vectorstore list in the web console: list, clone, rename and delete.

class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiCloneView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Clone a vectorstore: a new, undeployed vectorstore with the same spec, owned by the user.

Its documents and database are not copied. Deploy it, and add documents, to use it.

post(request, *args, **kwargs)[source]
Return type:

JsonResponse

class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiDeleteView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Destroy a vectorstore’s database and data, unless deletionProtection is enabled, then delete it.

post(request, *args, **kwargs)[source]
Return type:

JsonResponse

class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiRenameView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Rename a vectorstore.

Its database keeps its index name, and its server its Kubernetes name.

post(request, *args, **kwargs)[source]
Return type:

JsonResponse

class smarter.apps.vectorstore.views.listview.api.VectorstoreListApiView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

The vectorstores that the user owns, those shared with them, or both.

post(request, *args, **kwargs)[source]
Return type:

JsonResponse

This module contains views to implement the React.

Vectorstore list view in the Smarter Dashboard.

class smarter.apps.vectorstore.views.listview.view.VectorstoreListView(**kwargs)[source]

Bases: SmarterAuthenticatedNeverCachedWebView

Render the vectorstore list view for the Smarter Workbench web console.

This view displays all vectorstores available to the authenticated user as cards, providing a quick overview and access to vectorstore details.

Parameters:
  • request (ASGIRequest) – Django HTTP request object.

  • args (tuple) – Additional positional arguments.

  • kwargs (dict) – Additional keyword arguments.

Returns:

Rendered HTML page with a card for each vectorstore, 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.

get(request, *args, **kwargs)[source]

Handle GET requests and return a cleaned HttpResponse.

Parameters:

request (ASGIRequest) – The HTTP request object.

Returns:

An HttpResponse with the cleaned HTML content.

Return type:

HttpResponse

template_path: str = 'react/vectorstore-list.html'
vectorstores: list[VectorstoreMeta]

This module contains views to implement the Vectorstore.

card-style detail view in the Smarter Dashboard.

class smarter.apps.vectorstore.views.detailview.VectorstoreDetailView(**kwargs)[source]

Bases: DocsBaseView

Renders the detail view for a Smarter dashboard vectorstore.

This view renders a detailed manifest for a specific vectorstore, including its configuration and metadata, in YAML format. It is intended for authenticated users and provides error handling for missing or unsupported vectorstore kinds and names.

Parameters:
  • request (ASGIRequest) – Django HTTP request object.

  • args (tuple) – Additional positional arguments.

  • kwargs (dict) – Keyword arguments, must include ‘name’ (vectorstore name) and ‘kind’ (vectorstore type).

Returns:

Rendered HTML page with vectorstore manifest details, or a 404 error page if the vectorstore is not found or parameters are invalid.

Return type:

HttpResponse

Note

The vectorstore name and kind must be provided and valid. Otherwise, a “not found” response is returned.

See also

Vectorstore for vectorstore metadata retrieval. ApiV1CliDescribeApiView for API details.

Example usage:

GET /vectorstore/detail/?name=my_vectorstore&kind=custom
get(request, *args, **kwargs)[source]

Handle GET requests to render the vectorstore manifest detail view.

This method processes the incoming request to retrieve the specified vectorstore’s manifest details and renders them in a user-friendly format. It performs validation on the provided vectorstore name and kind, retrieves the vectorstore metadata, and handles any errors that may arise during this process.

Process: 1. Extract and validate ‘name’ and ‘kind’ from kwargs. 2. Retrieve the vectorstore metadata using the provided name and user context. 3. If the vectorstore is found, call the API view to get the vectorstore details 4. Convert the JSON response to YAML format for better readability. 5. Render the vectorstore manifest detail template with the retrieved data. 6. Handle any errors that occur during the process and return appropriate error responses.

Parameters:
  • request (ASGIRequest) – Django HTTP request object.

  • args (tuple) – Additional positional arguments.

  • kwargs (dict) – Keyword arguments, must include ‘name’ (vectorstore name) and ‘kind’ (vectorstore type).

Returns:

Rendered HTML page with vectorstore manifest details, or an error response if the vectorstore is not found or parameters are invalid.

Return type:

HttpResponse

template_path: str | None = 'common/manifest_detail.html'
vectorstore: VectorstoreMeta | None = None