feat: MetonaAI Desktop 初始项目

- Electron + React + TypeScript 架构
- 三栏布局: Sidebar | ChatPanel | DetailPanel
- 9 个内置工具 (文件系统/网络/记忆/命令)
- SQLite 持久化 (better-sqlite3)
- MUI 暗色/亮色主题系统
- Agent Loop ReAct 状态机引擎
- DeepSeek / Agnes AI / Ollama Provider 适配器
- MCP 协议集成
- 系统托盘 + 全局快捷键
- Tailwind CSS v4 + Tailwind Merge
- 修复: Sidebar 缺失 TextField 导入导致黑屏
This commit is contained in:
thzxx
2026-06-27 21:33:27 +08:00
commit 1d185db6b3
109 changed files with 39155 additions and 0 deletions
+73
View File
@@ -0,0 +1,73 @@
/**
* ToastContainer — Toast 通知容器
*
* 配置 metona-toast 并监听主进程通知桥接。
*
* @see docs/MetonaAI-Desktop UI UX 设计集成方案.html — MetonaToast 集成方案
*/
import { useEffect } from 'react';
/**
* Toast 容器组件
*
* 在 App 根组件中渲染,负责:
* 1. 配置 MeToast 全局参数
* 2. 监听主进程 toast:show 事件
* 3. 桥接到 MeToast 显示
*/
export function ToastContainer(): null {
useEffect(() => {
// 动态导入 metona-toast 并配置
import('metona-toast').then((mod) => {
const MeToast = mod.default;
// 全局配置(设计规范指定的参数)
MeToast.configure({
position: 'top-right',
duration: 4000,
max: 6,
theme: 'auto',
animation: 'slide',
pauseOnHover: true,
closeOnClick: true,
showProgress: true,
draggable: true,
locale: 'zh-CN',
});
// 安装插件
try {
MeToast.use('keyboard'); // ESC 关闭所有
MeToast.use('persistence'); // 配置持久化
MeToast.use('accessibility'); // 屏幕阅读器
} catch {
// 插件可能已安装
}
}).catch(() => {
// metona-toast 未安装时静默
});
// 监听主进程通知桥接
if (window.metona?.toast?.onShow) {
const unsubscribe = window.metona.toast.onShow(async (data) => {
try {
const MeToast = (await import('metona-toast')).default;
const { type, message, options } = data;
switch (type) {
case 'success': MeToast.success(message, options); break;
case 'error': MeToast.error(message, options); break;
case 'warning': MeToast.warning(message, options); break;
case 'info': MeToast.info(message, options); break;
default: MeToast.info(message, options);
}
} catch {
// 静默
}
});
return unsubscribe;
}
}, []);
return null;
}