mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-24 01:38:29 +02:00
feat: additional variables to database structs & display
This commit is contained in:
@@ -2643,6 +2643,9 @@
|
|||||||
.my-4 {
|
.my-4 {
|
||||||
margin-block: calc(var(--spacing) * 4);
|
margin-block: calc(var(--spacing) * 4);
|
||||||
}
|
}
|
||||||
|
.my-10 {
|
||||||
|
margin-block: calc(var(--spacing) * 10);
|
||||||
|
}
|
||||||
.my-12 {
|
.my-12 {
|
||||||
margin-block: calc(var(--spacing) * 12);
|
margin-block: calc(var(--spacing) * 12);
|
||||||
}
|
}
|
||||||
@@ -3482,6 +3485,9 @@
|
|||||||
width: 1.2em;
|
width: 1.2em;
|
||||||
height: 1.2em;
|
height: 1.2em;
|
||||||
}
|
}
|
||||||
|
.h-1 {
|
||||||
|
height: calc(var(--spacing) * 1);
|
||||||
|
}
|
||||||
.h-5 {
|
.h-5 {
|
||||||
height: calc(var(--spacing) * 5);
|
height: calc(var(--spacing) * 5);
|
||||||
}
|
}
|
||||||
@@ -3500,12 +3506,24 @@
|
|||||||
.w-32 {
|
.w-32 {
|
||||||
width: calc(var(--spacing) * 32);
|
width: calc(var(--spacing) * 32);
|
||||||
}
|
}
|
||||||
|
.w-200 {
|
||||||
|
width: calc(var(--spacing) * 200);
|
||||||
|
}
|
||||||
.w-full {
|
.w-full {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.max-w-\(--breakpoint-sm\) {
|
.max-w-\(--breakpoint-sm\) {
|
||||||
max-width: var(--breakpoint-sm);
|
max-width: var(--breakpoint-sm);
|
||||||
}
|
}
|
||||||
|
.max-w-\[150px\] {
|
||||||
|
max-width: 150px;
|
||||||
|
}
|
||||||
|
.max-w-\[160px\] {
|
||||||
|
max-width: 160px;
|
||||||
|
}
|
||||||
|
.max-w-\[200px\] {
|
||||||
|
max-width: 200px;
|
||||||
|
}
|
||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
@@ -3654,6 +3672,14 @@
|
|||||||
margin-block-end: calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)));
|
margin-block-end: calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.truncate {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.overflow-clip {
|
||||||
|
overflow: clip;
|
||||||
|
}
|
||||||
.overflow-hidden {
|
.overflow-hidden {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
@@ -3827,6 +3853,9 @@
|
|||||||
--tw-tracking: var(--tracking-wide);
|
--tw-tracking: var(--tracking-wide);
|
||||||
letter-spacing: var(--tracking-wide);
|
letter-spacing: var(--tracking-wide);
|
||||||
}
|
}
|
||||||
|
.\!text-nowrap {
|
||||||
|
text-wrap: nowrap !important;
|
||||||
|
}
|
||||||
.text-nowrap {
|
.text-nowrap {
|
||||||
text-wrap: nowrap;
|
text-wrap: nowrap;
|
||||||
}
|
}
|
||||||
@@ -3836,9 +3865,15 @@
|
|||||||
.break-all {
|
.break-all {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
.overflow-ellipsis {
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
.text-ellipsis {
|
.text-ellipsis {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
.whitespace-nowrap {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
.link-primary {
|
.link-primary {
|
||||||
color: var(--color-primary);
|
color: var(--color-primary);
|
||||||
&:hover {
|
&:hover {
|
||||||
@@ -3881,6 +3916,9 @@
|
|||||||
.text-transparent {
|
.text-transparent {
|
||||||
color: transparent;
|
color: transparent;
|
||||||
}
|
}
|
||||||
|
.capitalize {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
.lowercase {
|
.lowercase {
|
||||||
text-transform: lowercase;
|
text-transform: lowercase;
|
||||||
}
|
}
|
||||||
@@ -3911,6 +3949,9 @@
|
|||||||
.underline {
|
.underline {
|
||||||
text-decoration-line: underline;
|
text-decoration-line: underline;
|
||||||
}
|
}
|
||||||
|
.accent-accent {
|
||||||
|
accent-color: var(--color-accent);
|
||||||
|
}
|
||||||
.accent-accent-content {
|
.accent-accent-content {
|
||||||
accent-color: var(--color-accent-content);
|
accent-color: var(--color-accent-content);
|
||||||
}
|
}
|
||||||
@@ -4135,6 +4176,18 @@
|
|||||||
content: var(--tw-content);
|
content: var(--tw-content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.\[\&\:before\]\:content-\[\'Url\:_\'\] {
|
||||||
|
&:before {
|
||||||
|
--tw-content: 'Url: ';
|
||||||
|
content: var(--tw-content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.\[\&\:before\]\:content-\[\'source\:_\'\] {
|
||||||
|
&:before {
|
||||||
|
--tw-content: 'source: ';
|
||||||
|
content: var(--tw-content);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@layer base {
|
@layer base {
|
||||||
*, ::after, ::before, ::backdrop, ::file-selector-button {
|
*, ::after, ::before, ::backdrop, ::file-selector-button {
|
||||||
|
|||||||
@@ -41,13 +41,15 @@ pub fn create_ingress_objects(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
info!("Treating input as plain text");
|
if input_content.len() > 2 {
|
||||||
object_list.push(IngressObject::Text {
|
info!("Treating input as plain text");
|
||||||
text: input_content.to_string(),
|
object_list.push(IngressObject::Text {
|
||||||
instructions: input.instructions.clone(),
|
text: input_content.to_string(),
|
||||||
category: input.category.clone(),
|
instructions: input.instructions.clone(),
|
||||||
user_id: user_id.into(),
|
category: input.category.clone(),
|
||||||
});
|
user_id: user_id.into(),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
use std::fmt::Write;
|
use std::fmt::Write;
|
||||||
use tiktoken_rs::{o200k_base, CoreBPE};
|
use tiktoken_rs::{o200k_base, CoreBPE};
|
||||||
|
|
||||||
/// Knowledge object type, containing the content or reference to it, as well as metadata
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub enum IngressObject {
|
pub enum IngressObject {
|
||||||
Url {
|
Url {
|
||||||
@@ -62,6 +61,7 @@ impl IngressObject {
|
|||||||
instructions.into(),
|
instructions.into(),
|
||||||
category.into(),
|
category.into(),
|
||||||
None,
|
None,
|
||||||
|
Some(url.into()),
|
||||||
user_id.into(),
|
user_id.into(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -75,6 +75,7 @@ impl IngressObject {
|
|||||||
instructions.into(),
|
instructions.into(),
|
||||||
category.into(),
|
category.into(),
|
||||||
None,
|
None,
|
||||||
|
None,
|
||||||
user_id.into(),
|
user_id.into(),
|
||||||
)),
|
)),
|
||||||
IngressObject::File {
|
IngressObject::File {
|
||||||
@@ -89,6 +90,7 @@ impl IngressObject {
|
|||||||
instructions.into(),
|
instructions.into(),
|
||||||
category.into(),
|
category.into(),
|
||||||
Some(file_info.to_owned()),
|
Some(file_info.to_owned()),
|
||||||
|
None,
|
||||||
user_id.into(),
|
user_id.into(),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ pub enum FileError {
|
|||||||
stored_object!(FileInfo, "file", {
|
stored_object!(FileInfo, "file", {
|
||||||
sha256: String,
|
sha256: String,
|
||||||
path: String,
|
path: String,
|
||||||
|
file_name: String,
|
||||||
mime_type: String
|
mime_type: String
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -77,6 +78,7 @@ impl FileInfo {
|
|||||||
id: uuid.to_string(),
|
id: uuid.to_string(),
|
||||||
created_at: now,
|
created_at: now,
|
||||||
updated_at: now,
|
updated_at: now,
|
||||||
|
file_name,
|
||||||
sha256,
|
sha256,
|
||||||
path: Self::persist_file(&uuid, file, &sanitized_file_name, user_id)
|
path: Self::persist_file(&uuid, file, &sanitized_file_name, user_id)
|
||||||
.await?
|
.await?
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ use super::file_info::FileInfo;
|
|||||||
stored_object!(TextContent, "text_content", {
|
stored_object!(TextContent, "text_content", {
|
||||||
text: String,
|
text: String,
|
||||||
file_info: Option<FileInfo>,
|
file_info: Option<FileInfo>,
|
||||||
|
|
||||||
|
url: Option<String>,
|
||||||
instructions: String,
|
instructions: String,
|
||||||
category: String,
|
category: String,
|
||||||
user_id: String
|
user_id: String
|
||||||
@@ -18,6 +20,7 @@ impl TextContent {
|
|||||||
instructions: String,
|
instructions: String,
|
||||||
category: String,
|
category: String,
|
||||||
file_info: Option<FileInfo>,
|
file_info: Option<FileInfo>,
|
||||||
|
url: Option<String>,
|
||||||
user_id: String,
|
user_id: String,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
@@ -27,6 +30,7 @@ impl TextContent {
|
|||||||
updated_at: now,
|
updated_at: now,
|
||||||
text,
|
text,
|
||||||
file_info,
|
file_info,
|
||||||
|
url,
|
||||||
instructions,
|
instructions,
|
||||||
category,
|
category,
|
||||||
user_id,
|
user_id,
|
||||||
|
|||||||
5
templates/icons/chat_icon.html
Normal file
5
templates/icons/chat_icon.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||||
|
class="size-6">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round"
|
||||||
|
d="M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 556 B |
5
templates/icons/document_icon.html
Normal file
5
templates/icons/document_icon.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||||
|
class="size-6">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round"
|
||||||
|
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 486 B |
5
templates/icons/globe_icon.html
Normal file
5
templates/icons/globe_icon.html
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||||
|
class="size-6">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round"
|
||||||
|
d="M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0 1 12 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 679 B |
@@ -1,26 +1,33 @@
|
|||||||
{% block active_jobs_section %}
|
{% block active_jobs_section %}
|
||||||
{% if active_jobs %}
|
{% if active_jobs %}
|
||||||
<ul id="active_jobs_section" class="list bg-base-100 rounded-box shadow-md">
|
<ul id="active_jobs_section" class="list ">
|
||||||
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Active Jobs</li>
|
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Active Jobs</li>
|
||||||
{% for item in active_jobs %}
|
{% for item in active_jobs %}
|
||||||
<li class="list-row">
|
<li class="list-row">
|
||||||
<div class="bg-secondary rounded-box size-10 flex justify-center items-center text-secondary-content">
|
<div class="bg-secondary rounded-box size-10 flex justify-center items-center text-secondary-content">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
{% if item.content.Url %}
|
||||||
class="size-8">
|
{% include "icons/globe_icon.html" %}
|
||||||
<path stroke-linecap="round" stroke-linejoin="round"
|
{% elif item.content.File %}
|
||||||
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
|
{% include "icons/document_icon.html" %}
|
||||||
</svg>
|
{% else %}
|
||||||
|
{% include "icons/chat_icon.html" %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div class="uppercase">
|
||||||
{{item.created_at|datetimeformat(format="short", tz=user.timezone)}}</div>
|
|
||||||
<div
|
|
||||||
class="text-xs font-semibold opacity-60 [&:before]:content-['Status:_'] [&:before]:uppercase [&:before]:opacity-60">
|
|
||||||
{{item.status}}
|
{{item.status}}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-xs font-semibold opacity-60">
|
||||||
|
{{item.created_at|datetimeformat(format="short", tz=user.timezone)}} </div>
|
||||||
</div>
|
</div>
|
||||||
<p class="list-col-wrap text-xs [&:before]:content-['Content:_'] [&:before]:uppercase [&:before]:opacity-60">
|
<p class="list-col-wrap text-xs [&:before]:content-['Content:_'] [&:before]:uppercase [&:before]:opacity-60">
|
||||||
{{item.content}}
|
{% 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>
|
</p>
|
||||||
<!-- <button class="btn disabled btn-square btn-ghost"> -->
|
<!-- <button class="btn disabled btn-square btn-ghost"> -->
|
||||||
<!-- <svg class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> -->
|
<!-- <svg class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> -->
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
{% include "index/signed_in/quick_actions.html" %}
|
{% include "index/signed_in/quick_actions.html" %}
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2">
|
<div class="grid grid-cols-1 md:grid-cols-2 shadow my-10">
|
||||||
{% include "index/signed_in/active_jobs.html" %}
|
{% include "index/signed_in/active_jobs.html" %}
|
||||||
|
|
||||||
{% include "index/signed_in/recent_content.html" %}
|
{% include "index/signed_in/recent_content.html" %}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div class="card bg-base-100 shadow-xl mt-4">
|
<div class="card shadow mt-4">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="flex gap-4">
|
<div class="flex gap-4">
|
||||||
<button class="btn btn-primary" hx-get="/ingress-form" hx-swap="outerHTML">Add Content</button>
|
<button class="btn btn-primary" hx-get="/ingress-form" hx-swap="outerHTML">Add Content</button>
|
||||||
|
|||||||
@@ -1,26 +1,32 @@
|
|||||||
{% block latest_content_section %}
|
{% block latest_content_section %}
|
||||||
<ul id="latest_content_section" class="list bg-base-100 rounded-box shadow-md">
|
<ul id="latest_content_section" class="list">
|
||||||
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Recently added content</li>
|
<li class="p-4 pb-2 text-xs opacity-60 tracking-wide">Recently added content</li>
|
||||||
{% for item in latest_text_contents %}
|
{% for item in latest_text_contents %}
|
||||||
<li class="list-row">
|
<li class="list-row">
|
||||||
<div class="bg-accent rounded-box size-10 flex justify-center items-center text-accent-content">
|
<div class="bg-accent rounded-box size-10 flex justify-center items-center text-accent-content">
|
||||||
|
{% if item.url %}
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
{% include "icons/globe_icon.html" %}
|
||||||
class="size-8">
|
{% elif item.file_info %}
|
||||||
<path stroke-linecap="round" stroke-linejoin="round"
|
{% include "icons/document_icon.html" %}
|
||||||
d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
|
{% else %}
|
||||||
</svg>
|
{% include "icons/chat_icon.html" %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div class="truncate max-w-[160px]">
|
||||||
{{item.created_at|datetimeformat(format="short", tz=user.timezone)}}</div>
|
{% if item.url %}
|
||||||
<div
|
{{item.url}}
|
||||||
class="text-xs font-semibold opacity-60 [&:before]:content-['Instructions:_'] [&:before]:uppercase [&:before]:opacity-60">
|
{% elif item.file_info%}
|
||||||
{{item.instructions}}
|
{{item.file_info.file_name}}
|
||||||
|
{% else %}
|
||||||
|
{{item.text}}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="text-xs font-semibold opacity-60">
|
||||||
|
{{item.created_at|datetimeformat(format="short", tz=user.timezone)}} </div>
|
||||||
</div>
|
</div>
|
||||||
<p class="list-col-wrap text-xs [&:before]:content-['Content:_'] [&:before]:uppercase [&:before]:opacity-60">
|
<p class="list-col-wrap text-xs [&:before]:content-['Instructions:_'] [&:before]:opacity-60">
|
||||||
{{item.text}}
|
{{item.instructions}}
|
||||||
</p>
|
</p>
|
||||||
<!-- <button class="btn disabled btn-square btn-ghost"> -->
|
<!-- <button class="btn disabled btn-square btn-ghost"> -->
|
||||||
<!-- <svg class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> -->
|
<!-- <svg class="size-[1.2em]" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> -->
|
||||||
|
|||||||
Reference in New Issue
Block a user