mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-09-22 16:00:51 +00:00
feat: add openclaw default tool config (#12096)
This commit is contained in:
@@ -62,9 +62,11 @@ func NewIAgentService() IAgentService {
|
||||
}
|
||||
|
||||
const (
|
||||
defaultBrowserExecutablePath = "/home/node/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome"
|
||||
defaultBrowserProfile = "openclaw"
|
||||
defaultUserTimezone = "Asia/Shanghai"
|
||||
defaultBrowserExecutablePath = "/home/node/.cache/ms-playwright/chromium-1208/chrome-linux64/chrome"
|
||||
defaultBrowserProfile = "openclaw"
|
||||
defaultUserTimezone = "Asia/Shanghai"
|
||||
defaultToolsProfile = "full"
|
||||
defaultToolsSessionVisibility = "all"
|
||||
)
|
||||
|
||||
func (a AgentService) Create(req dto.AgentCreateReq) (*dto.AgentItem, error) {
|
||||
@@ -1435,9 +1437,19 @@ type openclawConfig struct {
|
||||
Gateway gatewayConfig `json:"gateway"`
|
||||
Agents agentsConfig `json:"agents"`
|
||||
Browser browserConfig `json:"browser"`
|
||||
Tools toolsConfig `json:"tools"`
|
||||
Models *modelsConfig `json:"models,omitempty"`
|
||||
}
|
||||
|
||||
type toolsConfig struct {
|
||||
Profile string `json:"profile,omitempty"`
|
||||
Sessions toolSessionsConfig `json:"sessions,omitempty"`
|
||||
}
|
||||
|
||||
type toolSessionsConfig struct {
|
||||
Visibility string `json:"visibility,omitempty"`
|
||||
}
|
||||
|
||||
type gatewayConfig struct {
|
||||
Mode string `json:"mode"`
|
||||
Bind string `json:"bind"`
|
||||
@@ -1550,6 +1562,12 @@ func writeOpenclawConfig(confDir, provider, modelName, apiType string, maxTokens
|
||||
NoSandbox: true,
|
||||
DefaultProfile: defaultBrowserProfile,
|
||||
},
|
||||
Tools: toolsConfig{
|
||||
Profile: defaultToolsProfile,
|
||||
Sessions: toolSessionsConfig{
|
||||
Visibility: defaultToolsSessionVisibility,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
provider = strings.ToLower(strings.TrimSpace(provider))
|
||||
@@ -1870,6 +1888,14 @@ func writeOpenclawConfig(confDir, provider, modelName, apiType string, maxTokens
|
||||
}
|
||||
conf["browser"] = browserMap
|
||||
}
|
||||
toolsMap := ensureChildMap(conf, "tools")
|
||||
if profile, ok := toolsMap["profile"]; !ok || strings.TrimSpace(fmt.Sprintf("%v", profile)) == "" {
|
||||
toolsMap["profile"] = defaultToolsProfile
|
||||
}
|
||||
sessionsMap := ensureChildMap(toolsMap, "sessions")
|
||||
if visibility, ok := sessionsMap["visibility"]; !ok || strings.TrimSpace(fmt.Sprintf("%v", visibility)) == "" {
|
||||
sessionsMap["visibility"] = defaultToolsSessionVisibility
|
||||
}
|
||||
agentsMap := ensureChildMap(conf, "agents")
|
||||
defaultsMap := ensureChildMap(agentsMap, "defaults")
|
||||
if tz, ok := defaultsMap["userTimezone"]; !ok || strings.TrimSpace(fmt.Sprintf("%v", tz)) == "" {
|
||||
|
||||
Reference in New Issue
Block a user