@routstr/sdk 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1279,7 +1279,10 @@ var hydrateStoreFromDriver = async (store, driver) => {
1279
1279
  driver.getItem(SDK_STORAGE_KEYS.CLIENT_IDS, []),
1280
1280
  driver.getItem(SDK_STORAGE_KEYS.FAILED_PROVIDERS, []),
1281
1281
  driver.getItem(SDK_STORAGE_KEYS.LAST_FAILED, {}),
1282
- driver.getItem(SDK_STORAGE_KEYS.PROVIDERS_ON_COOLDOWN, [])
1282
+ driver.getItem(
1283
+ SDK_STORAGE_KEYS.PROVIDERS_ON_COOLDOWN,
1284
+ []
1285
+ )
1283
1286
  ]);
1284
1287
  const modelsFromAllProviders = Object.fromEntries(
1285
1288
  Object.entries(rawModels).map(([baseUrl, models]) => [
@@ -1347,7 +1350,9 @@ var hydrateStoreFromDriver = async (store, driver) => {
1347
1350
  createdAt: entry.createdAt ?? Date.now(),
1348
1351
  lastUsed: entry.lastUsed ?? null
1349
1352
  }));
1350
- const failedProviders = rawFailedProviders.map((url) => normalizeBaseUrl5(url));
1353
+ const failedProviders = rawFailedProviders.map(
1354
+ (url) => normalizeBaseUrl5(url)
1355
+ );
1351
1356
  const lastFailed = Object.fromEntries(
1352
1357
  Object.entries(rawLastFailed).map(([baseUrl, timestamp]) => [
1353
1358
  normalizeBaseUrl5(baseUrl),
@@ -1409,6 +1414,7 @@ var createDiscoveryAdapterFromStore = (store) => ({
1409
1414
  getLastUsedModel: () => store.getState().lastUsedModel,
1410
1415
  setLastUsedModel: (modelId) => store.getState().setLastUsedModel(modelId),
1411
1416
  getDisabledProviders: () => store.getState().disabledProviders,
1417
+ setDisabledProviders: (urls) => store.getState().setDisabledProviders(urls),
1412
1418
  getBaseUrlsList: () => store.getState().baseUrlsList,
1413
1419
  setBaseUrlsList: (urls) => store.getState().setBaseUrlsList(urls),
1414
1420
  getBaseUrlsLastUpdate: () => store.getState().lastBaseUrlsUpdate,
@@ -1424,9 +1430,7 @@ var createStorageAdapterFromStore = (store) => ({
1424
1430
  const distributionMap = {};
1425
1431
  for (const entry of apiKeys) {
1426
1432
  const sum = entry.balance || 0;
1427
- if (sum > 0) {
1428
- distributionMap[entry.baseUrl] = (distributionMap[entry.baseUrl] || 0) + sum;
1429
- }
1433
+ distributionMap[entry.baseUrl] = (distributionMap[entry.baseUrl] || 0) + sum;
1430
1434
  }
1431
1435
  return Object.entries(distributionMap).map(([baseUrl, amt]) => ({ baseUrl, amount: amt })).sort((a, b) => b.amount - a.amount);
1432
1436
  },