Files
Misaki 5be7f7f04b feat: implement AI schedule app with multi-device sync
- Qt 6 desktop client with day/month/year views, AI scheduling, and TOML settings\n- Go sync server with SQLite change stream, WebSocket notifications, and Docker deployment\n- Client outbox/LWW sync, offline retry, and dual-client integration tests\n- Linux fcitx5 setup, validation reports, and Windows MinGW preset
2026-10-26 13:58:45 +08:00

89 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 阶段 1.6 验证报告:TOML 配置系统 + AI 服务配置
> 日期:2026-10-26
> 环境:Ubuntu 24.04 / GCC 13.3 / Qt 6.6.3 / toml++ v3.4.0
## 1. 本次交付
1. **应用配置迁移到 TOML**:默认路径 `~/.config/Misaki/Schedule/config.toml`,不再写入 `QSettings`。
2. **首次运行自动迁移**:若 TOML 不存在且存在旧 `Schedule.conf`,自动读取旧配置并写入 TOML;旧文件保留作为备份。
3. **配置内容集中管理**:设备 ID、主题、云母开关、吸附粒度、托盘提示、窗口几何、分隔条状态、数据库路径、AI 服务配置。
4. **AI 服务配置 UI**:设置中新增接口地址、模型、API Key;API Key 默认密码显示,可点击眼睛按钮临时显示。
5. **配置文件安全**:使用 `QSaveFile` 原子写入;Linux 下权限设置为 `0600`;解析失败时保留 `.bak` 并回退默认值。
6. **测试**:新增 `config` 测试,覆盖默认值、读写往返、设备 ID 持久化、API Key 往返、文件权限与损坏文件回退。
## 2. 配置文件示例
```toml
schema_version = 1
[app]
device_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
[storage]
database_path = ""
[ui]
theme = "system"
mica = false
snap_minutes = 15
tray_hint_shown = true
[window]
compact_geometry = "base64..."
schedule_geometry = "base64..."
schedule_splitter = "base64..."
[ai]
base_url = "https://api.openai.com/v1"
api_key = ""
model = "gpt-4o-mini"
temperature = 0.2
```
可通过环境变量 `SCHEDULE_CONFIG_PATH` 覆盖配置文件路径,通过 `SCHEDULE_DB_PATH` 覆盖数据库路径。
## 3. 构建与测试
```bash
cmake --preset linux-gcc
cmake --build --preset linux-gcc --clean-first -j$(nproc)
ctest --preset linux-gcc
```
- 构建成功,项目代码及第三方告警:**0**。
- 自动化测试:**6/6 通过**(storage / services / grid / mainwindow / compactwindow / config)。
```
100% tests passed, 0 tests failed out of 6
```
完整输出见 [`ctest-phase-1-6.txt`](ctest-phase-1-6.txt)。
## 4. 迁移与权限验证
- 本机真实环境从旧 `~/.config/Misaki/Schedule.conf` 成功迁移到
`~/.config/Misaki/Schedule/config.toml`,设备 ID、主题、云母开关、吸附粒度、托盘提示均保留。
- `config.toml` 权限为 `-rw-------`(0600)。
- 损坏的 TOML 会生成 `config.toml.bak` 并使用默认值启动。
## 5. 界面截图
| 截图 | 说明 |
|---|---|
| [`settings-dark.png`](settings-dark.png) | 设置 · 外观 + AI 服务(深色) |
| [`settings-light.png`](settings-light.png) | 设置 · 外观 + AI 服务(浅色) |
## 6. 已知限制
1. API Key 以明文写入本地 TOML,通过文件权限 0600 保护;尚未接入系统钥匙串。
2. AI 调用本身仍属于阶段 2,本次只完成配置入口与持久化。
3. 旧 `Schedule.conf` 不会自动删除,仅作为迁移备份;后续版本不再读写它。
## 7. 人工验收建议
1. 打开设置,修改主题、云母效果、接口地址、模型与 API Key,点击「完成」。
2. 查看 `~/.config/Misaki/Schedule/config.toml`,确认 `[ai]` 字段已写入。
3. 重启应用,确认主题、云母和 AI 配置均保留。
4. 在终端执行 `stat -c '%a' ~/.config/Misaki/Schedule/config.toml`,确认权限为 `600`。