47dce276a4
- platform_silent模式接入Orchestrator记忆提取:被动观察群聊时提取值得记住的信息到对应命名空间 - post_chat后台思考注入平台观察:对话后思考也能看到群聊摘要 - QQ适配器:OneBot v11 self_id动态捕获、CQ图片URL提取、视觉+OCR并行处理 - Router解耦:ConfigName/PlatformName分离,支持多QQ实例独立连接 - 黑白名单功能:后端API + Ethend代理 + UI面板 - \n\n双换行断句:AI回复按双换行分割为多条消息按间隔发送 - @提及修复:bot自感知UID进行@检测 - 群聊上下文共享:channel-based userID避免记忆碎片化 - 消息日志显示处理后内容而非原始SSE数据 - platform-bridge Dockerfile + docker-compose.yml更新 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
61 lines
1.4 KiB
Go
61 lines
1.4 KiB
Go
package handler
|
|
|
|
import (
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"git.yeij.top/AskaEth/Cyrene/platform-bridge/internal/config"
|
|
"git.yeij.top/AskaEth/Cyrene/platform-bridge/internal/logging"
|
|
)
|
|
|
|
// LogHandler exposes message log retrieval endpoints.
|
|
type LogHandler struct {
|
|
logger *logging.Logger
|
|
store *config.Store
|
|
}
|
|
|
|
func NewLogHandler(logger *logging.Logger, store *config.Store) *LogHandler {
|
|
return &LogHandler{logger: logger, store: store}
|
|
}
|
|
|
|
func (h *LogHandler) RegisterRoutes(mux *http.ServeMux) {
|
|
mux.HandleFunc("/api/v1/logs/", h.handleLogs)
|
|
}
|
|
|
|
func (h *LogHandler) handleLogs(w http.ResponseWriter, r *http.Request) {
|
|
name := r.URL.Path[len("/api/v1/logs/"):]
|
|
if name == "" {
|
|
writeJSON(w, http.StatusBadRequest, errResp("missing platform name in path"))
|
|
return
|
|
}
|
|
|
|
// Resolve platform type from config name (e.g. "qq-home" → "qq").
|
|
platform := name
|
|
if h.store != nil {
|
|
if cfg, err := h.store.Get(name); err == nil && cfg.Platform != "" {
|
|
platform = cfg.Platform
|
|
}
|
|
}
|
|
|
|
limit := 100
|
|
if l := r.URL.Query().Get("limit"); l != "" {
|
|
if n, err := strconv.Atoi(l); err == nil && n > 0 && n <= 1000 {
|
|
limit = n
|
|
}
|
|
}
|
|
|
|
entries, err := h.logger.ReadLogs(platform, limit)
|
|
if err != nil {
|
|
writeJSON(w, http.StatusInternalServerError, errResp(err.Error()))
|
|
return
|
|
}
|
|
if entries == nil {
|
|
entries = []logging.LogEntry{}
|
|
}
|
|
writeJSON(w, http.StatusOK, map[string]interface{}{
|
|
"platform": platform,
|
|
"total": len(entries),
|
|
"logs": entries,
|
|
})
|
|
}
|