Files
Cyrene/backend/platform-bridge/internal/handler/blocklist_handler.go
T
AskaEth 47dce276a4 fix: platform_silent记忆提取 + 群聊上下文整合 + 多QQ实例支持
- 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>
2026-05-31 09:37:18 +08:00

45 lines
1.2 KiB
Go

package handler
import (
"encoding/json"
"net/http"
"git.yeij.top/AskaEth/Cyrene/platform-bridge/internal/config"
)
// BlocklistHandler exposes CRUD for blocklist settings.
type BlocklistHandler struct {
store *config.BlocklistStore
}
func NewBlocklistHandler(store *config.BlocklistStore) *BlocklistHandler {
return &BlocklistHandler{store: store}
}
func (h *BlocklistHandler) RegisterRoutes(mux *http.ServeMux) {
mux.HandleFunc("/api/v1/settings/blocklist", h.handleBlocklist)
}
func (h *BlocklistHandler) handleBlocklist(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "GET":
writeJSON(w, http.StatusOK, h.store.Get())
case "POST", "PUT":
var bs config.BlocklistSettings
if err := json.NewDecoder(r.Body).Decode(&bs); err != nil {
writeJSON(w, http.StatusBadRequest, errResp("invalid JSON: "+err.Error()))
return
}
if err := h.store.Set(bs); err != nil {
writeJSON(w, http.StatusBadRequest, errResp(err.Error()))
return
}
writeJSON(w, http.StatusOK, map[string]interface{}{
"status": "saved",
"settings": h.store.Get(),
})
default:
writeJSON(w, http.StatusMethodNotAllowed, errResp("method not allowed"))
}
}