feat(group): 添加 MCP XML 注入开关

- Group 新增 mcp_xml_inject 字段,控制 Antigravity 平台的 MCP XML 协议注入
- 默认启用,可在分组设置中关闭
- 修复 GetByKeyForAuth 遗漏查询 mcp_xml_inject 字段导致认证缓存值始终为 false 的问题
This commit is contained in:
song
2026-01-27 13:09:56 +08:00
parent 66f49b67d6
commit 877c17251d
25 changed files with 355 additions and 9 deletions

View File

@@ -113,6 +113,7 @@ type CreateGroupInput struct {
// 模型路由配置(仅 anthropic 平台使用)
ModelRouting map[string][]int64
ModelRoutingEnabled bool // 是否启用模型路由
MCPXMLInject *bool
}
type UpdateGroupInput struct {
@@ -137,6 +138,7 @@ type UpdateGroupInput struct {
// 模型路由配置(仅 anthropic 平台使用)
ModelRouting map[string][]int64
ModelRoutingEnabled *bool // 是否启用模型路由
MCPXMLInject *bool
}
type CreateAccountInput struct {
@@ -587,6 +589,12 @@ func (s *adminServiceImpl) CreateGroup(ctx context.Context, input *CreateGroupIn
}
}
// MCPXMLInject默认为 true仅当显式传入 false 时关闭
mcpXMLInject := true
if input.MCPXMLInject != nil {
mcpXMLInject = *input.MCPXMLInject
}
group := &Group{
Name: input.Name,
Description: input.Description,
@@ -605,6 +613,7 @@ func (s *adminServiceImpl) CreateGroup(ctx context.Context, input *CreateGroupIn
FallbackGroupID: input.FallbackGroupID,
FallbackGroupIDOnInvalidRequest: fallbackOnInvalidRequest,
ModelRouting: input.ModelRouting,
MCPXMLInject: mcpXMLInject,
}
if err := s.groupRepo.Create(ctx, group); err != nil {
return nil, err
@@ -785,6 +794,9 @@ func (s *adminServiceImpl) UpdateGroup(ctx context.Context, id int64, input *Upd
if input.ModelRoutingEnabled != nil {
group.ModelRoutingEnabled = *input.ModelRoutingEnabled
}
if input.MCPXMLInject != nil {
group.MCPXMLInject = *input.MCPXMLInject
}
if err := s.groupRepo.Update(ctx, group); err != nil {
return nil, err