(ctx context.Context, providerId string, id string)
| 253 | } |
| 254 | |
| 255 | func (i *imlKeyModule) Get(ctx context.Context, providerId string, id string) (*ai_key_dto.Key, error) { |
| 256 | p, has := model_runtime.GetProvider(providerId) |
| 257 | if !has { |
| 258 | return nil, fmt.Errorf("provider not found: %s", providerId) |
| 259 | } |
| 260 | _, err := i.providerService.Get(ctx, providerId) |
| 261 | if err != nil { |
| 262 | return nil, fmt.Errorf("provider not found: %w", err) |
| 263 | } |
| 264 | info, err := i.aiKeyService.Get(ctx, id) |
| 265 | if err != nil { |
| 266 | return nil, fmt.Errorf("key not found: %w", err) |
| 267 | } |
| 268 | |
| 269 | return &ai_key_dto.Key{ |
| 270 | Id: info.ID, |
| 271 | Name: info.Name, |
| 272 | Config: p.MaskConfig(info.Config), |
| 273 | ExpireTime: info.ExpireTime, |
| 274 | }, nil |
| 275 | } |
| 276 | |
| 277 | func (i *imlKeyModule) List(ctx context.Context, providerId string, keyword string, page, pageSize int, statuses []string) ([]*ai_key_dto.Item, int64, error) { |
| 278 | _, err := i.aiKeyService.DefaultKey(ctx, providerId) |
nothing calls this directly
no test coverage detected