fix: 消息日志增强 + 历史消息抑制 + SSE实时追踪 + 群聊上下文优化
- 日志:收/发消息均显示群名称,管理员显示真实QQ昵称而非"开拓者" - 历史消息:服务重启后NapCat回放的历史消息不再触发回复,静默注入上下文 - 消息时间戳:转发给AI时附带【消息时间: HH:MM:SS (XmXs前)】标记 - ♪ 分割符:QQ消息支持♪作为句子断点 - AI-Core SSE端点:全链路追踪实时推送,ethend不再5秒轮询 - 群聊上下文:AI-Core明确被告知消息来自群聊,以实际发送者为主语 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -117,12 +117,13 @@ func NewOrchestrator(
|
||||
|
||||
// ProcessParams 处理参数
|
||||
type ProcessParams struct {
|
||||
UserID string
|
||||
SessionID string
|
||||
Message string
|
||||
Images []string // 图片 base64 data URL (多模态)
|
||||
Mode string // text / voice_msg / voice_assistant
|
||||
Nickname string
|
||||
UserID string
|
||||
SessionID string
|
||||
Message string
|
||||
Images []string // 图片 base64 data URL (多模态)
|
||||
Mode string // text / voice_msg / voice_assistant
|
||||
Nickname string
|
||||
ChannelType string // direct / group
|
||||
}
|
||||
|
||||
// ProcessResult 处理结果
|
||||
@@ -334,6 +335,7 @@ func (o *Orchestrator) ProcessInput(
|
||||
PersonaPrompt: systemPrompt,
|
||||
DialogHistory: history,
|
||||
Mode: params.Mode,
|
||||
ChannelType: params.ChannelType,
|
||||
}
|
||||
if prevEnrichment != nil {
|
||||
synthParams.MemorySummary = prevEnrichment.MemorySummary
|
||||
|
||||
@@ -45,6 +45,7 @@ type SynthesizeParams struct {
|
||||
KnowledgeInfo string // 知识库检索摘要
|
||||
PendingToolResults []PendingToolResult // 上一轮异步完成的工具结果
|
||||
Mode string // text / voice_assistant
|
||||
ChannelType string // direct / group
|
||||
}
|
||||
|
||||
// Synthesize 综合所有子会话结果,流式生成最终回复。
|
||||
@@ -210,7 +211,15 @@ func (s *Synthesizer) buildSynthesizeMessages(params SynthesizeParams) []model.L
|
||||
Content: systemPrompt,
|
||||
})
|
||||
|
||||
// 注入记忆摘要
|
||||
// 群聊上下文:当消息来自群聊时,告知模型这是一条群聊消息而非一对一私聊。
|
||||
if params.ChannelType == "group" {
|
||||
messages = append(messages, model.LLMMessage{
|
||||
Role: model.RoleSystem,
|
||||
Content: "【群聊上下文】这条消息来自QQ群聊。消息前缀 [群聊 群号] 昵称 (QQ号) 标注了真实发送者。你不是在和开拓者一对一私聊,而是在群聊中和不同成员交流。请用发送者的真实名字称呼,不要叫所有人开拓者或叶酱。只在对你说话或延续已有对话时才回复。",
|
||||
})
|
||||
}
|
||||
|
||||
// 注入记忆摘要// 注入记忆摘要
|
||||
if params.MemorySummary != "" && !strings.Contains(params.MemorySummary, "没有找到") {
|
||||
messages = append(messages, model.LLMMessage{
|
||||
Role: model.RoleSystem,
|
||||
|
||||
Reference in New Issue
Block a user