diff --git a/crates/openfang-api/src/webchat.rs b/crates/openfang-api/src/webchat.rs
index e0f6926f9f..4e4874a448 100644
--- a/crates/openfang-api/src/webchat.rs
+++ b/crates/openfang-api/src/webchat.rs
@@ -14,6 +14,7 @@
use axum::http::header;
use axum::response::IntoResponse;
+use std::sync::LazyLock;
/// Nonce placeholder in compile-time HTML, replaced at request time.
const NONCE_PLACEHOLDER: &str = "__NONCE__";
@@ -120,7 +121,7 @@ pub async fn webchat_page() -> impl IntoResponse {
/// All vendor libraries (Alpine.js, marked.js, highlight.js) are bundled
/// locally — no CDN dependency. Alpine.js is included LAST because it
/// immediately processes x-data directives and fires alpine:init on load.
-const WEBCHAT_HTML: &str = concat!(
+const WEBCHAT_HTML_BASE: &str = concat!(
include_str!("../static/index_head.html"),
"\n",
- include_str!("../static/index_body.html"),
+ include_str!("../static/index_body.html")
+);
+
+const WEBCHAT_SCRIPTS: &str = concat!(
// Vendor libs: marked + highlight first (used by app.js), then Chart.js
"\n",
// App code
"\n",
- "