feat: 管理面板补齐(RAG导入/记忆添加/会话接history/诚实表述) + design/16 §4.6 IM多会话隔离+第三方身份+黑白名单
agent-98 面板批次:
- 会话管理面板改接 history.ListSessions(主web+次级) + 新建次级会话按钮
- 记忆面板手动添加入口 POST /admin/memories(owner)
- 知识库真正实现 IndexDocument(分块+落projectindex) + POST /admin/rag 导入端点
- 三面板空态诚实表述(去除'后端M10+提供')
- RAG嵌入降级到keyword/line(无直属embedder,不伪造语义,符合红线)
agent-99 design/16 §4.6:
- model.Message.SenderName + 迁移0006 sender_name 列
- 第三方身份边界: session.ResolveActor判定(非LLM猜) + [第三方·昵称]前缀(不改源content)
- 群聊/陌生人落独立sess-xxx(persistIsolated),不写主会话,不广播
- 黑/白名单(allowGroups/denyGroups/allowUsers/denyUsers)最前拦截,不进LLM
- 多账号 CHANNELS_JSON 配置 + 每平台多实例
- 管理只读 GET /admin/channels/{platform}/messages(该平台非主人消息流)
实机验证(JWT): 会话管理返回主会话web / 记忆添加成功 / RAG导入documents非空+Cyrene命中; 后端build/vet/test全绿 + 前端build绿
This commit is contained in:
1 parent
37e98ec584
commit
9c2a37c4ac
32 files changed
+1768
-136
No files matched your search
@@ -33,6 +33,7 @@ type Config struct {
|
||||
ExecSandbox ExecSandbox
|
||||
MCP MCPConfig
|
||||
Capacity CapacityConfig
|
||||
Channels ChannelsConfig
|
||||
}
|
||||
|
||||
// ServerConfig holds the single gateway listener settings.
|
||||
@@ -154,6 +155,46 @@ type MCPServer struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
}
|
||||
|
||||
// ChannelsConfig holds optional multi-account IM channel settings (design/16
|
||||
// §4.6 §5). The single-account credentials are read from CHANNEL_<NAME>_* env
|
||||
// vars in cmd/cyrene/channels.go; this block carries the optional multi-account
|
||||
// registry plus the per-account allow/deny black-or-white lists via a JSON
|
||||
// string (the reflection-based loader only supports scalars and []string, so a
|
||||
// structured value is passed as JSON — matching the MCP and Capacity configs).
|
||||
type ChannelsConfig struct {
|
||||
// AccountsJSON is the JSON shape map[platform]→[]ChannelAccount, e.g.
|
||||
// {"telegram":[{"id":"conf0","config":{"bot_token":"..."},
|
||||
// "denyUsers":["12345"]}]}. Empty means the single-account env path applies.
|
||||
AccountsJSON string `env:"CHANNELS_JSON"`
|
||||
}
|
||||
|
||||
// ChannelAccount is one IM access config (one account) for a platform. It pairs
|
||||
// an id (used to name the adapter instance and to build the platform:confId
|
||||
// account key) with the platform-specific credential map and the allow/deny
|
||||
// black-or-white lists applied at the channelbridge ingress (design/16 §4.6), so
|
||||
// a blacklisted or non-whitelisted group/user never reaches the LLM.
|
||||
type ChannelAccount struct {
|
||||
// ID is the local config id, unique within its platform. It names the adapter
|
||||
// instance and the platform:confId account key (design/16 §4.5 deviceID).
|
||||
ID string `json:"id"`
|
||||
// Config is the platform-specific credential/feature map decoded into the
|
||||
// adapter's typed Config (bot_token, base_url, remote_url, ...). Missing keys
|
||||
// fall back to the adapter's own zero values.
|
||||
Config map[string]any `json:"config,omitempty"`
|
||||
// AllowGroups, when non-empty, is a white list of group ids: a group message
|
||||
// is dropped unless its GroupID is in this list.
|
||||
AllowGroups []string `json:"allowGroups,omitempty"`
|
||||
// DenyGroups is a black list of group ids: a group message whose GroupID is in
|
||||
// this list is dropped at ingress.
|
||||
DenyGroups []string `json:"denyGroups,omitempty"`
|
||||
// AllowUsers, when non-empty, is a white list of user uids: a direct (private)
|
||||
// message from a user not in this list is dropped.
|
||||
AllowUsers []string `json:"allowUsers,omitempty"`
|
||||
// DenyUsers is a black list of user uids: a direct message from a user in this
|
||||
// list is dropped at ingress.
|
||||
DenyUsers []string `json:"denyUsers,omitempty"`
|
||||
}
|
||||
|
||||
// Load reads configuration, merging an optional .env file (development only)
|
||||
// with process environment variables. Process environment variables always take
|
||||
// precedence over .env values, which take precedence over code defaults.
|
||||
|
||||
Reference in new issue
Block a user