Add MCP client loading in engine
- Integrated MCP client loading in both Load and Reload functions, enhancing the engine's capability to manage MCP configurations. - Added error handling for MCP loading, ensuring warnings are generated for any issues encountered during the process. - This update improves the overall robustness of the engine's loading mechanism and provides better feedback on MCP-related errors.
This commit is contained in:
parent
f71ce2ac9a
commit
846da4042f
1 changed files with 14 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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue