Repository navigation
Conversation
模型某一回合没调用发言工具时,会话历史里会留下一条纯文本的 assistant 记录。project_entries() 把它原样回放,模型因此把自己 未发出的文字当成已经发出的回复,后续回合继续模仿这个形态、 不再调用 say / react,表现成只旁听不说话。 投影时把这类记录改标为只读的用户备注,模型仍能看到自己想过什么, 但不再模仿这种写法;带 tool_calls 的记录保持原样,避免 tool 结果 失去对应的 assistant 调用。
… clipping - media/images.py: sample up to 6 evenly spaced frames from an animated image into a 3x2 contact sheet instead of describing only the first frame. Sticker collection explicitly keeps a single frame so the sticker library and candidate sheets are not polluted by grids. - next/media/images.py + next/chat/tools.py: pass the frame mode through the subprocess worker, rename the misleading animated_first_frame_only field, and tell the vision model to read the grid as one scene over time. - prompts/next_response_choice.md: when the peer sends only an image with no text, answer with a single sticker via react; screenshots, error dumps and walls of text still get a normal reply. - next/launcher.py: add CREATE_NO_WINDOW for the Windows host child process so the service no longer opens a persistent console window; CTRL_BREAK based shutdown keeps working. - next/platform/messages.py: clip group cards longer than 16 characters, fall back to the QQ number for blank cards, and skip the empty-body line. Verified against the 0.2.7 release package: all 22 local patches apply cleanly, compileall passes. No automated tests are included yet.
LEN5010
requested changes
Nov 16, 2026
LEN5010
left a comment
Collaborator
There was a problem hiding this comment.
感谢排查和复现。这个 PR 现在包含两个提交,第二个(dcc87795)和标题无关,麻烦拆出去单独提。下面分开说。
提交 1:纯文本 assistant 投影
纯文本结尾是设计好的不发言方式:next_mind.md 写明普通文字是内部想法,不需要回应就直接结束本轮;next_response_choice.md 也把旁听列为完整的选择。现在的前缀 不要模仿这种写法,要开口必须调用 say 工具 会把所有正常的旁听记录变成反例,模型容易在不该说话时开口。我这边实例里的这类记录基本都是正常旁听,被直接 @ 时也几乎都有回复,目前还看不出这个改动的收益能抵消副作用。
希望这样调整:
- 投影后的说明改成中性描述,只说明这是上一轮没有发出的想法,不写禁止模仿和必须调用 say。文本放进
src/len_bot/prompts/下的模板文件,让面板的提示词设置能覆盖。 - 按 CONTRIBUTING 先把问题提炼成回放用例,再做改动前后对照。至少覆盖三类:被 @ 时应该回答、群友之间闲聊时应该旁听、连续几轮旁听后被点名。最好在复现问题的 DeepSeek 和另一个模型上各跑一次。
- 测试不直接调用私有方法
_unspoken_thought,也不断言提示词原文,改成通过project_entries检查投影结果的角色,以及工具调用和结果的配对。
关于写入时就不存这类消息:建议继续存,压缩回想和换角色交接都要读这些记录,在投影层处理就好。
提交 2:建议拆成独立 PR,逐项处理
- 动图抽帧拼图:方向可以。
look处理过的图片会缓存复用,升级前缓存的动图只有第一帧,升级后也会被标成animated_grid: true,需要处理这部分旧数据。 - 群名片截断:
_display_name里的card or nickname在名片是纯空格时会选中名片,去掉空格后返回None,有昵称也只显示 QQ 号。另外请去掉代码里的[local patch]标记。 - Windows
CREATE_NO_WINDOW:注释提到的桌面启动程序不在仓库里,上游的启动方式是run.cmd/run.ps1和计划任务。子进程拿到独立的隐藏控制台后,launcher 发出的CTRL_BREAK_EVENT可能传不到宿主,宿主日志也可能不再显示在终端窗口里。需要在 Windows 上实测 Ctrl+C 停止、面板重启和部署包启动之后再考虑合并。 - 只发图就回表情的提示词:和群聊里的旁听规则冲突,群友随手发张图也可能被接一张表情。这条先不收;如果确实需要,请附上回放对照。
另外,提交信息请沿用仓库的中文惯例。
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
某一轮里模型没有调用发言工具(
say/react),而是直接输出了正文,这条消息会以「无tool_calls的 assistant 纯文本」形式留在会话历史中。ChatContext.project_entries()把它原样投影回下一轮上下文。模型于是看到「上一轮 assistant 已经说过话」,形成 few-shot 示范,后续回合继续用同样格式写字、不调用say。表现出来就是:群里在聊,它一直旁听;面板回合卡片里finish_reason=stop且没有say步骤,正文全被当成内部想法丢掉。历史里这类条目越多,示范越强,自持循环越难打破——它不会自己恢复,只能清库或改投影。
复现
tool_calls(未走 outlet)finish_reason=stop;改后 5/5finish_reason=tool_calls,正常调用say改动
ChatContext.project_entries()增加一步_unspoken_thought:role == 'assistant'且没有tool_calls、content为非空字符串 → 投影为role: 'user',正文前加一行说明:这是上一轮未发出的内部想法,不是发言,不要模仿这种写法tool_calls的 assistant 条目保持原样,保证紧随其后的 tool 消息仍有对应的前置 assistant 调用可配对content不动再加三个单测覆盖上面三条分支。
影响面
assistant继续留着、只加前缀,模型仍会学到「assistant 能直接写字」,所以这里必须换成user验证
新增
tests/test_next_unspoken_thought.py,三个用例在打过同一改动的本地安装上 3/3 通过。如实说明:提交环境里没有装好项目依赖(无法
uv sync),完整pytest/ruff没能在本地跑,需要 CI 复核;行为侧的改动前后对照是在真实 QQ 会话上做的。未确认
finish_reason=stop这条路径,没覆盖其它模型的异常终止组合