From 96194110d1f31e2a708816d174c849467a91ccf8 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 24 Mar 2026 20:45:05 +0800 Subject: [PATCH] refactor(assistant): improve sandbox version extraction logic - Enhanced the extractSandboxVersion function to support multiple input types, including *sandboxTypes.SandboxConfig and map[string]any, for better flexibility in version retrieval. - Simplified the version extraction process, ensuring consistent handling of sandbox configurations. --- agent/assistant/load.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/agent/assistant/load.go b/agent/assistant/load.go index cdd857ab..08362940 100644 --- a/agent/assistant/load.go +++ b/agent/assistant/load.go @@ -1101,8 +1101,15 @@ func mergeSearchConfig(base, override *searchTypes.Config) *searchTypes.Config { // extractSandboxVersion tries to read the "version" field from a sandbox config value. func extractSandboxVersion(v any) string { - if m, ok := v.(map[string]any); ok { - if ver, ok := m["version"].(string); ok { + switch sb := v.(type) { + case *sandboxTypes.SandboxConfig: + if sb != nil { + return sb.Version + } + case sandboxTypes.SandboxConfig: + return sb.Version + case map[string]any: + if ver, ok := sb["version"].(string); ok { return ver } }