mirror of
https://github.com/perstarkse/minne.git
synced 2026-07-04 20:11:42 +02:00
chore: tidying templates
This commit is contained in:
+3
-3
@@ -1,15 +1,15 @@
|
|||||||
.devenv
|
.devenv
|
||||||
.direnv
|
.direnv
|
||||||
.devenv
|
.devenv
|
||||||
database
|
|
||||||
node_modules
|
node_modules
|
||||||
config.yaml
|
config.yaml
|
||||||
|
|
||||||
|
|
||||||
target
|
target
|
||||||
.aider
|
result
|
||||||
.aider.chat.history.md .aider.input.history .aider.tags.cache.v3 .aider.tags.cache.v3/cache.db
|
|
||||||
data
|
data
|
||||||
|
database
|
||||||
|
|
||||||
# Devenv
|
# Devenv
|
||||||
.devenv*
|
.devenv*
|
||||||
devenv.local.nix
|
devenv.local.nix
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
[core]
|
||||||
|
path = "./"
|
||||||
|
schema = "less"
|
||||||
|
|
||||||
|
[db]
|
||||||
|
address = "ws://localhost:8000"
|
||||||
|
username = "root_user"
|
||||||
|
password = "root_password"
|
||||||
|
ns = "test"
|
||||||
|
db = "test"
|
||||||
File diff suppressed because one or more lines are too long
@@ -37,7 +37,7 @@ pub async fn show_admin_panel(
|
|||||||
let conversation_archive = User::get_user_conversations(&user.id, &state.db).await?;
|
let conversation_archive = User::get_user_conversations(&user.id, &state.db).await?;
|
||||||
|
|
||||||
Ok(TemplateResponse::new_template(
|
Ok(TemplateResponse::new_template(
|
||||||
"auth/admin_panel.html",
|
"admin/base.html",
|
||||||
AdminPanelData {
|
AdminPanelData {
|
||||||
user,
|
user,
|
||||||
settings,
|
settings,
|
||||||
@@ -91,7 +91,7 @@ pub async fn toggle_registration_status(
|
|||||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||||
|
|
||||||
Ok(TemplateResponse::new_partial(
|
Ok(TemplateResponse::new_partial(
|
||||||
"auth/admin_panel.html",
|
"admin/base.html",
|
||||||
"registration_status_input",
|
"registration_status_input",
|
||||||
RegistrationToggleData {
|
RegistrationToggleData {
|
||||||
settings: new_settings,
|
settings: new_settings,
|
||||||
@@ -131,7 +131,7 @@ pub async fn update_model_settings(
|
|||||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||||
|
|
||||||
Ok(TemplateResponse::new_partial(
|
Ok(TemplateResponse::new_partial(
|
||||||
"auth/admin_panel.html",
|
"admin/base.html",
|
||||||
"model_settings_form",
|
"model_settings_form",
|
||||||
ModelSettingsData {
|
ModelSettingsData {
|
||||||
settings: new_settings,
|
settings: new_settings,
|
||||||
@@ -195,7 +195,7 @@ pub async fn patch_query_prompt(
|
|||||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||||
|
|
||||||
Ok(TemplateResponse::new_partial(
|
Ok(TemplateResponse::new_partial(
|
||||||
"auth/admin_panel.html",
|
"admin/base.html",
|
||||||
"system_prompt_section",
|
"system_prompt_section",
|
||||||
SystemPromptSectionData {
|
SystemPromptSectionData {
|
||||||
settings: new_settings,
|
settings: new_settings,
|
||||||
@@ -254,7 +254,7 @@ pub async fn patch_ingestion_prompt(
|
|||||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||||
|
|
||||||
Ok(TemplateResponse::new_partial(
|
Ok(TemplateResponse::new_partial(
|
||||||
"auth/admin_panel.html",
|
"admin/base.html",
|
||||||
"system_prompt_section",
|
"system_prompt_section",
|
||||||
SystemPromptSectionData {
|
SystemPromptSectionData {
|
||||||
settings: new_settings,
|
settings: new_settings,
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ pub async fn show_ingress_form(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(TemplateResponse::new_template(
|
Ok(TemplateResponse::new_template(
|
||||||
"index/signed_in/ingress_modal.html",
|
"ingestion_modal.html",
|
||||||
ShowIngressFormData { user_categories },
|
ShowIngressFormData { user_categories },
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ pub async fn hide_ingress_form(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, TryFromMultipart)]
|
#[derive(Debug, TryFromMultipart)]
|
||||||
pub struct IngressParams {
|
pub struct IngestionParams {
|
||||||
pub content: Option<String>,
|
pub content: Option<String>,
|
||||||
pub context: String,
|
pub context: String,
|
||||||
pub category: String,
|
pub category: String,
|
||||||
@@ -73,7 +73,7 @@ pub struct IngressParams {
|
|||||||
pub async fn process_ingress_form(
|
pub async fn process_ingress_form(
|
||||||
State(state): State<HtmlState>,
|
State(state): State<HtmlState>,
|
||||||
RequireUser(user): RequireUser,
|
RequireUser(user): RequireUser,
|
||||||
TypedMultipart(input): TypedMultipart<IngressParams>,
|
TypedMultipart(input): TypedMultipart<IngestionParams>,
|
||||||
) -> Result<impl IntoResponse, HtmlError> {
|
) -> Result<impl IntoResponse, HtmlError> {
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct IngressFormData {
|
pub struct IngressFormData {
|
||||||
@@ -117,9 +117,6 @@ pub async fn process_ingress_form(
|
|||||||
|
|
||||||
let tasks = try_join_all(futures).await?;
|
let tasks = try_join_all(futures).await?;
|
||||||
|
|
||||||
// Update the active jobs page with the newly created job
|
|
||||||
// let active_jobs = User::get_unfinished_ingestion_tasks(&user.id, &state.db).await?;
|
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
struct NewTasksData {
|
struct NewTasksData {
|
||||||
user: User,
|
user: User,
|
||||||
@@ -127,7 +124,7 @@ pub async fn process_ingress_form(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Ok(TemplateResponse::new_template(
|
Ok(TemplateResponse::new_template(
|
||||||
"index/signed_in/new_task.html",
|
"dashboard/current_task.html",
|
||||||
NewTasksData { user, tasks },
|
NewTasksData { user, tasks },
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
@@ -137,37 +134,6 @@ pub struct QueryParams {
|
|||||||
task_id: String,
|
task_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub async fn get_task_updates_stream(
|
|
||||||
// State(state): State<HtmlState>,
|
|
||||||
// auth: AuthSessionType,
|
|
||||||
// Query(params): Query<QueryParams>,
|
|
||||||
// ) -> Sse<Pin<Box<dyn Stream<Item = Result<Event, axum::Error>> + Send>>> {
|
|
||||||
// let task_id = params.task_id.clone();
|
|
||||||
// let db = state.db.clone();
|
|
||||||
|
|
||||||
// let stream = async_stream::stream! {
|
|
||||||
// loop {
|
|
||||||
// match db.get_item::<IngestionTask>(&task_id).await {
|
|
||||||
// Ok(Some(_task)) => {
|
|
||||||
// // For now, just sending a placeholder event
|
|
||||||
// yield Ok(Event::default().event("status").data("hey"));
|
|
||||||
// },
|
|
||||||
// _ => {
|
|
||||||
// yield Ok(Event::default().event("error").data("Failed to get item"));
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// sleep(Duration::from_secs(5)).await;
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
// Sse::new(stream.boxed()).keep_alive(
|
|
||||||
// KeepAlive::new()
|
|
||||||
// .interval(Duration::from_secs(15))
|
|
||||||
// .text("keep-alive"),
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// Error handling function
|
|
||||||
fn create_error_stream(
|
fn create_error_stream(
|
||||||
message: impl Into<String>,
|
message: impl Into<String>,
|
||||||
) -> Pin<Box<dyn Stream<Item = Result<Event, axum::Error>> + Send>> {
|
) -> Pin<Box<dyn Stream<Item = Result<Event, axum::Error>> + Send>> {
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
<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>
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
{% extends 'body_base.html' %}
|
{% extends 'body_base.html' %}
|
||||||
|
|
||||||
{% block title %}Minne - Knowledge{% endblock %}
|
{% block title %}Minne - Knowledge{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<main id="knowledge_pane" class="flex justify-center grow mt-2 sm:mt-4 gap-6 mb-10">
|
<main id="knowledge_pane" class="flex justify-center grow mt-2 sm:mt-4 gap-6 mb-10">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|||||||
Reference in New Issue
Block a user