feat: add scheduled tasks behind a 全部功能 button

- the sidebar footer gains 全部功能 left of 设置; its page lists the
  features the server offers, planned tasks for now
- 计划任务 follows the web client: a project (or the chats scope) picked
  at the top, then its tasks with schedule, last result, next run, model
  and error; the switch pauses, the menu runs now, edits or deletes
- the editor covers name, prompt, daily/weekly/once/cron schedules
  (Chinese date and time pickers), several times a day, weekdays, cron
  examples, enabled, and either the session defaults or a fixed model
  and agent
- the same /api/projects/:id/scheduled-tasks endpoints the web uses; a
  server without them says so instead of failing silently
- the app now pins zh_CN localizations, so the built-in pickers and
  menus are Chinese too
- bump to 0.5.1
This commit is contained in:
blumia committed 2026-11-26 00:36:27 +08:00
1 parent 2f5ce61692
commit da4bfb6826
13 files changed
+1612 -3

No files matched your search

+15
View File
@@ -5,6 +5,21 @@
---
## 0.5.1 计划任务与「全部功能」入口(分支 `flutter`)
| 项 | 结果 |
| --- | --- |
| 入口 | 侧栏底部、设置按钮左侧新增「全部功能」按钮,打开一个功能页;目前里面只有【计划任务】一张卡片(图标 + 一句说明) |
| 计划任务 | 对照网页端:顶部选择运行位置(已注册项目 + 「聊天」scope,默认取当前会话所在项目),下面列出该项目的任务。每张卡片显示名称、计划、上次运行/状态、下次运行、模型行与错误;开关直接暂停/启用,菜单里可立即运行、编辑、删除;下拉刷新 |
| 编辑器 | 底部弹层:任务名称(≤80)、提示词(≤20000)、计划类型(每天 / 每周 / 一次性 / Cron)、时间点(可加多个)、星期、日期与时间(中文的日期/时间选择器)、Cron 示例、是否启用;默认「使用默认模型与智能体」,关闭后可选模型(复用模型选择器)与智能体 |
| 接口 | `GET/PUT /api/projects/:id/scheduled-tasks`、`DELETE …/:taskId`、`POST …/:taskId/run`,与网页端同一份数据;`openchamber:chats` 作为聊天 scope;服务器没有该接口(404)时页面写明「服务器不支持计划任务」。时间按服务器时区 |
| 中文化 | 应用整体指定中文(`flutter_localizations`),系统自带的日期/时间选择器、文本选择菜单随之是中文 |
| 测试 | 新增 `test/scheduled_tasks_test.dart`:四种计划的解析与展示文案、保存时只带该类型用到的字段、默认模型判断、状态与相对时间、功能页入口、编辑器的必填校验与草稿;`sidebar_footer_test` 覆盖新按钮;95 项全过 |
| 验证 | 模拟器(真实服务端):侧栏「全部功能」→ 计划任务;默认运行位置取当前会话所在项目(聊天目录与 chats 根不出现在项目列表里,统一归到末尾的「聊天」scope)。新建「Daily time report」(每天 09:00)后列表显示「下次:8 小时 45 分钟后」;「立即运行」→ 服务端 `lastStatus: sent` 并新建一个 scheduled 会话,卡片显示「上次运行 00:16 · 成功」;编辑弹层带出原值;关掉开关变「已暂停」;删除 → 确认 → 列表为空、服务端任务为空(运行产生的会话也已删除);切到「聊天」scope 正常加载 |
| 版本 | **0.5.1(code 501)** |
---
## 0.5.0 设置「常规」分组与「通用」页(分支 `flutter`)
| 项 | 结果 |