Skip to content

skills_like 模式下用户收到的消息与 conversation history 中存储的消息不一致 #8238

@EmilyCheoh

Description

@EmilyCheoh

What happened / 发生了什么

tool_schema_mode 设置为 skills_like 时,用户收到的消息和存入 conversation history 的消息不一致。

Reproduce / 如何复现?

  1. tool_schema_mode 设为 skills_like
  2. 发送一条会触发工具调用的消息(如调用 shell 工具),且 LLM 在调用工具前会生成一段文本回复
  3. 对比用户实际收到的文本和后续 LLM 调用中上下文里存储的 assistant 消息

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

  • AstrBot 版本:v4.25.1(Docker 部署,Linux 服务器)
  • 提供商:OpenAI 兼容格式中转站
  • 消息平台:aiocqhttp(NapCat)
  • 最新版代码中确认同一问题仍然存在

OS

Linux

Logs / 报错日志

此问题不产生报错日志。问题是静默的逻辑错误——程序正常执行,但存入 history 的内容与实际发送给用户的内容不一致。

以下是关键证据:

API 调用记录(中转站后台)

skills_like 开启时,每次工具调用产生 3 次 API 请求:
time: input: 12454 output: 66 ← step() 首次 LLM 调用
time: input: 12481 output: 66 ← _resolve_tool_exec re-query(input 增加 27 token,为注入的 requery instruction)
time: input: 12690 output: 478 ← 工具执行后生成最终回复

改为 full 模式后,同样的操作只产生 2 次:
time: input: 14351 output: 481 ← step() LLM 调用(文本 + 工具调用)
time: input: 14854 output: 474 ← 工具执行后生成最终回复

上下文分裂示例

用户实际收到(NapCat 发送记录可验证):「我在你的服务器里替你跑一下。」
conversation history 中存储的(后续 LLM 调用的上下文可验证):「好的,我curl一下。」

两段文本来自两次独立的 LLM 调用,同一个 prompt,不同输出。

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions