Merge pull request #1238 from trheyi/main
Add MCP client loading in engine
This commit is contained in:
commit
ee508050e0
2 changed files with 18 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ import (
|
|||
"github.com/yaoapp/yao/fs"
|
||||
"github.com/yaoapp/yao/i18n"
|
||||
"github.com/yaoapp/yao/kb"
|
||||
"github.com/yaoapp/yao/mcp"
|
||||
"github.com/yaoapp/yao/messenger"
|
||||
"github.com/yaoapp/yao/moapi"
|
||||
"github.com/yaoapp/yao/model"
|
||||
|
|
@ -282,6 +283,13 @@ func Load(cfg config.Config, options LoadOption) (warnings []Warning, err error)
|
|||
warnings = append(warnings, Warning{Widget: "Pipe", Error: err})
|
||||
}
|
||||
|
||||
// Load MCP Clients
|
||||
err = mcp.Load(cfg)
|
||||
if err != nil {
|
||||
// printErr(cfg.Mode, "MCP", err)
|
||||
warnings = append(warnings, Warning{Widget: "MCP", Error: err})
|
||||
}
|
||||
|
||||
// Load Knowledge Base
|
||||
_, err = kb.Load(cfg)
|
||||
if err != nil {
|
||||
|
|
@ -506,6 +514,12 @@ func Reload(cfg config.Config, options LoadOption) (err error) {
|
|||
printErr(cfg.Mode, "AIGC", err)
|
||||
}
|
||||
|
||||
// Load MCP Clients
|
||||
err = mcp.Load(cfg)
|
||||
if err != nil {
|
||||
printErr(cfg.Mode, "MCP", err)
|
||||
}
|
||||
|
||||
// Load Knowledge Base
|
||||
_, err = kb.Load(cfg)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -364,6 +364,8 @@ func (u *DefaultUser) CreateRobotMember(ctx context.Context, teamID string, robo
|
|||
robotFields := []string{
|
||||
"role_id", "system_prompt", "manager_id", "robot_config", "agents", "mcp_servers",
|
||||
"language_model", "cost_limit", "autonomous_mode", "robot_status",
|
||||
"permissions", "restrictions", "notes", "metadata",
|
||||
"__yao_created_by", "__yao_updated_by", "__yao_team_id", "__yao_tenant_id",
|
||||
}
|
||||
|
||||
for _, field := range robotFields {
|
||||
|
|
@ -412,6 +414,8 @@ func (u *DefaultUser) AddMember(ctx context.Context, teamID string, userID strin
|
|||
"invited_at": time.Now(),
|
||||
"invitation_token": token,
|
||||
"invitation_expires_at": time.Now().Add(7 * 24 * time.Hour), // 7 days expiry
|
||||
"__yao_created_by": invitedBy,
|
||||
"__yao_team_id": teamID,
|
||||
}
|
||||
|
||||
return u.CreateMember(ctx, memberData)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue