[Feature] 用户识别标识的位置:内联前缀 vs 尾部 system_reminder
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
功能描述
功能描述
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
检查清单
- Lenguaje dominante
- Python
- Estrellas
- 46.4k
- Forks
- 3.4k
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 120
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de AstrBotDevs/AstrBot
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
AstrBotDevs/AstrBot#11038 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
AstrBotDevs/AstrBot#11034 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
AstrBotDevs/AstrBot#10999 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] OpenAI-compatible Gemini 工具 schema const 导致 400Posiblemente ocupada @arccat-114 la tomó hace 17 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
AstrBotDevs/AstrBot#10720 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] Discord slash command sync aborts with KeyError when a plugin handler is defined in a submodulePosiblemente ocupada @yuexia5 la tomó hace 22 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
AstrBotDevs/AstrBot#10626 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de AstrBotDevs/AstrBot
Issues similares
-
area: providers/aws priority: p2 size: S type: bug type: testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
finos/open-resource-broker#851 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
sandialabs/atlas-ui-3#1196 ·
Los mantenedores suelen responder en 1 día
-
enhancement triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ShaftHQ/SHAFT_ENGINE#7902 ·
Los mantenedores suelen responder en 1 día
-
[Bug]: GraphML export writes invalid XML when a value contains a control character (e.g. form feed)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
topoteretes/cognee#6646 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
DOI-USGS/pywatershed#428 ·