diff --git a/html-router/src/html_state.rs b/html-router/src/html_state.rs index f05453e..4396d2d 100644 --- a/html-router/src/html_state.rs +++ b/html-router/src/html_state.rs @@ -29,15 +29,17 @@ impl HtmlState { config: AppConfig, reranker_pool: Option>, embedding_provider: Arc, + template_engine: Option>, ) -> Result> { - let template_engine = create_template_engine!("templates"); - debug!("Template engine created for html_router."); + let templates = + template_engine.unwrap_or_else(|| Arc::new(create_template_engine!("templates"))); + debug!("Template engine configured for html_router."); Ok(Self { db, openai_client, session_store, - templates: Arc::new(template_engine), + templates, config, storage, reranker_pool, diff --git a/html-router/templates/admin/_base.html b/html-router/templates/admin/_base.html new file mode 100644 index 0000000..cdd0637 --- /dev/null +++ b/html-router/templates/admin/_base.html @@ -0,0 +1,20 @@ +{% extends 'admin/_layout.html' %} + +{% block admin_navigation %} + + Overview + + + Models + +{% endblock %} + +{% block admin_content %} + {% if current_section == 'models' %} + {% include 'admin/sections/models.html' %} + {% else %} + {% include 'admin/sections/overview.html' %} + {% endif %} +{% endblock %} diff --git a/html-router/templates/admin/_layout.html b/html-router/templates/admin/_layout.html new file mode 100644 index 0000000..0552ed3 --- /dev/null +++ b/html-router/templates/admin/_layout.html @@ -0,0 +1,29 @@ +{% extends 'body_base.html' %} + +{% block title %}Minne - Admin{% endblock %} + +{% block main %} +
+
+
+
+

Admin Controls

+
+
+ Signed in as {{ user.email }} +
+
+ + + +
+ {% block admin_content %} + {% endblock %} +
+
+
+{% endblock %} diff --git a/html-router/templates/admin/base.html b/html-router/templates/admin/base.html index 3339702..b5cc256 100644 --- a/html-router/templates/admin/base.html +++ b/html-router/templates/admin/base.html @@ -1,38 +1 @@ -{% extends 'body_base.html' %} - -{% block title %}Minne - Admin{% endblock %} - -{% block main %} -
-
-
-
-

Admin Controls

-
-
- Signed in as {{ user.email }} -
-
- - - -
- {% if current_section == 'models' %} - {% include 'admin/sections/models.html' %} - {% else %} - {% include 'admin/sections/overview.html' %} - {% endif %} -
-
-
-{% endblock %} \ No newline at end of file +{% extends "admin/_base.html" %} diff --git a/html-router/templates/auth/_account_settings_core.html b/html-router/templates/auth/_account_settings_core.html new file mode 100644 index 0000000..0870e41 --- /dev/null +++ b/html-router/templates/auth/_account_settings_core.html @@ -0,0 +1,72 @@ +{% extends "auth/_settings_layout.html" %} + +{% block settings_header %} +

Account Settings

+{% endblock %} + +{% block settings_left_column %} + + + + + + + +{% endblock %} + +{% block settings_right_column %} +
+ {% block change_password_section %} + + {% endblock %} +
+ +
+ +
+{% endblock %} diff --git a/html-router/templates/auth/_layout.html b/html-router/templates/auth/_layout.html new file mode 100644 index 0000000..479317e --- /dev/null +++ b/html-router/templates/auth/_layout.html @@ -0,0 +1,10 @@ +{% extends "head_base.html" %} + +{% block title %}Minne - Auth{% endblock %} + +{% block body %} +
+ {% block auth_content %} + {% endblock %} +
+{% endblock %} diff --git a/html-router/templates/auth/_settings_layout.html b/html-router/templates/auth/_settings_layout.html new file mode 100644 index 0000000..f8b666c --- /dev/null +++ b/html-router/templates/auth/_settings_layout.html @@ -0,0 +1,32 @@ +{% extends "body_base.html" %} + +{% block title %}Minne - Account{% endblock %} + +{% block main %} +
+
+
+
+ {% block settings_header %} + {% endblock %} +
+
+ +
+ +
+ {% block settings_left_column %} + {% endblock %} +
+ + +
+ {% block settings_right_column %} + {% endblock %} +
+
+ +
+
+
+{% endblock %} diff --git a/html-router/templates/auth/account_settings.html b/html-router/templates/auth/account_settings.html index 894f86a..9613a9d 100644 --- a/html-router/templates/auth/account_settings.html +++ b/html-router/templates/auth/account_settings.html @@ -1,88 +1 @@ -{% extends "body_base.html" %} - -{% block title %}Minne - Account{% endblock %} - -{% block main %} -
-
-
-
-

Account Settings

-
-
- -
- -
- - - - - - - -
- - -
-
- {% block change_password_section %} - - {% endblock %} -
- -
- -
-
-
- -
-
-
-{% endblock %} +{% extends "auth/_account_settings_core.html" %} diff --git a/html-router/templates/auth/signin_base.html b/html-router/templates/auth/signin_base.html index f23df4e..106ed3e 100644 --- a/html-router/templates/auth/signin_base.html +++ b/html-router/templates/auth/signin_base.html @@ -1,9 +1,7 @@ -{% extends "head_base.html" %} +{% extends "auth/_layout.html" %} {% block title %}Minne - Sign in{% endblock %} -{% block body %} -
+{% block auth_content %} {% include "auth/signin_form.html" %} -
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/html-router/templates/auth/signup_form.html b/html-router/templates/auth/signup_form.html index 479105b..a7ac341 100644 --- a/html-router/templates/auth/signup_form.html +++ b/html-router/templates/auth/signup_form.html @@ -1,9 +1,8 @@ -{% extends "head_base.html" %} +{% extends "auth/_layout.html" %} {% block title %}Minne - Sign up{% endblock %} -{% block body %} -
+{% block auth_content %}
@@ -46,10 +45,9 @@
-
- + {% endblock %} diff --git a/html-router/templates/chat/_layout.html b/html-router/templates/chat/_layout.html new file mode 100644 index 0000000..654f246 --- /dev/null +++ b/html-router/templates/chat/_layout.html @@ -0,0 +1,78 @@ +{% extends 'body_base.html' %} + +{% block title %}Minne - Chat{% endblock %} + +{% block main %} +
+
+
+
+ {% block chat_header_actions %} + {% endblock %} +
+
+
+ {% block chat_content %} + {% endblock %} +
+
+
+ + +{% endblock %} diff --git a/html-router/templates/chat/base.html b/html-router/templates/chat/base.html index 8702a97..542c39e 100644 --- a/html-router/templates/chat/base.html +++ b/html-router/templates/chat/base.html @@ -1,81 +1,14 @@ -{% extends 'body_base.html' %} +{% extends "chat/_layout.html" %} -{% block title %}Minne - Chat{% endblock %} +{% block chat_header_actions %} +

Chat

+
Converse with your knowledge
+{% endblock %} -{% block main %} -
-
-
-
-

Chat

-
Converse with your knowledge
-
-
-
- {% include "chat/history.html" %} -
-
-
- - +{% block chat_content %} + {% include "chat/history.html" %} {% endblock %} {% block overlay %} -{% include "chat/new_message_form.html" %} + {% include "chat/new_message_form.html" %} {% endblock %} diff --git a/html-router/templates/components/_icon_macro.html b/html-router/templates/components/_icon_macro.html new file mode 100644 index 0000000..b30127a --- /dev/null +++ b/html-router/templates/components/_icon_macro.html @@ -0,0 +1,15 @@ +{% macro icon(name) %} +{% if name == "home" %} +{% include "icons/home_icon.html" %} +{% elif name == "book" %} +{% include "icons/book_icon.html" %} +{% elif name == "document" %} +{% include "icons/document_icon.html" %} +{% elif name == "chat" %} +{% include "icons/chat_icon.html" %} +{% elif name == "search" %} +{% include "icons/search_icon.html" %} +{% elif name == "scratchpad" %} +{% include "icons/scratchpad_icon.html" %} +{% endif %} +{% endmacro %} diff --git a/html-router/templates/components/_navbar_layout.html b/html-router/templates/components/_navbar_layout.html new file mode 100644 index 0000000..72ab52d --- /dev/null +++ b/html-router/templates/components/_navbar_layout.html @@ -0,0 +1,14 @@ + diff --git a/html-router/templates/components/_sidebar_layout.html b/html-router/templates/components/_sidebar_layout.html new file mode 100644 index 0000000..614133f --- /dev/null +++ b/html-router/templates/components/_sidebar_layout.html @@ -0,0 +1,60 @@ +
+ + + +
diff --git a/html-router/templates/content/_layout.html b/html-router/templates/content/_layout.html new file mode 100644 index 0000000..aa507ac --- /dev/null +++ b/html-router/templates/content/_layout.html @@ -0,0 +1,17 @@ +{% extends 'body_base.html' %} + +{% block title %}Minne - Content{% endblock %} + +{% block main %} +
+
+
+ {% block content_header %} + {% endblock %} +
+ + {% block content_list %} + {% endblock %} +
+
+{% endblock %} diff --git a/html-router/templates/content/base.html b/html-router/templates/content/base.html index bdbfde7..388cea3 100644 --- a/html-router/templates/content/base.html +++ b/html-router/templates/content/base.html @@ -1,29 +1,23 @@ -{% extends 'body_base.html' %} +{% extends 'content/_layout.html' %} -{% block title %}Minne - Content{% endblock %} - -{% block main %} -
-
-
-

Content

-
- -
- -
- -
+{% block content_header %} +

Content

+
+ +
+
- - {% include "content/content_list.html" %} -
-
+ + +{% endblock %} + +{% block content_list %} + {% include "content/content_list.html" %} {% endblock %} diff --git a/html-router/templates/dashboard/_base.html b/html-router/templates/dashboard/_base.html new file mode 100644 index 0000000..cfc6e0a --- /dev/null +++ b/html-router/templates/dashboard/_base.html @@ -0,0 +1,15 @@ +{% extends "dashboard/_layout.html" %} + +{% block dashboard_header %} +

Dashboard

+ +{% endblock %} + +{% block dashboard_widgets %} + {% include "dashboard/statistics.html" %} + {% include "dashboard/recent_content.html" %} + {% include "dashboard/active_jobs.html" %} +{% endblock %} diff --git a/html-router/templates/dashboard/_layout.html b/html-router/templates/dashboard/_layout.html new file mode 100644 index 0000000..3037659 --- /dev/null +++ b/html-router/templates/dashboard/_layout.html @@ -0,0 +1,21 @@ +{% extends "body_base.html" %} + +{% block title %}Minne - Dashboard{% endblock %} + +{% block main %} +
+
+
+ {% block dashboard_alerts %} + {% endblock %} +
+ {% block dashboard_header %} + {% endblock %} +
+
+ + {% block dashboard_widgets %} + {% endblock %} +
+
+{% endblock %} diff --git a/html-router/templates/dashboard/base.html b/html-router/templates/dashboard/base.html index 6c94239..324d81a 100644 --- a/html-router/templates/dashboard/base.html +++ b/html-router/templates/dashboard/base.html @@ -1,26 +1 @@ -{% extends "body_base.html" %} - -{% block title %}Minne - Dashboard{% endblock %} - -{% block main %} -
-
-
-
-

Dashboard

- -
-
- - {% include "dashboard/statistics.html" %} - - {% include "dashboard/recent_content.html" %} - - {% include "dashboard/active_jobs.html" %} - -
-
-{% endblock %} \ No newline at end of file +{% extends "dashboard/_base.html" %} diff --git a/html-router/templates/errors/_layout.html b/html-router/templates/errors/_layout.html new file mode 100644 index 0000000..66a92bd --- /dev/null +++ b/html-router/templates/errors/_layout.html @@ -0,0 +1,9 @@ +{% extends 'body_base.html' %} +{% block main %} +
+
+ {% block error_content %} + {% endblock %} +
+
+{% endblock %} diff --git a/html-router/templates/errors/error.html b/html-router/templates/errors/error.html index 34b7995..7d0357f 100644 --- a/html-router/templates/errors/error.html +++ b/html-router/templates/errors/error.html @@ -1,13 +1,10 @@ -{% extends 'body_base.html' %} -{% block main %} -
-
-

- {{ status_code }} -

-

{{ title }}

-

{{ description }}

- Go Home -
-
-{% endblock %} \ No newline at end of file +{% extends "errors/_layout.html" %} + +{% block error_content %} +

+ {{ status_code }} +

+

{{ title }}

+

{{ description }}

+ Go Home +{% endblock %} diff --git a/html-router/templates/knowledge/_layout.html b/html-router/templates/knowledge/_layout.html new file mode 100644 index 0000000..48b4f5e --- /dev/null +++ b/html-router/templates/knowledge/_layout.html @@ -0,0 +1,17 @@ +{% extends 'body_base.html' %} + +{% block title %}Minne - Knowledge{% endblock %} + +{% block main %} +
+
+
+ {% block knowledge_header %} + {% endblock %} +
+ + {% block knowledge_content %} + {% endblock %} +
+
+{% endblock %} diff --git a/html-router/templates/knowledge/base.html b/html-router/templates/knowledge/base.html index 7a658c8..d65b5f1 100644 --- a/html-router/templates/knowledge/base.html +++ b/html-router/templates/knowledge/base.html @@ -1,52 +1,46 @@ -{% extends 'body_base.html' %} +{% extends 'knowledge/_layout.html' %} -{% block title %}Minne - Knowledge{% endblock %} - -{% block main %} -
-
-
-
-

Knowledge Entities

- -
-
- -
- -
-
- -
- -
-
- -

Graph

-
-
-
-
- {% include "knowledge/entity_list.html" %} -

Relationships

- {% include "knowledge/relationship_table.html" %} +{% block knowledge_header %} +
+

Knowledge Entities

+
-
-{% endblock %} \ No newline at end of file +
+ +
+ +
+
+ +
+ +
+{% endblock %} + +{% block knowledge_content %} +

Graph

+
+
+
+
+ {% include "knowledge/entity_list.html" %} +

Relationships

+ {% include "knowledge/relationship_table.html" %} +{% endblock %} diff --git a/html-router/templates/navigation_bar.html b/html-router/templates/navigation_bar.html index e4b5302..363db62 100644 --- a/html-router/templates/navigation_bar.html +++ b/html-router/templates/navigation_bar.html @@ -1,15 +1,12 @@ - +{% extends "components/_navbar_layout.html" %} + +{% block navbar_search %} + {% include "searchbar.html" %} +{% endblock %} + +{% block navbar_actions %} + + {% include "theme_toggle.html" %} +{% endblock %} diff --git a/html-router/templates/scratchpad/_layout.html b/html-router/templates/scratchpad/_layout.html new file mode 100644 index 0000000..d171109 --- /dev/null +++ b/html-router/templates/scratchpad/_layout.html @@ -0,0 +1,24 @@ +{% extends 'body_base.html' %} + +{% block title %}Minne - Scratchpad{% endblock %} + +{% block main %} +
+
+ {% block scratchpad_header %} + {% endblock %} + + {% block scratchpad_content %} + {% endblock %} + + {% block scratchpad_archived %} + {% endblock %} +
+
+ +{% if new_scratchpad %} +
+
+
+{% endif %} +{% endblock %} diff --git a/html-router/templates/scratchpad/base.html b/html-router/templates/scratchpad/base.html index a94cc8b..eec3056 100644 --- a/html-router/templates/scratchpad/base.html +++ b/html-router/templates/scratchpad/base.html @@ -1,113 +1,101 @@ -{% extends 'body_base.html' %} +{% extends 'scratchpad/_layout.html' %} -{% block title %}Minne - Scratchpad{% endblock %} +{% block scratchpad_header %} +
+

Scratchpads

+
+ + +
+
+{% endblock %} -{% block main %} -
-
- {% block header %} -
-

Scratchpads

-
- +{% block scratchpad_content %} +
+ {% for scratchpad in scratchpads %} +
+
+

{{ scratchpad.title }}

+
+ + + + +
+
+
+ {{ scratchpad.content[:100] }}{% if scratchpad.content|length > 100 %}...{% endif %} +
+
+ Last saved: {{ scratchpad.last_saved_at | datetimeformat(format="short", tz=user.timezone) }} +
+
+ {% else %} +
+

No scratchpads yet

+

Create your first scratchpad to start jotting down ideas

+
+
- {% endblock %} + {% endfor %} +
+{% endblock %} - {% block content %} -
- {% for scratchpad in scratchpads %} -
-
-

{{ scratchpad.title }}

-
- -
- -
-
-
-
- {{ scratchpad.content[:100] }}{% if scratchpad.content|length > 100 %}...{% endif %} -
-
- Last saved: {{ scratchpad.last_saved_at | datetimeformat(format="short", tz=user.timezone) }} -
-
- {% else %} -
-

No scratchpads yet

-

Create your first scratchpad to start jotting down ideas

-
- - -
-
- {% endfor %} -
- {% endblock %} +{% block scratchpad_archived %} + {% if archived_scratchpads %} +
+
+ + Archived Scratchpads + {{ archived_scratchpads|length }} + - {% if archived_scratchpads %} -
-
- - Archived Scratchpads - {{ archived_scratchpads|length }} - +
Archived scratchpads were ingested into your knowledge base. You can + restore them if you want to keep editing.
-
Archived scratchpads were ingested into your knowledge base. You can - restore them if you want to keep editing.
- -
- {% for scratchpad in archived_scratchpads %} -
-
-
-

{{ scratchpad.title }}

-
Archived {{ scratchpad.archived_at | datetimeformat(format="short", tz=user.timezone) }}
- {% if scratchpad.ingested_at %} -
Ingestion started {{ scratchpad.ingested_at | datetimeformat(format="short", tz=user.timezone) }}
- {% endif %} -
-
-
- -
-
- -
-
+
+ {% for scratchpad in archived_scratchpads %} +
+
+
+

{{ scratchpad.title }}

+
Archived {{ scratchpad.archived_at | datetimeformat(format="short", tz=user.timezone) }}
+ {% if scratchpad.ingested_at %} +
Ingestion started {{ scratchpad.ingested_at | datetimeformat(format="short", tz=user.timezone) }}
+ {% endif %} +
+
+
+ +
+
+ +
- {% endfor %}
-
-
- {% endif %} + {% endfor %} +
+
-
- -{% if new_scratchpad %} -
-
-
-{% endif %} + {% endif %} {% endblock %} diff --git a/html-router/templates/search/_layout.html b/html-router/templates/search/_layout.html new file mode 100644 index 0000000..5c77e8d --- /dev/null +++ b/html-router/templates/search/_layout.html @@ -0,0 +1,18 @@ +{% extends "body_base.html" %} + +{% block title %}Minne - Search{% endblock %} + +{% block main %} +
+
+
+
+ {% block search_header %} + {% endblock %} +
+
+ {% block search_results %} + {% endblock %} +
+
+{% endblock %} diff --git a/html-router/templates/search/base.html b/html-router/templates/search/base.html index bda08a8..f68e038 100644 --- a/html-router/templates/search/base.html +++ b/html-router/templates/search/base.html @@ -1,17 +1,10 @@ -{% extends "body_base.html" %} +{% extends "search/_layout.html" %} -{% block title %}Minne - Search{% endblock %} - -{% block main %} -
-
-
-
-

Search

-
Find documents, entities, and snippets
-
-
- {% include "search/response.html" %} -
-
+{% block search_header %} +

Search

+
Find documents, entities, and snippets
+{% endblock %} + +{% block search_results %} + {% include "search/response.html" %} {% endblock %} diff --git a/html-router/templates/sidebar.html b/html-router/templates/sidebar.html index 6b9bf39..fa6d70b 100644 --- a/html-router/templates/sidebar.html +++ b/html-router/templates/sidebar.html @@ -1,119 +1,52 @@ -{% macro icon(name) %} -{% if name == "home" %} -{% include "icons/home_icon.html" %} -{% elif name == "book" %} -{% include "icons/book_icon.html" %} -{% elif name == "document" %} -{% include "icons/document_icon.html" %} -{% elif name == "chat" %} -{% include "icons/chat_icon.html" %} -{% elif name == "search" %} -{% include "icons/search_icon.html" %} -{% elif name == "scratchpad" %} -{% include "icons/scratchpad_icon.html" %} -{% endif %} -{% endmacro %} +{% extends "components/_sidebar_layout.html" %} +{% from "components/_icon_macro.html" import icon %} -
- +{% block sidebar_nav_items %} + {% for url, name, label in [ + ("/", "home", "Dashboard"), + ("/knowledge", "book", "Knowledge"), + ("/content", "document", "Content"), + ("/chat", "chat", "Chat"), + ("/search", "search", "Search"), + ("/scratchpad", "scratchpad", "Scratchpad") + ] %} +
  • + + {{ icon(name) }} + {{ label }} + +
  • + {% endfor %} +
  • + +
  • +
    +{% endblock %} - -
    +{% block sidebar_bottom_actions %} +
  • + + {% include "icons/user_icon.html" %} + Account + +
  • + {% if user.admin %} +
  • + + {% include "icons/wrench_screwdriver_icon.html" %} + Admin + +
  • + {% endif %} +
  • + + {% include "icons/logout_icon.html" %} + Logout + +
  • +{% endblock %} diff --git a/main/src/main.rs b/main/src/main.rs index 26957ff..1c61adf 100644 --- a/main/src/main.rs +++ b/main/src/main.rs @@ -116,6 +116,7 @@ async fn main() -> Result<(), Box> { config.clone(), reranker_pool.clone(), embedding_provider.clone(), + None, ) .await?; @@ -284,6 +285,7 @@ mod tests { config.clone(), None, embedding_provider, + None, ) .await .expect("failed to build html state"); diff --git a/main/src/server.rs b/main/src/server.rs index 32df2e4..4df3868 100644 --- a/main/src/server.rs +++ b/main/src/server.rs @@ -71,6 +71,7 @@ async fn main() -> Result<(), Box> { config.clone(), reranker_pool, embedding_provider, + None, ) .await?;