mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-24 01:38:29 +02:00
refactor: better separation of dependencies to crates
node stuff to html crate only
This commit is contained in:
8
html-router/templates/index/index.html
Normal file
8
html-router/templates/index/index.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{% extends "body_base.html" %}
|
||||
{% block main %}
|
||||
{% if user %}
|
||||
{% include 'index/signed_in/base.html' %}
|
||||
{% else %}
|
||||
{% include 'auth/signin_form.html' %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
50
html-router/templates/index/signed_in/active_jobs.html
Normal file
50
html-router/templates/index/signed_in/active_jobs.html
Normal file
@@ -0,0 +1,50 @@
|
||||
{% block active_jobs_section %}
|
||||
<ul id="active_jobs_section" class="list">
|
||||
<div class="flex justify-center items-center gap-4">
|
||||
<li class="py-4 text-center font-bold tracking-wide">Active Jobs</li>
|
||||
<button class="cursor-pointer scale-75" hx-get="/active-jobs" hx-target="#active_jobs_section" hx-swap="outerHTML">
|
||||
{% include "icons/refresh_icon.html" %}
|
||||
</button>
|
||||
</div>
|
||||
{% for item in active_jobs %}
|
||||
<li class="list-row">
|
||||
<div class="bg-secondary rounded-box size-10 flex justify-center items-center text-secondary-content">
|
||||
{% if item.content.Url %}
|
||||
{% include "icons/globe_icon.html" %}
|
||||
{% elif item.content.File %}
|
||||
{% include "icons/document_icon.html" %}
|
||||
{% else %}
|
||||
{% include "icons/chat_icon.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<div class="[&:before]:content-['Status:_'] [&:before]:opacity-60">
|
||||
{% if item.status.InProgress %}
|
||||
In Progress, attempt {{item.status.InProgress.attempts}}
|
||||
{% else %}
|
||||
{{item.status}}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="text-xs font-semibold opacity-60">
|
||||
{{item.created_at|datetimeformat(format="short", tz=user.timezone)}} </div>
|
||||
</div>
|
||||
<p class="list-col-wrap text-xs [&:before]:content-['Content:_'] [&:before]:opacity-60">
|
||||
{% if item.content.Url %}
|
||||
{{item.content.Url.url}}
|
||||
{% elif item.content.File %}
|
||||
{{item.content.File.file_info.file_name}}
|
||||
{% else %}
|
||||
{{item.content.Text.text}}
|
||||
{% endif %}
|
||||
</p>
|
||||
<!-- <button class="btn disabled btn-square btn-ghost btn-sm"> -->
|
||||
<!-- {% include "icons/edit_icon.html" %} -->
|
||||
<!-- </button> -->
|
||||
<button hx-delete="/jobs/{{item.id}}" hx-target="#active_jobs_section" hx-swap="outerHTML"
|
||||
class="btn btn-square btn-ghost btn-sm">
|
||||
{% include "icons/delete_icon.html" %}
|
||||
</button>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
14
html-router/templates/index/signed_in/base.html
Normal file
14
html-router/templates/index/signed_in/base.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<div class="flex justify-center grow mt-2 sm:mt-4 gap-6">
|
||||
<div class="container">
|
||||
{% include 'index/signed_in/searchbar.html' %}
|
||||
|
||||
{% include "index/signed_in/quick_actions.html" %}
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 shadow my-10">
|
||||
{% include "index/signed_in/active_jobs.html" %}
|
||||
|
||||
{% include "index/signed_in/recent_content.html" %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
57
html-router/templates/index/signed_in/ingress_modal.html
Normal file
57
html-router/templates/index/signed_in/ingress_modal.html
Normal file
@@ -0,0 +1,57 @@
|
||||
{% extends "modal_base.html" %}
|
||||
|
||||
{% block form_attributes %}
|
||||
hx-post="/ingress-form"
|
||||
enctype="multipart/form-data"
|
||||
hx-target="#active_jobs_section"
|
||||
hx-swap="outerHTML"
|
||||
{% endblock %}
|
||||
|
||||
{% block modal_content %}
|
||||
<h3 class="text-lg font-bold">Add new content</h3>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="floating-label">
|
||||
<span>Instructions</span>
|
||||
<textarea name="instructions" class="textarea w-full validator"
|
||||
placeholder="Enter instructions for the AI here, help it understand what its seeing or how it should relate to the database"
|
||||
required>{{ instructions }}</textarea>
|
||||
<div class="validator-hint hidden">Instructions are required</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="floating-label">
|
||||
<span>Content</span>
|
||||
<textarea name="content" class="textarea input-bordered w-full"
|
||||
placeholder="Enter the content you want to ingress, it can be an URL or a text snippet">{{ content }}</textarea>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="floating-label">
|
||||
<span>Category</span>
|
||||
<input type="text" name="category" class="input input-bordered validator w-full" value="{{ category }}"
|
||||
list="category-list" required />
|
||||
<datalist id="category-list">
|
||||
{% for category in user_categories %}
|
||||
<option value="{{ category }}" />
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
<div class="validator-hint hidden">Category is required</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="label label-text">Files</label>
|
||||
<input type="file" name="files" multiple class="file-input file-input-bordered w-full" />
|
||||
</div>
|
||||
|
||||
<div id="error-message" class="text-error text-center {% if not error %}hidden{% endif %}">{{ error }}</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block primary_actions %}
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Save Changes
|
||||
</button>
|
||||
{% endblock %}
|
||||
7
html-router/templates/index/signed_in/quick_actions.html
Normal file
7
html-router/templates/index/signed_in/quick_actions.html
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="flex gap-4 flex-col sm:flex-row">
|
||||
<a class="btn btn-secondary" href="/knowledge" hx-boost="true">View Knowledge</a>
|
||||
<a class="btn btn-accent" href="/content" hx-boost="true">View Content</a>
|
||||
<a class="btn btn-accent" href="/chat" hx-boost="true">Chat</a>
|
||||
<button class="btn btn-primary" hx-get="/ingress-form" hx-target="#modal" hx-swap="innerHTML">Add
|
||||
Content</button>
|
||||
</div>
|
||||
42
html-router/templates/index/signed_in/recent_content.html
Normal file
42
html-router/templates/index/signed_in/recent_content.html
Normal file
@@ -0,0 +1,42 @@
|
||||
{% block latest_content_section %}
|
||||
<ul id="latest_content_section" class="list">
|
||||
<li class="py-4 text-center font-bold tracking-wide">Recently added content</li>
|
||||
{% for item in latest_text_contents %}
|
||||
<li class="list-row">
|
||||
<div class="bg-accent rounded-box size-10 flex justify-center items-center text-accent-content">
|
||||
{% if item.url %}
|
||||
{% include "icons/globe_icon.html" %}
|
||||
{% elif item.file_info %}
|
||||
{% include "icons/document_icon.html" %}
|
||||
{% else %}
|
||||
{% include "icons/chat_icon.html" %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<div class="truncate max-w-[160px]">
|
||||
{% if item.url %}
|
||||
{{item.url}}
|
||||
{% elif item.file_info%}
|
||||
{{item.file_info.file_name}}
|
||||
{% else %}
|
||||
{{item.text}}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="text-xs font-semibold opacity-60">
|
||||
{{item.created_at|datetimeformat(format="short", tz=user.timezone)}} </div>
|
||||
</div>
|
||||
<p class="list-col-wrap text-xs [&:before]:content-['Instructions:_'] [&:before]:opacity-60">
|
||||
{{item.instructions}}
|
||||
</p>
|
||||
<button class="btn btn-disabled btn-square btn-ghost btn-sm">
|
||||
{% include "icons/edit_icon.html" %}
|
||||
</button>
|
||||
<button hx-delete="/text-content/{{item.id}}" hx-target="#latest_content_section" hx-swap="outerHTML"
|
||||
class="btn btn-square btn-ghost btn-sm">
|
||||
{% include "icons/delete_icon.html" %}
|
||||
|
||||
</button>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
32
html-router/templates/index/signed_in/search_response.html
Normal file
32
html-router/templates/index/signed_in/search_response.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<div class="mx-auto mb-6">
|
||||
<div class="card bg-base-200 shadow">
|
||||
<div class="card-body">
|
||||
<h2 class="card-title">Result</h2>
|
||||
<div class="prose !max-w-none">
|
||||
{{ answer_content | safe}}
|
||||
</div>
|
||||
{% if answer_references %}
|
||||
<div class="mt-4">
|
||||
<h2 class="card-title mb-2">References</h2>
|
||||
<div class="flex flex-wrap gap-2 max-w-full">
|
||||
{% for ref in answer_references %}
|
||||
<div class="tooltip" data-tip="More info about {{ ref }}">
|
||||
<button class="badge truncate badge-outline cursor-pointer text-gray-500 hover:text-gray-700">
|
||||
{{ ref }}
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>{% endif %}
|
||||
<div class="mt-4">
|
||||
<form hx-post="/initialized-chat" hx-target="body" hx-swap="outerHTML" method="POST"
|
||||
class="flex items-center space-x-4">
|
||||
<input type="hidden" name="user_query" value="{{ user_query }}">
|
||||
<input type="hidden" name="llm_response" value="{{ answer_content }}">
|
||||
<input type="hidden" name="references" value="{{ answer_references }}">
|
||||
<button type="submit" class="btn btn-primary">Continue with chat</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
8
html-router/templates/index/signed_in/searchbar.html
Normal file
8
html-router/templates/index/signed_in/searchbar.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<h2 class="font-bold mb-2">
|
||||
Search your content
|
||||
</h2>
|
||||
<input type="text" placeholder="Search your knowledge base" class="input input-bordered w-full" name="query"
|
||||
hx-get="/search" hx-target="#search-results" />
|
||||
<div id="search-results" class="mt-4">
|
||||
<!-- Results will be populated here by HTMX -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user