基于clawdbot的个人智能助理这个项目,其实在功能方面,可以使用我还在开发的apms项目的任务项功能进行扩展。
apms系统是一个用来辅助AI智能体管理和开发项目的一个系统,基于 Protocol Buffers + GORM + SQLite 的敏捷项目管理系统后端API。
在技术栈的选择方面,因为要考虑多平台的数据兼容,数据包的封装和存储,使用Protocol Buffers来实现的话,可以很轻松的完成web平台,服务后端,esp32等设备的数据兼容。Golang可以开发出占用资源很小的服务后端,SQLite也是占用很少的资源,同时这个数据库的数据量不会特别大,访问并发数也很少,所以直接选资源最小化的一个实现方式。
它的目录结构是这样的:
backend/ ├── main.go # 主入口文件 ├── go.mod # Go模块依赖 ├── go.sum # Go依赖锁定文件 ├── Makefile # 构建脚本 ├── apms.sh # 启动脚本 ├── cmd/ # 命令行工具和启动器 │ ├── common/ # 通用命令工具 │ ├── seed/ # 种子数据生成命令 │ ├── start/ # 服务启动命令 │ └── verify/ # 系统验证命令 ├── config/ # 配置文件 │ └── environments.yaml # 多环境配置 ├── internal/ # 内部包(不对外暴露) │ ├── api/ # API路由和处理器 │ ├── models/ # 数据模型定义 │ ├── services/ # 业务逻辑层 │ ├── database/ # 数据库配置和连接 │ └── utils/ # 工具函数 ├── generated/ # 自动生成的代码 ├── public/ # 静态文件 ├── data/ # 数据库文件目录 ├── logs/ # 日志文件目录 ├── backups/ # 备份目录 └── bin/ # 编译后的可执行文件
其中任务项的数据结构定义如下:
message TodoItem {
option (gorm.opts).ormable = true;
uint32 id = 1 [(gorm.field).tag = {primary_key: true, auto_increment: true}];
string title = 2 [(gorm.field).tag = {type: "varchar(255)", not_null: true}];
string description = 3 [(gorm.field).tag = {type: "text"}];
TodoItemStatus status = 4 [(gorm.field).tag = {type: "int", default: "1"}];
TodoItemPriority priority = 5 [(gorm.field).tag = {type: "int", default: "2"}];
uint32 user_story_id = 6 [(gorm.field).tag = {not_null: true, index: "idx_todo_item_user_story_id"}];
uint32 assignee_id = 7 [(gorm.field).tag = {index: "idx_todo_item_assignee_id"}];
double estimated_hours = 8 [(gorm.field).tag = {type: "decimal(10,2)"}];
double actual_hours = 9 [(gorm.field).tag = {type: "decimal(10,2)"}];
double remaining_hours = 10 [(gorm.field).tag = {type: "decimal(10,2)"}];
google.protobuf.Timestamp created_at = 11 [(gorm.field).tag = {type: "datetime"}];
google.protobuf.Timestamp updated_at = 12 [(gorm.field).tag = {type: "datetime"}];
google.protobuf.Timestamp completed_at = 13 [(gorm.field).tag = {type: "datetime"}];
}经过简单开发后,添加了一些简单的测试数据。
然后esp32这边,使用lvgl + 图片的形式,设计成简单的提示UI就可以了。
UI界面方面,使用之前简单设计的弹射世界物语的游戏背景图做背景,大致效果如下:

通知提示的效果如图

Stella是弹射直接里,从开始到运营结束,一直陪伴用户的引导角色,虽然这个手游很小众,也停止运营了。
这个游戏的背景图和角色图,都是使用256色进行设计的,在存储方面,可以占用更小的体积。
解决了界面显示的问题,现在就考虑一下AI辅助的一些内容,最近clawdbot(openclaw)非常出名,我们就用它来实现吧。
首先在树莓派5上一键安装openclaw,直接在命令行执行
pnpm add -g openclaw@latest

安装完成后,运行配置命令,根据提示选择,配置即可
openclaw onboard --install-daemon
在设置好API-KEY后,就可以通过web后台,登录openclaw来开启对话和运行任务了。
然后,我们需要创建一个定期执行的任务,来定期查询sqlite数据库文件里的待执行事项,找到对应事项后,通过golang写的socket工具发送到esp32手表上,存储这个提醒信息。

在设置完这些内容后,我们就可以继续优化esp32的消息接收和存储方式,完成这个任务提醒的功能了。
我要赚赏金
