跳到主要内容

发送队列

队列是青柚桌面助手的核心机制:内容入队后分组管理,一个快捷键逐条发完。

数据模型​

待发送项(QueueItem)​

字段类型说明
idstring唯一标识
kindfile / text内容类型
contentstring文字内容或文件本地路径
labelstring显示名
groupstring分组名,缺省 default

已发送项(SentItem)​

在待发送项基础上增加:

字段类型说明
sent_atnumberUnix 时间戳
sent_at_readablestringYYYY-MM-DD HH:MM:SS 可读时间

状态流转​

入队 (POST /queue)
↓
待发送列表 (GET /queue)
↓ 按快捷键或调用 send-next
写入剪贴板 → Ctrl+V → Enter
↓
已发送列表 (GET /queue/sent)
↓ 出错时还原
待发送列表 (POST /queue/restore)

已处理项不会再被发送 —— take_next 取出队首的同时移入已发送列表,所以重复按快捷键不会重发同样内容。

分组​

# 查看所有分组
curl http://localhost:8722/api/v1/queue/groups

# 切换激活分组(快捷键只发当前激活分组)
curl -X POST http://localhost:8722/api/v1/queue/active-group \
-H "Content-Type: application/json" \
-d '{"group":"batch-1"}'

分组用途:把不同批次的内容隔开。比如 batch-1 是给客户 A 的 5 个文件,batch-2 是给客户 B 的 3 个文件,切换分组即可分别发送。

持久化​

队列状态写入 SQLite(queue_items / queue_sent 表),应用重启后自动恢复:

  • 待发送项完整恢复(含分组)
  • 已发送项恢复(含时间戳)

API 一览​

方法路径说明
POST/api/v1/queue入队
GET/api/v1/queue查看待发送
DELETE/api/v1/queue/{id}移除指定项
POST/api/v1/queue/send-next发送下一项
POST/api/v1/queue/clear清空当前激活分组
GET/api/v1/queue/groups所有分组
GET/api/v1/queue/active-group当前激活分组
POST/api/v1/queue/active-group切换激活分组
GET/api/v1/queue/sent已发送列表
POST/api/v1/queue/restore还原已发送项
GET/api/v1/queue/mode发送模式
POST/api/v1/queue/mode设置发送模式
GET/api/v1/queue/timing发送节奏配置
POST/api/v1/queue/timing调整发送节奏

发送模式​

模式行为
auto(默认)一次触发发完整个激活分组
single每次触发只发一条
curl -X POST http://localhost:8722/api/v1/queue/mode \
-H "Content-Type: application/json" \
-d '{"mode":"single"}'

发送节奏(防风控)​

所有延时均为随机区间,固定节奏容易被判定为机器行为:

参数默认区间作用
paste_settle_ms250–700文字粘贴后等待
file_settle_ms400–900文件附件就绪等待
item_gap_ms600–2600条间间隔

另有触发前 200–1200ms「思考」停顿。

curl -X POST http://localhost:8722/api/v1/queue/timing \
-H "Content-Type: application/json" \
-d '{"gap_min":1500,"gap_max":5000}'

逐字输入模拟​

开启后文字不再整段粘贴,而是逐字输入:

每字符间隔 40–160ms 随机
+ 标点后额外 120–400ms
+ 约 4% 概率出现 300–1200ms 长停顿
curl -X POST http://localhost:8722/api/v1/queue/timing \
-H "Content-Type: application/json" \
-d '{"typing_sim":true}'
逐字输入会显著拖慢速度

每字符约 100ms,100 字约 10 秒。适合少量重要消息,不适合大批量。

大批量发送建议​

  • 单次触发控制在 20 条以内,分多轮发送
  • item_gap_ms 拉到 1500–5000 或更宽
  • 重要消息可开启 typing_sim