[Feature] 用户识别标识的位置:内联前缀 vs 尾部 system_reminder
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Read astrbot/core/config/default.py and astrbot/core/astr_main_agent.py to compare the identifier hint with where the reminder is added; then inspect openai_source.py and builtin_stars/astrbot/group_chat_context.py for the content-block and formatting context. This issue is explicitly for discussion, not a PR, and leaves the desired behavior undecided, so there is no implementation or test-defined completion criterion yet.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
功能描述
功能描述
provider_settings.identifier(面板:配置 → AI → 用户识别)的 UI 文案与实现不一致,且实现位置对"让模型区分发言人"这个目标可能不是最优。想就此发起一次讨论。
文案(astrbot/core/config/default.py:4173,v4.29.3 与 master 一致):
"provider_settings.identifier": {
"description": "用户识别",
"type": "bool",
"hint": "在用户提示词前带上用户 ID 信息。",
},
实现(astrbot/core/astr_main_agent.py → _append_system_reminders):
if cfg.get("identifier"):
user_id = event.message_obj.sender.user_id
user_nickname = event.message_obj.sender.nickname
system_parts.append(f"User ID: {user_id}, Nickname: {user_nickname}")
system_parts 最终拼成 <system_reminder>...</system_reminder>,经 req.extra_user_content_parts 走 assemble_context() 追加到 content_blocks 末尾。openai_source.py 里对应位置也注明「用户原始发言在前,额外内容块在后」。
也就是说,实际位置在用户原话之后,与文案写的"前"相反。
(group_name_display 的 hint 同样写"前",实现同理,属于同一模式,可一并考虑。)
使用场景
群聊里希望模型准确判断"这句话是谁说的"。
两种位置的差异:
- 尾部独立块:标识与消息内容在结构上分离(同一条 message 的不同 content block),模型需要做相邻关联。群里连续多条发言、交叉对话、互相引用时,存在错配的空间。
- 内联前缀:标识与内容在同一字符串内,物理上不可分离,关联更直接。
补充一点实测数据,供讨论参考。若改为内联 f"{nickname}: {prompt}",昵称自带冒号会产生歧义。某 700 条真实群聊记录里,29 位发言人中有 4 位昵称含冒号(约 14%):
增强:123sdx53228
求崩:Cartethyia_Ni
增强🆔:doro994645(职业进度21
增强:芣婹説話,閉仩觜妑
拼出来是 增强:123sdx53228: 我来了,可被读作「'增强' 说:123sdx53228: 我来了」。
而群聊上下文注入用的 _format_message(builtin_stars/astrbot/group_chat_context.py)是 [昵称/时间]: 内容,方括号把昵称整体框住,恰好规避了这类歧义——同样是内联,包装方式值得对齐。
建议(供参考,不代表必须这么做)
- 最低成本:让文案与实现一致。要么改 hint 的"前",要么改实现位置。
- 若倾向内联,建议用
[昵称]: 内容,与注入块[昵称/时间]:保持同一套包装,避免昵称含冒号时的歧义。 - 无论选哪种,都可以考虑在 system prompt 补一句格式说明(例如「
[昵称]:前缀表示发言人,昵称可能重复」),让模型知道如何解读,收益比单纯换位置更大。 - 附带说明:位置不影响前缀缓存。两种做法都在当前 user message 内部,不改变历史前缀,只影响模型对发言人的归因。
声明
本 issue 由AI代写,仅为讨论与建议,不打算提交 PR。是否调整、怎么调整,交由维护者判断。
使用场景
No response
检查清单
- Ngôn ngữ chính
- Python
- Star
- 46.4k
- Fork
- 3.4k
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 120
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AstrBotDevs/AstrBot
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
AstrBotDevs/AstrBot#11038 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
AstrBotDevs/AstrBot#11034 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
AstrBotDevs/AstrBot#10999 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] OpenAI-compatible Gemini 工具 schema const 导致 400Có thể đã có người làm @arccat-114 đã nhận 17 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
AstrBotDevs/AstrBot#10720 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] Discord slash command sync aborts with KeyError when a plugin handler is defined in a submoduleCó thể đã có người làm @yuexia5 đã nhận 22 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
AstrBotDevs/AstrBot#10626 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của AstrBotDevs/AstrBot
Issue tương tự
-
area: providers/aws priority: p2 size: S type: bug type: testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
finos/open-resource-broker#851 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
sandialabs/atlas-ui-3#1196 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ShaftHQ/SHAFT_ENGINE#7902 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: GraphML export writes invalid XML when a value contains a control character (e.g. form feed)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
topoteretes/cognee#6646 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
DOI-USGS/pywatershed#428 ·