Commit Graph

57 Commits

Author SHA1 Message Date
liuwei
66b0fe16da 拆分群昵称与正文避免话题识别被昵称污染 2026-04-24 15:19:14 +08:00
liuwei
5dc72bf7d2 放宽最近上下文到30条并取消中途截断 2026-04-24 15:12:42 +08:00
liuwei
cd2024dfb5 优化 ai_auto_response 仅回复同群最新消息
- 为同群消息引入递增序号,记录当前群的最新消息版本
- 在出队前跳过已被同群更新消息覆盖的旧消息
- 在发送前再次检查消息是否已被覆盖,避免 LLM 慢返回后补发旧回复
- 保持实现仅影响同一群内的消息时效,不干扰其他群的并行处理
2026-04-24 15:06:05 +08:00
liuwei
7cee7a99e2 优化 ai_auto_response 队列过期丢弃与超时策略
- 为 ai_auto_response 队列消息记录入队时刻,并增加消息过期丢弃机制
- 在出队前与发送前各检查一次消息是否过期,避免补发过时群聊回复
- 为 skip 日志补充 age 字段,便于观察排队老化情况
- 将 ai_auto_response 外层总超时收紧到 20 秒,并新增 message_expire_sec=12 配置
- 将 Dify auto_reply.group 请求超时收紧到 15 秒,并关闭重试以提升群聊时效性
2026-04-24 15:03:35 +08:00
liuwei
f593f5dd90 优化 ai_auto_response 模型侧定向辱骂响应策略
- 增加 directed abuse 场景识别,只作为模型输入信号,不做本地硬编码回复
- 在触发与规划层为定向挑衅场景单独标记,并强制走 social_short 短回复模式
- 将 abuse_directed 信号写入 Dify control,帮助模型稳定识别被点名挑衅场景
- 优化 Dify 主提示词与保守降级提示词,要求 abuse_directed 时默认短回且不要空掉
- 保持回复仍由模型生成,避免本地模板化回复暴露机器人痕迹
2026-04-24 14:44:33 +08:00
liuwei
23544dca7a 优化 ai_auto_response 拟人化短回复并统一走 Dify 链路
- 移除普通 chat 调用分支,统一通过 Dify 请求生成回复
- 收紧小牛人格描述,强化短句、熟人感和非客服式表达
- 新增提示策略,按场景启用成员记忆/群事实/向量记忆,降低记忆压迫感
- 下调回复长度与上下文压缩配置,使默认回复更接近 10 字级别
- 通过 compileall 验证 ai_auto_response 插件语法可用
2026-04-24 14:12:26 +08:00
liuwei
5eb1e3294f 优化ai_auto_response提示词与短回复策略:场景优先级、防冲突压缩、记忆相关性筛选、可配置长度限制
- 增加场景优先级规则,技术群优先结论与排查点,降低人设冲突\n- Dify 入参新增上下文压缩、画像与记忆去重、低相关记忆过滤\n- 回复后处理支持配置化长度阈值,并增加总字数上限裁剪\n- 新增 prompt_compact/reply 配置项,便于后续按群微调
2026-04-16 11:24:41 +08:00
liuwei
b4b3fa92e0 优化ai_auto_response回复长度并强化@画像回复
变更项:

1. 收紧回复长度策略:social_short/qa_fast/qa_with_context 全部缩短,减少长句与说明文风格。

2. 强化提示词约束:默认30字内、最多2句且总长不超过55字,禁止大段铺垫。

3. 新增@画像高优先通道:当消息为@或强定向时,构建并注入 at_member_profile_prompt。

4. Dify输入同步注入@画像与 is_at/is_directed 控制字段,保证不同LLM后端行为一致。
2026-04-16 11:03:55 +08:00
liuwei
bac8a01ed8 调整ai_auto_response为非阻断模式
变更项:

1. 修改 ai_auto_response.process_message 的返回策略。

2. 消息入队成功时由 processed=True 改为 processed=False,避免截断后续插件链。

3. 队列满时同样不阻断,让其他插件继续处理消息。
2026-04-16 09:56:05 +08:00
liuwei
265f3835b4 已按你说的改成“命中即跳出 + 后台入队处理”,插件调度仍然是独占策略,没有做并行插件处理。
主要改动在 main.py:

process_message(...) 现在只做入队,立刻返回 True, "queued",主链路立即释放。
原来的完整处理逻辑迁到 _process_message_impl(...),由后台 worker 消费队列执行。
新增队列 worker 循环 _message_worker_loop(...),并在 start()/stop() 管理生命周期。
增加 _ensure_workers_started(),避免插件在无事件循环阶段 create_task 报错(延迟到有 loop 时启动)。
保留了之前的 LLM 防阻塞措施:to_thread + semaphore + timeout。
配置也加在 config.toml 的 [runtime]:

llm_max_concurrency = 3
llm_call_timeout_sec = 120
queue_worker_count = 2
queue_maxsize = 500
已做语法校验:py_compile 通过。
2026-04-15 10:23:05 +08:00
liuwei
5e80287530 切换到dify,还是不要直连,dify更方便 2026-04-10 16:41:14 +08:00
liuwei
a1aa05e3b9 feat(ai_auto_response): add admin-controlled persona switching 2026-04-10 13:15:35 +08:00
liuwei
3f9ae6442d tighten ai_auto_response participation and spam guard 2026-04-10 09:56:34 +08:00
liuwei
42b2014f12 unify plugin llm clients on shared utils layer 2026-04-10 09:13:42 +08:00
liuwei
c0620e6cee shrink ai_auto_response prompt pipeline 2026-04-10 09:04:22 +08:00
liuwei
f580c69736 refactor ai_auto_response plugin architecture 2026-04-09 17:46:30 +08:00
liuwei
cc65378544 feat(ai_auto_response): handle image follow-up more safely 2026-04-09 10:06:39 +08:00
liuwei
67eec32f7f unify xiaoniu topic selection and reply planning 2026-04-08 09:23:10 +08:00
liuwei
8ead2c43bf stabilize xiaoniu anti-spam and silent defenses 2026-04-08 08:53:47 +08:00
liuwei
3d56b3895a harden xiaoniu defenses and directed cooldowns 2026-04-07 17:26:13 +08:00
liuwei
02bde14d52 improve xiaoniu reply chunk splitting 2026-04-07 16:48:00 +08:00
liuwei
c8a7958e2b move xiaoniu runtime logs to debug 2026-04-07 16:25:34 +08:00
liuwei
2b6deff4ba filter invalid xiaoniu model echoes 2026-04-07 16:06:52 +08:00
liuwei
58faa4322c fix xiaoniu mention gating and vector memory config 2026-04-07 16:00:31 +08:00
liuwei
fabcb92f3f use richer member memory in xiaoniu replies 2026-04-07 15:47:32 +08:00
liuwei
0ac08c45c0 tune xiaoniu address style by group 2026-04-07 15:38:52 +08:00
liuwei
a29b625bc6 refine xiaoniu natural name mentions 2026-04-07 15:37:01 +08:00
liuwei
19d2938870 improve xiaoniu recipient cues and name-prefixed replies 2026-04-07 15:32:38 +08:00
liuwei
5a02121ace allow multi-part replies for xiaoniu qa responses 2026-04-07 14:39:41 +08:00
liuwei
42feb29a40 add dota2 match history boundary for xiaoniu 2026-04-07 14:12:48 +08:00
liuwei
daf5170008 tune xiaoniu mention reply behavior 2026-04-07 14:09:31 +08:00
liuwei
acf3177571 use latest group image for xiaoniu image followups 2026-04-07 14:00:08 +08:00
liuwei
7c12738967 add multimodal quote handling for xiaoniu bot 2026-04-07 13:51:15 +08:00
liuwei
d507cdf88d improve xiaoniu group awareness and solver suppression 2026-04-07 12:27:53 +08:00
liuwei
faa5d68eb0 increase xiaoniu prompt context window to 30 messages 2026-04-07 12:21:51 +08:00
liuwei
1996df7b99 add group-aware persona bias for xiaoniu bot 2026-04-07 12:10:47 +08:00
liuwei
d6abb1cc23 tighten xiaoniu reply triggers for direct mentions only 2026-04-07 11:50:30 +08:00
liuwei
8476149a2d tune xiaoniu reply brevity and flow thresholds 2026-04-07 11:36:02 +08:00
liuwei
d616846098 refactor ai_auto_response into xiaoniu group bot 2026-04-07 11:15:29 +08:00
liuwei
4cac7c04a0 优化ai消息内容 2026-02-02 16:02:44 +08:00
liuwei
a5c0d70b9f 优化自动对话逻辑 2026-02-02 14:20:43 +08:00
liuwei
1a2ca4f808 优化自动对话逻辑 2026-02-02 14:05:13 +08:00
liuwei
428d1701d0 优化自动对话逻辑 2026-02-02 14:03:12 +08:00
liuwei
5be3be48bf 优化自动对话逻辑 2026-02-02 13:34:32 +08:00
liuwei
34230e60ab 优化markdown to_image 逻辑 2026-01-29 10:32:01 +08:00
liuwei
c6a0679741 调整日志级别 2026-01-16 13:34:37 +08:00
liuwei
79d174649b 调整日志级别 2026-01-16 13:29:52 +08:00
liuwei
e650e23ab4 作者调整 2025-07-29 15:57:31 +08:00
liuwei
9d15bf965b 临时调整权限模块,备份 2025-06-09 14:12:31 +08:00
liuwei
4b99ba4c7c 优化配置 2025-06-05 11:25:14 +08:00