feat: 全面完善功能和修复 CSS/API 问题

- 修复暗色主题缺少 --accent 变量导致按钮颜色异常
- 消除所有 CSS 硬编码颜色(btn-primary, btn-danger:hover, sidebar-logo)
- 添加 toast.warning 样式支持
- Modal 支持 Enter 确认和 Escape 关闭
- Dashboard 快速操作按钮添加 loading 状态
- Services 操作后延迟刷新确保状态同步
- Memory 页面添加预览/新建/删除文件功能
- Deploy 页面 .env 路径添加默认值
- Rust 后端补充 delete_memory_file/check_installation/write_env_file 命令
- Mock 数据补全所有 API 端点
This commit is contained in:
晴天
2026-02-26 23:19:00 +08:00
parent 8bf2caf788
commit ed353cb3b5
12 changed files with 187 additions and 10 deletions

View File

@@ -110,3 +110,25 @@ pub fn write_memory_file(path: String, content: String) -> Result<(), String> {
fs::write(&target, &content)
.map_err(|e| format!("写入失败: {e}"))
}
#[tauri::command]
pub fn delete_memory_file(path: String) -> Result<(), String> {
if path.contains("..") {
return Err("非法路径".to_string());
}
let candidates = [
memory_dir("memory").join(&path),
memory_dir("archive").join(&path),
memory_dir("core").join(&path),
];
for candidate in &candidates {
if candidate.exists() {
return fs::remove_file(candidate)
.map_err(|e| format!("删除失败: {e}"));
}
}
Err(format!("文件不存在: {path}"))
}