diff --git a/Cargo.lock b/Cargo.lock index 10b3652..5a95204 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2018,6 +2018,7 @@ dependencies = [ "minijinja", "minijinja-autoreload", "minijinja-contrib", + "minijinja-embed", "plotly", "serde", "serde_json", @@ -2841,6 +2842,12 @@ dependencies = [ "time-tz", ] +[[package]] +name = "minijinja-embed" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290cc928e7ceb953e2e8ad2e5c6b25f5c3cf96f04697c517a2dd78e01c44f5cc" + [[package]] name = "minimal-lexical" version = "0.2.1" diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index 9d7f445..240fca6 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -31,3 +31,7 @@ tempfile = "3.12.0" url = { version = "2.5.2", features = ["serde"] } uuid = { version = "1.10.0", features = ["v4", "serde"] } +minijinja = { version = "2.5.0", features = ["loader", "multi_template"] } +minijinja-autoreload = "2.5.0" +minijinja-embed = { version = "2.8.0" } +minijinja-contrib = { version = "2.6.0", features = ["datetime", "timezone"] } diff --git a/crates/common/src/utils/mailer.rs b/crates/common/src/utils/mailer.rs deleted file mode 100644 index 8b13789..0000000 --- a/crates/common/src/utils/mailer.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/common/src/utils/mod.rs b/crates/common/src/utils/mod.rs index 4bb2caa..10b3f33 100644 --- a/crates/common/src/utils/mod.rs +++ b/crates/common/src/utils/mod.rs @@ -1,3 +1,3 @@ pub mod config; pub mod embedding; -pub mod mailer; +pub mod template_engine; diff --git a/crates/common/src/utils/template_engine.rs b/crates/common/src/utils/template_engine.rs new file mode 100644 index 0000000..715a8f1 --- /dev/null +++ b/crates/common/src/utils/template_engine.rs @@ -0,0 +1,92 @@ +pub use minijinja::{path_loader, Environment, Value}; +pub use minijinja_autoreload::AutoReloader; +pub use minijinja_contrib; +pub use minijinja_embed; +use std::sync::Arc; + +#[derive(Clone)] +pub enum TemplateEngine { + // Use AutoReload for debug builds (debug_assertions is true) + #[cfg(debug_assertions)] + AutoReload(Arc), + // Use Embedded for release builds (debug_assertions is false) + #[cfg(not(debug_assertions))] + Embedded(Arc>), +} + +#[macro_export] +macro_rules! create_template_engine { + // Macro takes the relative path to the templates dir as input + ($relative_path:expr) => {{ + // Code for debug builds (AutoReload) + #[cfg(debug_assertions)] + { + // These lines execute in the CALLING crate's context + let crate_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let template_path = crate_dir.join($relative_path); + let reloader = $crate::utils::template_engine::AutoReloader::new(move |notifier| { + let mut env = $crate::utils::template_engine::Environment::new(); + env.set_loader($crate::utils::template_engine::path_loader(&template_path)); + notifier.set_fast_reload(true); + notifier.watch_path(&template_path, true); + // Add contrib filters/functions + $crate::utils::template_engine::minijinja_contrib::add_to_environment(&mut env); + Ok(env) + }); + $crate::utils::template_engine::TemplateEngine::AutoReload(std::sync::Arc::new( + reloader, + )) + } + // Code for release builds (Embedded) + #[cfg(not(debug_assertions))] + { + // These lines also execute in the CALLING crate's context + let mut env = $crate::utils::template_engine::Environment::new(); + $crate::utils::template_engine::minijinja_embed::load_templates!(&mut env); + // Add contrib filters/functions + $crate::utils::template_engine::minijinja_contrib::add_to_environment(&mut env); + $crate::utils::template_engine::TemplateEngine::Embedded(std::sync::Arc::new(env)) + } + }}; +} + +impl TemplateEngine { + pub fn render(&self, name: &str, ctx: &Value) -> Result { + match self { + // Only compile this arm for debug builds + #[cfg(debug_assertions)] + TemplateEngine::AutoReload(reloader) => { + let env = reloader.acquire_env()?; + env.get_template(name)?.render(ctx) + } + // Only compile this arm for release builds + #[cfg(not(debug_assertions))] + TemplateEngine::Embedded(env) => env.get_template(name)?.render(ctx), + } + } + + pub fn render_block( + &self, + template_name: &str, + block_name: &str, + context: &Value, + ) -> Result { + match self { + // Only compile this arm for debug builds + #[cfg(debug_assertions)] + TemplateEngine::AutoReload(reloader) => { + let env = reloader.acquire_env()?; + let template = env.get_template(template_name)?; + let mut state = template.eval_to_state(context)?; + state.render_block(block_name) + } + // Only compile this arm for release builds + #[cfg(not(debug_assertions))] + TemplateEngine::Embedded(env) => { + let template = env.get_template(template_name)?; + let mut state = template.eval_to_state(context)?; + state.render_block(block_name) + } + } + } +} diff --git a/crates/html-router/Cargo.toml b/crates/html-router/Cargo.toml index a37724a..c337bdb 100644 --- a/crates/html-router/Cargo.toml +++ b/crates/html-router/Cargo.toml @@ -24,6 +24,7 @@ async-stream = "0.3.6" json-stream-parser = "0.1.4" minijinja = { version = "2.5.0", features = ["loader", "multi_template"] } minijinja-autoreload = "2.5.0" +minijinja-embed = { version = "2.8.0" } minijinja-contrib = { version = "2.6.0", features = ["datetime", "timezone"] } plotly = "0.12.1" surrealdb = "2.0.4" @@ -32,3 +33,6 @@ chrono-tz = "0.10.1" common = { path = "../common" } composite-retrieval = { path = "../composite-retrieval" } + +[build-dependencies] +minijinja-embed = { version = "2.8.0" } diff --git a/crates/html-router/build.rs b/crates/html-router/build.rs new file mode 100644 index 0000000..b13320e --- /dev/null +++ b/crates/html-router/build.rs @@ -0,0 +1,12 @@ +fn main() { + // Get the build profile ("debug" or "release") + let profile = std::env::var("PROFILE").unwrap_or_else(|_| "debug".to_string()); + + // Embed templates only for release builds + if profile == "release" { + // Embed templates from the "templates" directory relative to CARGO_MANIFEST_DIR + minijinja_embed::embed_templates!("templates"); + } else { + println!("cargo:info=Build: Skipping template embedding for debug build."); + } +} diff --git a/crates/html-router/src/html_state.rs b/crates/html-router/src/html_state.rs index 760d649..6cd5904 100644 --- a/crates/html-router/src/html_state.rs +++ b/crates/html-router/src/html_state.rs @@ -1,10 +1,9 @@ use axum_session::SessionStore; use axum_session_surreal::SessionSurrealPool; +use common::create_template_engine; use common::storage::db::SurrealDbClient; use common::utils::config::AppConfig; -use minijinja::{path_loader, Environment}; -use minijinja_autoreload::AutoReloader; -use std::path::PathBuf; +use common::utils::template_engine::TemplateEngine; use std::sync::Arc; use surrealdb::engine::any::Any; @@ -12,22 +11,13 @@ use surrealdb::engine::any::Any; pub struct HtmlState { pub db: Arc, pub openai_client: Arc>, - pub templates: Arc, + pub templates: Arc, pub session_store: Arc>>, } impl HtmlState { pub async fn new(config: &AppConfig) -> Result> { - let reloader = AutoReloader::new(move |notifier| { - let template_path = get_templates_dir(); - let mut env = Environment::new(); - env.set_loader(path_loader(&template_path)); - - notifier.set_fast_reload(true); - notifier.watch_path(&template_path, true); - minijinja_contrib::add_to_environment(&mut env); - Ok(env) - }); + let template_engine = create_template_engine!("templates"); let surreal_db_client = Arc::new( SurrealDbClient::new( @@ -48,7 +38,7 @@ impl HtmlState { let app_state = HtmlState { db: surreal_db_client.clone(), - templates: Arc::new(reloader), + templates: Arc::new(template_engine), openai_client: openai_client.clone(), session_store, }; @@ -56,23 +46,3 @@ impl HtmlState { Ok(app_state) } } - -pub fn get_workspace_root() -> PathBuf { - // Starts from CARGO_MANIFEST_DIR (e.g., /project/crates/html-router/) - let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - - // Navigate up to /path/to/project/crates - let crates_dir = manifest_dir - .parent() - .expect("Failed to find parent of manifest directory"); - - // Navigate up to workspace root - crates_dir - .parent() - .expect("Failed to find workspace root") - .to_path_buf() -} - -pub fn get_templates_dir() -> PathBuf { - get_workspace_root().join("templates") -} diff --git a/crates/html-router/src/middlewares/response_middleware.rs b/crates/html-router/src/middlewares/response_middleware.rs index e813b51..8651394 100644 --- a/crates/html-router/src/middlewares/response_middleware.rs +++ b/crates/html-router/src/middlewares/response_middleware.rs @@ -1,3 +1,4 @@ +use crate::html_state::HtmlState; use axum::{ extract::State, http::StatusCode, @@ -6,19 +7,15 @@ use axum::{ }; use common::error::AppError; use minijinja::{context, Value}; -use minijinja_autoreload::AutoReloader; use serde::Serialize; -use std::sync::Arc; +use tracing::error; -use crate::html_state::HtmlState; - -// Enum for template types #[derive(Clone)] pub enum TemplateKind { - Full(String), // Full page template - Partial(String, String), // Template name, block name - Error(StatusCode), // Error template with status code - Redirect(String), // Redirect + Full(String), + Partial(String, String), + Error(StatusCode), + Redirect(String), } #[derive(Clone)] @@ -53,14 +50,12 @@ impl TemplateResponse { error => error, description => description }; - Self { template_kind: TemplateKind::Error(status), context: ctx, } } - // Convenience methods for common errors pub fn not_found() -> Self { Self::error( StatusCode::NOT_FOUND, @@ -118,25 +113,33 @@ struct TemplateStateWrapper { impl IntoResponse for TemplateStateWrapper { fn into_response(self) -> Response { - let templates = self.state.templates; + let template_engine = &self.state.templates; match &self.template_response.template_kind { TemplateKind::Full(name) => { - render_template(name, self.template_response.context, templates) + match template_engine.render(name, &self.template_response.context) { + Ok(html) => Html(html).into_response(), + Err(e) => { + error!("Failed to render template: {:?}", e); + (StatusCode::INTERNAL_SERVER_ERROR, fallback_error()).into_response() + } + } } - TemplateKind::Partial(name, block) => { - render_block(name, block, self.template_response.context, templates) + TemplateKind::Partial(template, block) => { + match template_engine.render_block(template, block, &self.template_response.context) + { + Ok(html) => Html(html).into_response(), + Err(e) => { + error!("Failed to render block: {:?}", e); + (StatusCode::INTERNAL_SERVER_ERROR, fallback_error()).into_response() + } + } } TemplateKind::Error(status) => { - let html = match try_render_template( - "errors/error.html", - self.template_response.context, - templates, - ) { - Ok(html_string) => Html(html_string), - Err(_) => fallback_error(), - }; - (*status, html).into_response() + match template_engine.render("errors/error.html", &self.template_response.context) { + Ok(html) => (*status, Html(html)).into_response(), + Err(_) => (*status, fallback_error()).into_response(), + } } TemplateKind::Redirect(path) => { (StatusCode::OK, [(axum_htmx::HX_REDIRECT, path.clone())], "").into_response() @@ -145,93 +148,11 @@ impl IntoResponse for TemplateStateWrapper { } } -// Helper functions for rendering with error handling -fn render_template(name: &str, context: Value, templates: Arc) -> Response { - match try_render_template(name, context, templates.clone()) { - Ok(html) => Html(html).into_response(), - Err(_) => fallback_error().into_response(), - } -} - -fn render_block(name: &str, block: &str, context: Value, templates: Arc) -> Response { - match try_render_block(name, block, context, templates.clone()) { - Ok(html) => Html(html).into_response(), - Err(_) => fallback_error().into_response(), - } -} - -fn try_render_template( - template_name: &str, - context: Value, - templates: Arc, -) -> Result { - let env = templates.acquire_env().map_err(|e| { - tracing::error!("Environment error: {:?}", e); - () - })?; - - let tmpl = env.get_template(template_name).map_err(|e| { - tracing::error!("Template error: {:?}", e); - () - })?; - - tmpl.render(context).map_err(|e| { - tracing::error!("Render error: {:?}", e); - () - }) -} - -fn try_render_block( - template_name: &str, - block: &str, - context: Value, - templates: Arc, -) -> Result { - let env = templates.acquire_env().map_err(|e| { - tracing::error!("Environment error: {:?}", e); - () - })?; - - let tmpl = env.get_template(template_name).map_err(|e| { - tracing::error!("Template error: {:?}", e); - () - })?; - - let mut state = tmpl.eval_to_state(context).map_err(|e| { - tracing::error!("Eval error: {:?}", e); - () - })?; - - state.render_block(block).map_err(|e| { - tracing::error!("Block render error: {:?}", e); - () - }) -} - -fn fallback_error() -> Html { - Html( - r#" - - -
-

Error

-

Sorry, something went wrong displaying this page.

-
- - - "# - .to_string(), - ) -} - pub async fn with_template_response( State(state): State, response: Response, ) -> Response { - // Clone the TemplateResponse from extensions - let template_response = response.extensions().get::().cloned(); - - if let Some(template_response) = template_response { + if let Some(template_response) = response.extensions().get::().cloned() { TemplateStateWrapper { state, template_response, @@ -242,40 +163,60 @@ pub async fn with_template_response( } } -// Define HtmlError +#[derive(Debug)] pub enum HtmlError { AppError(AppError), + TemplateError(String), } -// Conversion from AppError to HtmlError impl From for HtmlError { fn from(err: AppError) -> Self { HtmlError::AppError(err) } } -// Conversion for database error to HtmlError impl From for HtmlError { fn from(err: surrealdb::Error) -> Self { HtmlError::AppError(AppError::from(err)) } } +impl From for HtmlError { + fn from(err: minijinja::Error) -> Self { + HtmlError::TemplateError(err.to_string()) + } +} + impl IntoResponse for HtmlError { fn into_response(self) -> Response { match self { - HtmlError::AppError(err) => { - let template_response = match err { - AppError::NotFound(_) => TemplateResponse::not_found(), - AppError::Auth(_) => TemplateResponse::unauthorized(), - AppError::Validation(msg) => TemplateResponse::bad_request(&msg), - _ => { - tracing::error!("Internal error: {:?}", err); - TemplateResponse::server_error() - } - }; - template_response.into_response() + HtmlError::AppError(err) => match err { + AppError::NotFound(_) => TemplateResponse::not_found().into_response(), + AppError::Auth(_) => TemplateResponse::unauthorized().into_response(), + AppError::Validation(msg) => TemplateResponse::bad_request(&msg).into_response(), + _ => { + error!("Internal error: {:?}", err); + TemplateResponse::server_error().into_response() + } + }, + HtmlError::TemplateError(err) => { + error!("Template error: {}", err); + TemplateResponse::server_error().into_response() } } } } + +fn fallback_error() -> String { + r#" + + +
+

Error

+

Sorry, something went wrong displaying this page.

+
+ + + "# + .to_string() +} diff --git a/crates/html-router/src/routes/chat/message_response_stream.rs b/crates/html-router/src/routes/chat/message_response_stream.rs index ef6ac2b..a548e6c 100644 --- a/crates/html-router/src/routes/chat/message_response_stream.rs +++ b/crates/html-router/src/routes/chat/message_response_stream.rs @@ -22,23 +22,24 @@ use futures::{ Stream, StreamExt, TryStreamExt, }; use json_stream_parser::JsonStreamParser; +use minijinja::Value; use serde::{Deserialize, Serialize}; use serde_json::from_str; use surrealdb::{engine::any::Any, Surreal}; use tokio::sync::{mpsc::channel, Mutex}; -use tracing::{error, debug}; +use tracing::{debug, error}; use common::storage::{ db::SurrealDbClient, types::{ conversation::Conversation, message::{Message, MessageRole}, - user::User, system_settings::SystemSettings, + user::User, }, }; -use crate::{html_state::HtmlState, routes::render_template}; +use crate::html_state::HtmlState; // Error handling function fn create_error_stream( @@ -272,17 +273,13 @@ pub async fn get_response_stream( } // Render template with references - match render_template( + match state.templates.render( "chat/reference_list.html", - ReferenceData { message }, - state.templates.clone(), + &Value::from_serialize(ReferenceData { message }), ) { Ok(html) => { - // Extract the String from Html - let html_string = html.0; - // Return the rendered HTML - Ok(Event::default().event("references").data(html_string)) + Ok(Event::default().event("references").data(html)) } Err(_) => { // Handle template rendering error diff --git a/crates/html-router/src/routes/mod.rs b/crates/html-router/src/routes/mod.rs index 1ae8e9f..331219f 100644 --- a/crates/html-router/src/routes/mod.rs +++ b/crates/html-router/src/routes/mod.rs @@ -1,10 +1,3 @@ -use std::sync::Arc; - -use axum::response::Html; -use minijinja_autoreload::AutoReloader; - -use crate::middlewares::response_middleware::HtmlError; - pub mod account; pub mod admin; pub mod auth; @@ -14,20 +7,3 @@ pub mod index; pub mod ingestion; pub mod knowledge; pub mod search; - -// Helper function for render_template -pub fn render_template( - template_name: &str, - context: T, - templates: Arc, -) -> Result, HtmlError> -where - T: serde::Serialize, -{ - let env = templates.acquire_env().unwrap(); - let tmpl = env.get_template(template_name).unwrap(); - let context = minijinja::Value::from_serialize(&context); - let output = tmpl.render(context).unwrap(); - - Ok(Html(output)) -} diff --git a/templates/admin/edit_ingestion_prompt_modal.html b/crates/html-router/templates/admin/edit_ingestion_prompt_modal.html similarity index 100% rename from templates/admin/edit_ingestion_prompt_modal.html rename to crates/html-router/templates/admin/edit_ingestion_prompt_modal.html diff --git a/templates/admin/edit_query_prompt_modal.html b/crates/html-router/templates/admin/edit_query_prompt_modal.html similarity index 100% rename from templates/admin/edit_query_prompt_modal.html rename to crates/html-router/templates/admin/edit_query_prompt_modal.html diff --git a/templates/auth/account_settings.html b/crates/html-router/templates/auth/account_settings.html similarity index 100% rename from templates/auth/account_settings.html rename to crates/html-router/templates/auth/account_settings.html diff --git a/templates/auth/admin_panel.html b/crates/html-router/templates/auth/admin_panel.html similarity index 100% rename from templates/auth/admin_panel.html rename to crates/html-router/templates/auth/admin_panel.html diff --git a/templates/auth/change_password_form.html b/crates/html-router/templates/auth/change_password_form.html similarity index 100% rename from templates/auth/change_password_form.html rename to crates/html-router/templates/auth/change_password_form.html diff --git a/templates/auth/signin_form.html b/crates/html-router/templates/auth/signin_form.html similarity index 100% rename from templates/auth/signin_form.html rename to crates/html-router/templates/auth/signin_form.html diff --git a/templates/auth/signup_form.html b/crates/html-router/templates/auth/signup_form.html similarity index 100% rename from templates/auth/signup_form.html rename to crates/html-router/templates/auth/signup_form.html diff --git a/templates/body_base.html b/crates/html-router/templates/body_base.html similarity index 100% rename from templates/body_base.html rename to crates/html-router/templates/body_base.html diff --git a/templates/chat/base.html b/crates/html-router/templates/chat/base.html similarity index 100% rename from templates/chat/base.html rename to crates/html-router/templates/chat/base.html diff --git a/templates/chat/drawer.html b/crates/html-router/templates/chat/drawer.html similarity index 100% rename from templates/chat/drawer.html rename to crates/html-router/templates/chat/drawer.html diff --git a/templates/chat/history.html b/crates/html-router/templates/chat/history.html similarity index 100% rename from templates/chat/history.html rename to crates/html-router/templates/chat/history.html diff --git a/templates/chat/new_chat_first_response.html b/crates/html-router/templates/chat/new_chat_first_response.html similarity index 100% rename from templates/chat/new_chat_first_response.html rename to crates/html-router/templates/chat/new_chat_first_response.html diff --git a/templates/chat/new_message_form.html b/crates/html-router/templates/chat/new_message_form.html similarity index 100% rename from templates/chat/new_message_form.html rename to crates/html-router/templates/chat/new_message_form.html diff --git a/templates/chat/reference_list.html b/crates/html-router/templates/chat/reference_list.html similarity index 100% rename from templates/chat/reference_list.html rename to crates/html-router/templates/chat/reference_list.html diff --git a/templates/chat/reference_tooltip.html b/crates/html-router/templates/chat/reference_tooltip.html similarity index 100% rename from templates/chat/reference_tooltip.html rename to crates/html-router/templates/chat/reference_tooltip.html diff --git a/templates/chat/streaming_response.html b/crates/html-router/templates/chat/streaming_response.html similarity index 100% rename from templates/chat/streaming_response.html rename to crates/html-router/templates/chat/streaming_response.html diff --git a/templates/content/base.html b/crates/html-router/templates/content/base.html similarity index 100% rename from templates/content/base.html rename to crates/html-router/templates/content/base.html diff --git a/templates/content/content_list.html b/crates/html-router/templates/content/content_list.html similarity index 100% rename from templates/content/content_list.html rename to crates/html-router/templates/content/content_list.html diff --git a/templates/content/edit_text_content_modal.html b/crates/html-router/templates/content/edit_text_content_modal.html similarity index 100% rename from templates/content/edit_text_content_modal.html rename to crates/html-router/templates/content/edit_text_content_modal.html diff --git a/templates/documentation/base.html b/crates/html-router/templates/documentation/base.html similarity index 100% rename from templates/documentation/base.html rename to crates/html-router/templates/documentation/base.html diff --git a/templates/documentation/get_started.html b/crates/html-router/templates/documentation/get_started.html similarity index 100% rename from templates/documentation/get_started.html rename to crates/html-router/templates/documentation/get_started.html diff --git a/templates/documentation/index.html b/crates/html-router/templates/documentation/index.html similarity index 100% rename from templates/documentation/index.html rename to crates/html-router/templates/documentation/index.html diff --git a/templates/documentation/menu.html b/crates/html-router/templates/documentation/menu.html similarity index 100% rename from templates/documentation/menu.html rename to crates/html-router/templates/documentation/menu.html diff --git a/templates/documentation/mobile_friendly.html b/crates/html-router/templates/documentation/mobile_friendly.html similarity index 100% rename from templates/documentation/mobile_friendly.html rename to crates/html-router/templates/documentation/mobile_friendly.html diff --git a/templates/documentation/privacy.html b/crates/html-router/templates/documentation/privacy.html similarity index 100% rename from templates/documentation/privacy.html rename to crates/html-router/templates/documentation/privacy.html diff --git a/templates/errors/error.html b/crates/html-router/templates/errors/error.html similarity index 100% rename from templates/errors/error.html rename to crates/html-router/templates/errors/error.html diff --git a/templates/gdpr.html b/crates/html-router/templates/gdpr.html similarity index 100% rename from templates/gdpr.html rename to crates/html-router/templates/gdpr.html diff --git a/templates/head_base.html b/crates/html-router/templates/head_base.html similarity index 100% rename from templates/head_base.html rename to crates/html-router/templates/head_base.html diff --git a/templates/icons/chat_icon.html b/crates/html-router/templates/icons/chat_icon.html similarity index 100% rename from templates/icons/chat_icon.html rename to crates/html-router/templates/icons/chat_icon.html diff --git a/templates/icons/chevron_icon.html b/crates/html-router/templates/icons/chevron_icon.html similarity index 100% rename from templates/icons/chevron_icon.html rename to crates/html-router/templates/icons/chevron_icon.html diff --git a/templates/icons/clipboard_icon.html b/crates/html-router/templates/icons/clipboard_icon.html similarity index 100% rename from templates/icons/clipboard_icon.html rename to crates/html-router/templates/icons/clipboard_icon.html diff --git a/templates/icons/delete_icon.html b/crates/html-router/templates/icons/delete_icon.html similarity index 100% rename from templates/icons/delete_icon.html rename to crates/html-router/templates/icons/delete_icon.html diff --git a/templates/icons/document_icon.html b/crates/html-router/templates/icons/document_icon.html similarity index 100% rename from templates/icons/document_icon.html rename to crates/html-router/templates/icons/document_icon.html diff --git a/templates/icons/edit_icon.html b/crates/html-router/templates/icons/edit_icon.html similarity index 100% rename from templates/icons/edit_icon.html rename to crates/html-router/templates/icons/edit_icon.html diff --git a/templates/icons/globe_icon.html b/crates/html-router/templates/icons/globe_icon.html similarity index 100% rename from templates/icons/globe_icon.html rename to crates/html-router/templates/icons/globe_icon.html diff --git a/templates/icons/hamburger_icon.html b/crates/html-router/templates/icons/hamburger_icon.html similarity index 100% rename from templates/icons/hamburger_icon.html rename to crates/html-router/templates/icons/hamburger_icon.html diff --git a/templates/icons/refresh_icon.html b/crates/html-router/templates/icons/refresh_icon.html similarity index 100% rename from templates/icons/refresh_icon.html rename to crates/html-router/templates/icons/refresh_icon.html diff --git a/templates/icons/send_icon.html b/crates/html-router/templates/icons/send_icon.html similarity index 100% rename from templates/icons/send_icon.html rename to crates/html-router/templates/icons/send_icon.html diff --git a/templates/index/hero.html b/crates/html-router/templates/index/hero.html similarity index 100% rename from templates/index/hero.html rename to crates/html-router/templates/index/hero.html diff --git a/templates/index/index.html b/crates/html-router/templates/index/index.html similarity index 100% rename from templates/index/index.html rename to crates/html-router/templates/index/index.html diff --git a/templates/index/signed_in/active_jobs.html b/crates/html-router/templates/index/signed_in/active_jobs.html similarity index 100% rename from templates/index/signed_in/active_jobs.html rename to crates/html-router/templates/index/signed_in/active_jobs.html diff --git a/templates/index/signed_in/base.html b/crates/html-router/templates/index/signed_in/base.html similarity index 100% rename from templates/index/signed_in/base.html rename to crates/html-router/templates/index/signed_in/base.html diff --git a/templates/index/signed_in/ingress_modal.html b/crates/html-router/templates/index/signed_in/ingress_modal.html similarity index 100% rename from templates/index/signed_in/ingress_modal.html rename to crates/html-router/templates/index/signed_in/ingress_modal.html diff --git a/templates/index/signed_in/quick_actions.html b/crates/html-router/templates/index/signed_in/quick_actions.html similarity index 100% rename from templates/index/signed_in/quick_actions.html rename to crates/html-router/templates/index/signed_in/quick_actions.html diff --git a/templates/index/signed_in/recent_content.html b/crates/html-router/templates/index/signed_in/recent_content.html similarity index 100% rename from templates/index/signed_in/recent_content.html rename to crates/html-router/templates/index/signed_in/recent_content.html diff --git a/templates/index/signed_in/search_response.html b/crates/html-router/templates/index/signed_in/search_response.html similarity index 100% rename from templates/index/signed_in/search_response.html rename to crates/html-router/templates/index/signed_in/search_response.html diff --git a/templates/index/signed_in/searchbar.html b/crates/html-router/templates/index/signed_in/searchbar.html similarity index 100% rename from templates/index/signed_in/searchbar.html rename to crates/html-router/templates/index/signed_in/searchbar.html diff --git a/templates/knowledge/base.html b/crates/html-router/templates/knowledge/base.html similarity index 100% rename from templates/knowledge/base.html rename to crates/html-router/templates/knowledge/base.html diff --git a/templates/knowledge/edit_knowledge_entity_modal.html b/crates/html-router/templates/knowledge/edit_knowledge_entity_modal.html similarity index 100% rename from templates/knowledge/edit_knowledge_entity_modal.html rename to crates/html-router/templates/knowledge/edit_knowledge_entity_modal.html diff --git a/templates/knowledge/entity_list.html b/crates/html-router/templates/knowledge/entity_list.html similarity index 100% rename from templates/knowledge/entity_list.html rename to crates/html-router/templates/knowledge/entity_list.html diff --git a/templates/knowledge/relationship_table.html b/crates/html-router/templates/knowledge/relationship_table.html similarity index 100% rename from templates/knowledge/relationship_table.html rename to crates/html-router/templates/knowledge/relationship_table.html diff --git a/templates/modal_base.html b/crates/html-router/templates/modal_base.html similarity index 100% rename from templates/modal_base.html rename to crates/html-router/templates/modal_base.html diff --git a/templates/navigation_bar.html b/crates/html-router/templates/navigation_bar.html similarity index 100% rename from templates/navigation_bar.html rename to crates/html-router/templates/navigation_bar.html diff --git a/templates/scripts/theme-toggle.js b/crates/html-router/templates/scripts/theme-toggle.js similarity index 100% rename from templates/scripts/theme-toggle.js rename to crates/html-router/templates/scripts/theme-toggle.js diff --git a/templates/search_result.html b/crates/html-router/templates/search_result.html similarity index 100% rename from templates/search_result.html rename to crates/html-router/templates/search_result.html diff --git a/templates/theme_toggle.html b/crates/html-router/templates/theme_toggle.html similarity index 81% rename from templates/theme_toggle.html rename to crates/html-router/templates/theme_toggle.html index c8376d6..c5cced1 100644 --- a/templates/theme_toggle.html +++ b/crates/html-router/templates/theme_toggle.html @@ -3,13 +3,15 @@ - + - + diff --git a/templates/email/email_verification.html b/templates/email/email_verification.html deleted file mode 100644 index 0e924c4..0000000 --- a/templates/email/email_verification.html +++ /dev/null @@ -1,77 +0,0 @@ -{# email_verification.html #} - - - - - - Email Verification - - - -
-
-

Email Verification

-
- -
-

Hello {{ name }},

-

Please use the following verification code to complete your registration:

- -
- {{ verification_code }} -
- -

This code will expire in 30 minutes.

-
- - -
- - - diff --git a/templates/email/email_verification.txt b/templates/email/email_verification.txt deleted file mode 100644 index 43d171b..0000000 --- a/templates/email/email_verification.txt +++ /dev/null @@ -1,20 +0,0 @@ -{# email_verification.txt #} -Hello {{ name }}, - -Thank you for registering. To complete your registration, please use the following verification code: - -{{ verification_code }} - -This code will expire in 30 minutes. - -IMPORTANT SECURITY INFORMATION: -- If you didn't request this verification code, please ignore this email. -- Never share this code with anyone, including those claiming to be from our support team. -- This is an automated message, please do not reply to this email. - -For your security, if you did not initiate this request, you can safely ignore this email. Someone might have entered your email address by mistake. - -Best regards, -Your Company Name - -© 2024 Your Company Name. All rights reserved. diff --git a/todo.md b/todo.md index 3917459..8c9b88b 100644 --- a/todo.md +++ b/todo.md @@ -1,13 +1,12 @@ \[\] archive ingressed webpage -\[\] openai api key in config -\[x\] option to set models, query and processing -\[x\] template customization? \[\] configs primarily get envs \[\] filtering on categories +\[\] integrate assets folder in release build +\[\] integrate templates in release build +\[\] markdown rendering in client +\[\] openai api key in config \[\] three js graph explorer \[\] three js vector explorer -\[\] integrate templates in release build -\[\] integrate assets folder in release build \[x\] add user_id to ingress objects \[x\] admin controls re registration \[x\] chat functionality @@ -22,9 +21,11 @@ \[x\] link to ingressed urls or archives \[x\] macro for pagedata? \[x\] on updates of knowledgeentity create new embeddings +\[x\] option to set models, query and processing \[x\] redirects \[x\] restrict retrieval to users own objects \[x\] smoothie_dom test +\[x\] template customization? \[x\] templating \[x\] user id to fileinfo and data path? \[x\] view content