Example Django Template for React Integration
The template of the page at a deployed LLMClient’s url, which mounts @smarter/llmclient-deployment
{% extends 'base.html' %}
{% load static react_llmclient_deployment %}
{% comment %}
The page that a browser sees at a deployed LLMClient's endpoints: the @smarter/llmclient-deployment React
app, in its public mode, which the workbench's "Deployment" tab shows too, in its workbench mode. Its data,
an LLMClientDeploymentPage without the owner or the api keys, is in a json_script.
See smarter.apps.llmclient.views.endpoints.LLMClientEndpointsView.
{% endcomment %}
{% block head_extra %}
{{ block.super }}
<!--
Vite assets for the LLMClient deployment app
see: smarter.apps.llmclient.templatetags.react_llmclient_deployment.
reads the React manifest.json file to determine the correct hashed filenames to include.
-->
{% llmclient_deployment_react_assets as assets %}
{% for css_file in assets.css %}
<link class="smarter" rel="stylesheet" href="{% static 'react/@smarter/llmclient-deployment/' %}{{ css_file }}">
{% endfor %}
{% endblock %}
{% block root %}
{{ deployment|json_script:deployment_data_id }}
<div
id="{{ deployment_root_id }}"
class="d-flex flex-column w-100"
smarter-deployment-data-id="{{ deployment_data_id }}"
react-debug-mode="{{ react_debug_mode }}"
>
</div>
{% endblock %}
{% block javascript_extra %}
{{ block.super }}
{% llmclient_deployment_react_assets as assets %}
{% for js_file in assets.js %}
<script class="smarter" type="module" src="{% static 'react/@smarter/llmclient-deployment/' %}{{ js_file }}"></script>
{% endfor %}
{% endblock %}