applySetup function

SetupConfig applySetup(
  1. SetupConfig existing, {
  2. String? router,
  3. String? routerApiKey,
  4. String? siteUrl,
  5. String? upgradeUrl,
  6. String? compute,
  7. String? hfToken,
  8. String? modelscopeApiToken,
})

Implementation

SetupConfig applySetup(SetupConfig existing,
    {String? router,
    String? routerApiKey,
    String? siteUrl,
    String? upgradeUrl,
    String? compute,
    String? hfToken,
    String? modelscopeApiToken}) {
  final out = existing.copy();
  if (router != null) out.router = router;
  if (routerApiKey != null) out.routerApiKey = routerApiKey;
  if (siteUrl != null) out.siteUrl = siteUrl;
  if (upgradeUrl != null) out.upgradeUrl = upgradeUrl;
  if (compute != null) out.compute = compute;
  if (hfToken != null) out.hfToken = hfToken;
  if (modelscopeApiToken != null) out.modelscopeApiToken = modelscopeApiToken;
  if (!computes.contains(out.compute)) {
    throw ArgumentError('invalid compute: ${out.compute}');
  }
  return fillSetupUrls(out);
}