Dashboard Passthrough API URLs

URL configuration for the Prompt Passthrough’s endpoints in the web console’s api.

These are mounted at /api/web/dashboard/passthrough/, from smarter.apps.dashboard.api.web.urls. Registration is conditional on the SMARTER_APP_DASHBOARD_PASSTHROUGH_PROMPT_ENABLE setting, as is the Prompt Passthrough page’s: when disabled, no routes are registered.

These endpoints are part of Smarter’s Django-React integration. The Django view that renders a console page reverses their urls and passes them to the page’s React app, in the attributes of its root element, and the app calls them with the browser’s Django session and CSRF token. See Django-React Integration.

class smarter.apps.dashboard.views.passthrough.api.urls.PassthroughApiReverseNames[source]

Bases: object

Reverse view names for the Prompt Passthrough’s endpoints in the web console’s api.

Example

from smarter.lib.django.shortcuts import reverse

url = reverse(PassthroughApiReverseNames.namespace, PassthroughApiReverseNames.api_providers)
api_providers = 'provider_api_view'
namespace = 'api:web:dashboard:passthrough'