Spaces:
Build error
Build error
bump: deps
Browse files- package-lock.json +6 -8
- package.json +1 -1
- src/api/searcher-serper.ts +15 -2
- src/api/serp.ts +14 -2
- thinapps-shared +1 -1
package-lock.json
CHANGED
|
@@ -47,7 +47,7 @@
|
|
| 47 |
"tld-extract": "^2.1.0",
|
| 48 |
"turndown": "^7.1.3",
|
| 49 |
"turndown-plugin-gfm": "^1.0.2",
|
| 50 |
-
"undici": "^
|
| 51 |
},
|
| 52 |
"devDependencies": {
|
| 53 |
"@types/archiver": "^5.3.4",
|
|
@@ -12500,14 +12500,12 @@
|
|
| 12500 |
}
|
| 12501 |
},
|
| 12502 |
"node_modules/undici": {
|
| 12503 |
-
"version": "
|
| 12504 |
-
"resolved": "https://registry.npmjs.org/undici/-/undici-
|
| 12505 |
-
"integrity": "sha512-
|
| 12506 |
-
"
|
| 12507 |
-
"@fastify/busboy": "^2.0.0"
|
| 12508 |
-
},
|
| 12509 |
"engines": {
|
| 12510 |
-
"node": ">=
|
| 12511 |
}
|
| 12512 |
},
|
| 12513 |
"node_modules/undici-types": {
|
|
|
|
| 47 |
"tld-extract": "^2.1.0",
|
| 48 |
"turndown": "^7.1.3",
|
| 49 |
"turndown-plugin-gfm": "^1.0.2",
|
| 50 |
+
"undici": "^7.8.0"
|
| 51 |
},
|
| 52 |
"devDependencies": {
|
| 53 |
"@types/archiver": "^5.3.4",
|
|
|
|
| 12500 |
}
|
| 12501 |
},
|
| 12502 |
"node_modules/undici": {
|
| 12503 |
+
"version": "7.8.0",
|
| 12504 |
+
"resolved": "https://registry.npmjs.org/undici/-/undici-7.8.0.tgz",
|
| 12505 |
+
"integrity": "sha512-vFv1GA99b7eKO1HG/4RPu2Is3FBTWBrmzqzO0mz+rLxN3yXkE4mqRcb8g8fHxzX4blEysrNZLqg5RbJLqX5buA==",
|
| 12506 |
+
"license": "MIT",
|
|
|
|
|
|
|
| 12507 |
"engines": {
|
| 12508 |
+
"node": ">=20.18.1"
|
| 12509 |
}
|
| 12510 |
},
|
| 12511 |
"node_modules/undici-types": {
|
package.json
CHANGED
|
@@ -56,7 +56,7 @@
|
|
| 56 |
"tld-extract": "^2.1.0",
|
| 57 |
"turndown": "^7.1.3",
|
| 58 |
"turndown-plugin-gfm": "^1.0.2",
|
| 59 |
-
"undici": "^
|
| 60 |
},
|
| 61 |
"devDependencies": {
|
| 62 |
"@types/archiver": "^5.3.4",
|
|
|
|
| 56 |
"tld-extract": "^2.1.0",
|
| 57 |
"turndown": "^7.1.3",
|
| 58 |
"turndown-plugin-gfm": "^1.0.2",
|
| 59 |
+
"undici": "^7.8.0"
|
| 60 |
},
|
| 61 |
"devDependencies": {
|
| 62 |
"@types/archiver": "^5.3.4",
|
src/api/searcher-serper.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
| 32 |
import { toAsyncGenerator } from '../utils/misc';
|
| 33 |
import type { JinaEmbeddingsTokenAccount } from '../shared/db/jina-embeddings-token-account';
|
| 34 |
import { LRUCache } from 'lru-cache';
|
|
|
|
| 35 |
|
| 36 |
const WORLD_COUNTRY_CODES = Object.keys(WORLD_COUNTRIES).map((x) => x.toLowerCase());
|
| 37 |
|
|
@@ -256,8 +257,20 @@ export class SearcherHost extends RPCHost {
|
|
| 256 |
auth.reportUsage(chargeAmount, `reader-${rpcReflect.name}`).catch((err) => {
|
| 257 |
this.logger.warn(`Unable to report usage for ${uid}`, { err: marshalErrorLike(err) });
|
| 258 |
});
|
| 259 |
-
|
| 260 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
}
|
| 262 |
});
|
| 263 |
|
|
|
|
| 32 |
import { toAsyncGenerator } from '../utils/misc';
|
| 33 |
import type { JinaEmbeddingsTokenAccount } from '../shared/db/jina-embeddings-token-account';
|
| 34 |
import { LRUCache } from 'lru-cache';
|
| 35 |
+
import { API_CALL_STATUS } from '../shared/db/api-roll';
|
| 36 |
|
| 37 |
const WORLD_COUNTRY_CODES = Object.keys(WORLD_COUNTRIES).map((x) => x.toLowerCase());
|
| 38 |
|
|
|
|
| 257 |
auth.reportUsage(chargeAmount, `reader-${rpcReflect.name}`).catch((err) => {
|
| 258 |
this.logger.warn(`Unable to report usage for ${uid}`, { err: marshalErrorLike(err) });
|
| 259 |
});
|
| 260 |
+
try {
|
| 261 |
+
const apiRoll = await apiRollPromise;
|
| 262 |
+
apiRoll.chargeAmount = chargeAmount;
|
| 263 |
+
|
| 264 |
+
} catch (err) {
|
| 265 |
+
await this.rateLimitControl.record({
|
| 266 |
+
uid,
|
| 267 |
+
tags: [rpcReflect.name.toUpperCase()],
|
| 268 |
+
status: API_CALL_STATUS.SUCCESS,
|
| 269 |
+
chargeAmount,
|
| 270 |
+
}).save().catch((err) => {
|
| 271 |
+
this.logger.warn(`Failed to save rate limit record`, { err: marshalErrorLike(err) });
|
| 272 |
+
});
|
| 273 |
+
}
|
| 274 |
}
|
| 275 |
});
|
| 276 |
|
src/api/serp.ts
CHANGED
|
@@ -25,6 +25,7 @@ import { SERPResult } from '../db/searched';
|
|
| 25 |
import { SerperBingSearchService, SerperGoogleSearchService } from '../services/serp/serper';
|
| 26 |
import type { JinaEmbeddingsTokenAccount } from '../shared/db/jina-embeddings-token-account';
|
| 27 |
import { LRUCache } from 'lru-cache';
|
|
|
|
| 28 |
|
| 29 |
const WORLD_COUNTRY_CODES = Object.keys(WORLD_COUNTRIES).map((x) => x.toLowerCase());
|
| 30 |
|
|
@@ -261,8 +262,19 @@ export class SerpHost extends RPCHost {
|
|
| 261 |
auth.reportUsage(chargeAmount, `reader-search`).catch((err) => {
|
| 262 |
this.logger.warn(`Unable to report usage for ${uid}`, { err: marshalErrorLike(err) });
|
| 263 |
});
|
| 264 |
-
|
| 265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
}
|
| 267 |
});
|
| 268 |
|
|
|
|
| 25 |
import { SerperBingSearchService, SerperGoogleSearchService } from '../services/serp/serper';
|
| 26 |
import type { JinaEmbeddingsTokenAccount } from '../shared/db/jina-embeddings-token-account';
|
| 27 |
import { LRUCache } from 'lru-cache';
|
| 28 |
+
import { API_CALL_STATUS } from '../shared/db/api-roll';
|
| 29 |
|
| 30 |
const WORLD_COUNTRY_CODES = Object.keys(WORLD_COUNTRIES).map((x) => x.toLowerCase());
|
| 31 |
|
|
|
|
| 262 |
auth.reportUsage(chargeAmount, `reader-search`).catch((err) => {
|
| 263 |
this.logger.warn(`Unable to report usage for ${uid}`, { err: marshalErrorLike(err) });
|
| 264 |
});
|
| 265 |
+
try {
|
| 266 |
+
const apiRoll = await apiRollPromise;
|
| 267 |
+
apiRoll.chargeAmount = chargeAmount;
|
| 268 |
+
} catch (err) {
|
| 269 |
+
await this.rateLimitControl.record({
|
| 270 |
+
uid,
|
| 271 |
+
tags: [rpcReflect.name.toUpperCase()],
|
| 272 |
+
status: API_CALL_STATUS.SUCCESS,
|
| 273 |
+
chargeAmount,
|
| 274 |
+
}).save().catch((err) => {
|
| 275 |
+
this.logger.warn(`Failed to save rate limit record`, { err: marshalErrorLike(err) });
|
| 276 |
+
});
|
| 277 |
+
}
|
| 278 |
}
|
| 279 |
});
|
| 280 |
|
thinapps-shared
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Subproject commit
|
|
|
|
| 1 |
+
Subproject commit f89255cd6546641f72eefba140a4aef96a0e03fc
|