(providerKey string, models []*ModelInfo)
| 1138 | } |
| 1139 | |
| 1140 | func (s *Service) appendPluginModels(providerKey string, models []*ModelInfo) []*ModelInfo { |
| 1141 | pluginModels := s.pluginModelsForProvider(providerKey) |
| 1142 | if len(pluginModels) == 0 { |
| 1143 | return models |
| 1144 | } |
| 1145 | out := make([]*ModelInfo, 0, len(models)+len(pluginModels)) |
| 1146 | seen := make(map[string]struct{}, len(models)+len(pluginModels)) |
| 1147 | for _, model := range models { |
| 1148 | if model == nil { |
| 1149 | continue |
| 1150 | } |
| 1151 | modelID := strings.TrimSpace(model.ID) |
| 1152 | if modelID != "" { |
| 1153 | seen[modelID] = struct{}{} |
| 1154 | } |
| 1155 | out = append(out, model) |
| 1156 | } |
| 1157 | for _, model := range pluginModels { |
| 1158 | if model == nil { |
| 1159 | continue |
| 1160 | } |
| 1161 | modelID := strings.TrimSpace(model.ID) |
| 1162 | if modelID == "" { |
| 1163 | continue |
| 1164 | } |
| 1165 | if _, exists := seen[modelID]; exists { |
| 1166 | continue |
| 1167 | } |
| 1168 | seen[modelID] = struct{}{} |
| 1169 | out = append(out, model) |
| 1170 | } |
| 1171 | return out |
| 1172 | } |
| 1173 | |
| 1174 | func (s *Service) tryRegisterPluginModelsForAuth(ctx context.Context, a *coreauth.Auth, provider, authKind string, excluded []string) bool { |
| 1175 | if s == nil || s.pluginHost == nil || a == nil { |
no test coverage detected