(conf map[string]interface{}, account *model.AgentAccount, accountModels []dto.AgentAccountModel, primaryModel string)
| 931 | } |
| 932 | |
| 933 | func extractOpenclawFallbackModelIDs(conf map[string]interface{}, account *model.AgentAccount, accountModels []dto.AgentAccountModel, primaryModel string) []string { |
| 934 | modelMap := openclawModelRefMap(conf) |
| 935 | raw, ok := modelMap["fallbacks"].([]interface{}) |
| 936 | if !ok || len(raw) == 0 { |
| 937 | return nil |
| 938 | } |
| 939 | resolved, err := buildOpenclawResolvedModelIDMap(account, accountModels) |
| 940 | if err != nil { |
| 941 | return nil |
| 942 | } |
| 943 | result := make([]string, 0, len(raw)) |
| 944 | seen := make(map[string]struct{}, len(raw)) |
| 945 | for _, item := range raw { |
| 946 | target := strings.TrimSpace(fmt.Sprintf("%v", item)) |
| 947 | modelID, ok := resolved[target] |
| 948 | if !ok || sameProviderModelID(account.Provider, modelID, primaryModel) { |
| 949 | continue |
| 950 | } |
| 951 | if _, ok := seen[modelID]; ok { |
| 952 | continue |
| 953 | } |
| 954 | seen[modelID] = struct{}{} |
| 955 | result = append(result, modelID) |
| 956 | } |
| 957 | return result |
| 958 | } |
| 959 | |
| 960 | func openclawModelRefMap(conf map[string]interface{}) map[string]interface{} { |
| 961 | agentsMap, ok := conf["agents"].(map[string]interface{}) |
no test coverage detected