feat: enhance agent skills sandbox configuration and availability
- Updated .env.example to set default sandbox mode to 'docker' and added timeout and docker image variables. - Modified docker-compose files to include a sandbox service for building and pulling the sandbox image. - Adjusted frontend API to reflect sandbox availability for skills, ensuring UI elements are conditionally displayed based on sandbox status. - Implemented backend logic to disable skills when the sandbox is not enabled, improving error handling and user experience.
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/agent/tools"
|
||||
@@ -856,6 +857,15 @@ func (s *sessionService) configureSkillsFromAgent(
|
||||
if customAgent == nil {
|
||||
return
|
||||
}
|
||||
// When sandbox is disabled, skills cannot be enabled (no script execution environment)
|
||||
sandboxMode := os.Getenv("WEKNORA_SANDBOX_MODE")
|
||||
if sandboxMode == "" || sandboxMode == "disabled" {
|
||||
agentConfig.SkillsEnabled = false
|
||||
agentConfig.SkillDirs = nil
|
||||
agentConfig.AllowedSkills = nil
|
||||
logger.Infof(ctx, "Sandbox is disabled: skills are not available")
|
||||
return
|
||||
}
|
||||
|
||||
switch customAgent.Config.SkillsSelectionMode {
|
||||
case "all":
|
||||
|
||||
Reference in New Issue
Block a user