mirror of
https://github.com/perstarkse/minne.git
synced 2026-03-26 11:21:35 +01:00
chore: tidying templates
This commit is contained in:
@@ -37,7 +37,7 @@ pub async fn show_admin_panel(
|
||||
let conversation_archive = User::get_user_conversations(&user.id, &state.db).await?;
|
||||
|
||||
Ok(TemplateResponse::new_template(
|
||||
"auth/admin_panel.html",
|
||||
"admin/base.html",
|
||||
AdminPanelData {
|
||||
user,
|
||||
settings,
|
||||
@@ -91,7 +91,7 @@ pub async fn toggle_registration_status(
|
||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||
|
||||
Ok(TemplateResponse::new_partial(
|
||||
"auth/admin_panel.html",
|
||||
"admin/base.html",
|
||||
"registration_status_input",
|
||||
RegistrationToggleData {
|
||||
settings: new_settings,
|
||||
@@ -131,7 +131,7 @@ pub async fn update_model_settings(
|
||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||
|
||||
Ok(TemplateResponse::new_partial(
|
||||
"auth/admin_panel.html",
|
||||
"admin/base.html",
|
||||
"model_settings_form",
|
||||
ModelSettingsData {
|
||||
settings: new_settings,
|
||||
@@ -195,7 +195,7 @@ pub async fn patch_query_prompt(
|
||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||
|
||||
Ok(TemplateResponse::new_partial(
|
||||
"auth/admin_panel.html",
|
||||
"admin/base.html",
|
||||
"system_prompt_section",
|
||||
SystemPromptSectionData {
|
||||
settings: new_settings,
|
||||
@@ -254,7 +254,7 @@ pub async fn patch_ingestion_prompt(
|
||||
SystemSettings::update(&state.db, new_settings.clone()).await?;
|
||||
|
||||
Ok(TemplateResponse::new_partial(
|
||||
"auth/admin_panel.html",
|
||||
"admin/base.html",
|
||||
"system_prompt_section",
|
||||
SystemPromptSectionData {
|
||||
settings: new_settings,
|
||||
|
||||
@@ -46,7 +46,7 @@ pub async fn show_ingress_form(
|
||||
}
|
||||
|
||||
Ok(TemplateResponse::new_template(
|
||||
"index/signed_in/ingress_modal.html",
|
||||
"ingestion_modal.html",
|
||||
ShowIngressFormData { user_categories },
|
||||
))
|
||||
}
|
||||
@@ -61,7 +61,7 @@ pub async fn hide_ingress_form(
|
||||
}
|
||||
|
||||
#[derive(Debug, TryFromMultipart)]
|
||||
pub struct IngressParams {
|
||||
pub struct IngestionParams {
|
||||
pub content: Option<String>,
|
||||
pub context: String,
|
||||
pub category: String,
|
||||
@@ -73,7 +73,7 @@ pub struct IngressParams {
|
||||
pub async fn process_ingress_form(
|
||||
State(state): State<HtmlState>,
|
||||
RequireUser(user): RequireUser,
|
||||
TypedMultipart(input): TypedMultipart<IngressParams>,
|
||||
TypedMultipart(input): TypedMultipart<IngestionParams>,
|
||||
) -> Result<impl IntoResponse, HtmlError> {
|
||||
#[derive(Serialize)]
|
||||
pub struct IngressFormData {
|
||||
@@ -117,9 +117,6 @@ pub async fn process_ingress_form(
|
||||
|
||||
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)]
|
||||
struct NewTasksData {
|
||||
user: User,
|
||||
@@ -127,7 +124,7 @@ pub async fn process_ingress_form(
|
||||
}
|
||||
|
||||
Ok(TemplateResponse::new_template(
|
||||
"index/signed_in/new_task.html",
|
||||
"dashboard/current_task.html",
|
||||
NewTasksData { user, tasks },
|
||||
))
|
||||
}
|
||||
@@ -137,37 +134,6 @@ pub struct QueryParams {
|
||||
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(
|
||||
message: impl Into<String>,
|
||||
) -> Pin<Box<dyn Stream<Item = Result<Event, axum::Error>> + Send>> {
|
||||
|
||||
Reference in New Issue
Block a user