fix: 前端消息拆分+动作消息样式+DevTools自主思考状态保持+记忆表名修复
- 侧边栏底部 "昔涟 AI" 改为 "昔涟" - 暂时禁用消息朗读按钮 - 修复前端 response 处理器:支持 gateway 发送的 content+role+msg_type 字段, 使动作消息(括号内容)正确拆分为独立的 ActionMessageBubble 显示 - 修复 DevTools 自主思考面板:5秒自动刷新后展开的思考日志不再自动折叠 - 修复 memory-service 表名不一致:memory_entries → memories, 解决 DevTools 记忆管理页面查不到 admin 用户记忆的问题 - 修复 sessionStore 解析历史消息时 msgType 未定义引用 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -147,6 +147,37 @@ func main() {
|
||||
thinker.Start()
|
||||
defer thinker.Stop()
|
||||
|
||||
// 设置主动消息推送回调(调用 Gateway 内部 API)
|
||||
gatewayURL := getEnv("GATEWAY_URL", "http://localhost:8080")
|
||||
internalToken := os.Getenv("INTERNAL_SERVICE_TOKEN")
|
||||
if internalToken != "" {
|
||||
proactiveClient := &http.Client{Timeout: 5 * time.Second}
|
||||
thinker.SetMessagePusher(func(userID, sessionID, message string) {
|
||||
reqBody, _ := json.Marshal(map[string]string{
|
||||
"user_id": userID,
|
||||
"session_id": sessionID,
|
||||
"content": message,
|
||||
})
|
||||
req, _ := http.NewRequest("POST", gatewayURL+"/api/v1/internal/proactive-message", strings.NewReader(string(reqBody)))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("X-Internal-Token", internalToken)
|
||||
resp, err := proactiveClient.Do(req)
|
||||
if err != nil {
|
||||
log.Printf("[主动消息] 推送失败: %v", err)
|
||||
return
|
||||
}
|
||||
resp.Body.Close()
|
||||
if resp.StatusCode == http.StatusOK {
|
||||
log.Printf("[主动消息] 已推送到 Gateway: user=%s, len=%d", userID, len(message))
|
||||
} else {
|
||||
log.Printf("[主动消息] Gateway 返回 %d", resp.StatusCode)
|
||||
}
|
||||
})
|
||||
log.Printf("[主动消息] 推送已启用 (Gateway=%s)", gatewayURL)
|
||||
} else {
|
||||
log.Println("[主动消息] 未配置 INTERNAL_SERVICE_TOKEN,主动消息推送已禁用")
|
||||
}
|
||||
|
||||
// 健康检查与对话API的HTTP mux
|
||||
mux := http.NewServeMux()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user