Skip to content

Group context ignores JSON share cards #9654

Description

@PeiPei233

Description

The built-in GroupChatContext ignores group messages that contain only a Json component. This is common for QQ share cards (for example, Xiaohongshu links). As a result, a later reaction such as "wow" reaches the LLM without the shared card in its group context.

The aiocqhttp adapter preserves the OneBot json segment as a Json component, but Main.on_message() only forwards Plain and Image messages to GroupChatContext, and _format_message() has no Json branch.

Steps to reproduce

  1. Enable built-in group context awareness for an aiocqhttp group.
  2. Send a QQ share card whose OneBot message contains only a json segment.
  3. Send a short follow-up message that refers to the card.
  4. Inspect the group context attached to the LLM request.

Actual behavior

The event bus receives the card as [ComponentType.Json], but the card is absent from the group context. The LLM only sees the short follow-up and older messages.

Example log sequence:

[10:49:06] user: [ComponentType.Json]
[10:49:55] user: wow

The LLM request created for the follow-up contains no entry for the 10:49 JSON card.

Expected behavior

JSON share cards should be recorded as a compact, readable context entry using common QQ card metadata such as title, description, and target URL. Unknown card formats should retain a generic placeholder rather than exposing the complete raw payload.

Environment

  • AstrBot v4.27.3
  • aiocqhttp / OneBot v11
  • NapCat

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:platformThe bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions