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:
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/errors"
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
@@ -57,8 +58,13 @@ func (h *SkillHandler) ListSkills(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
// skills_available: true only when sandbox is enabled (docker or local), so frontend can hide/disable Skills UI
|
||||
sandboxMode := os.Getenv("WEKNORA_SANDBOX_MODE")
|
||||
skillsAvailable := sandboxMode != "" && sandboxMode != "disabled"
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"data": response,
|
||||
"success": true,
|
||||
"data": response,
|
||||
"skills_available": skillsAvailable,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user