feat(settings): add quick messages management with drag-and-drop sorting

Adds a new "Quick Messages" settings page below Experts for managing reusable title/content snippets, backed by SQLite via SeaORM and exposed through both Tauri commands and the Axum web router. The list supports drag-to-reorder using the same motion/react Reorder pattern as the agent list, with translations provided across all 10 supported locales.
This commit is contained in:
xintaofei
2026-04-24 10:46:33 +08:00
parent fbe272de4f
commit 61778f152b
30 changed files with 1434 additions and 11 deletions

View File

@@ -9,6 +9,7 @@ pub mod model_provider;
#[cfg(feature = "tauri-runtime")]
pub mod notification;
pub mod project_boot;
pub mod quick_messages;
pub mod system_settings;
pub mod terminal;
pub mod version_control;

View File

@@ -0,0 +1,55 @@
#[cfg(feature = "tauri-runtime")]
use crate::db::error::DbError;
#[cfg(feature = "tauri-runtime")]
use crate::db::service::quick_message_service;
#[cfg(feature = "tauri-runtime")]
use crate::db::AppDatabase;
#[cfg(feature = "tauri-runtime")]
use crate::models::QuickMessageInfo;
#[cfg(feature = "tauri-runtime")]
#[cfg_attr(feature = "tauri-runtime", tauri::command)]
pub async fn quick_messages_list(
db: tauri::State<'_, AppDatabase>,
) -> Result<Vec<QuickMessageInfo>, DbError> {
quick_message_service::list(&db.conn).await
}
#[cfg(feature = "tauri-runtime")]
#[cfg_attr(feature = "tauri-runtime", tauri::command)]
pub async fn quick_messages_create(
db: tauri::State<'_, AppDatabase>,
title: String,
content: String,
) -> Result<QuickMessageInfo, DbError> {
quick_message_service::create(&db.conn, &title, &content).await
}
#[cfg(feature = "tauri-runtime")]
#[cfg_attr(feature = "tauri-runtime", tauri::command)]
pub async fn quick_messages_update(
db: tauri::State<'_, AppDatabase>,
id: i32,
title: Option<String>,
content: Option<String>,
) -> Result<QuickMessageInfo, DbError> {
quick_message_service::update(&db.conn, id, title, content).await
}
#[cfg(feature = "tauri-runtime")]
#[cfg_attr(feature = "tauri-runtime", tauri::command)]
pub async fn quick_messages_delete(
db: tauri::State<'_, AppDatabase>,
id: i32,
) -> Result<(), DbError> {
quick_message_service::delete(&db.conn, id).await
}
#[cfg(feature = "tauri-runtime")]
#[cfg_attr(feature = "tauri-runtime", tauri::command)]
pub async fn quick_messages_reorder(
db: tauri::State<'_, AppDatabase>,
ids: Vec<i32>,
) -> Result<(), DbError> {
quick_message_service::reorder(&db.conn, ids).await
}