adding continuous
All checks were successful
Recommender Build and Deploy (internal) / Build Recommender Image (push) Successful in 3m39s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Successful in 38s

This commit is contained in:
2026-04-17 21:09:59 -03:00
parent 910d26add3
commit 6e9cfc5d30
17 changed files with 1743 additions and 387 deletions

View File

@@ -23,13 +23,21 @@ export const miniModel = isGeneric ? (process.env.MODEL_NAME ?? 'default') : 'gp
export const serviceOptions = isGeneric ? {} : { service_tier: 'flex' as const };
export const supportsWebSearch = !isGeneric;
export async function parseWithRetry<T>(fn: () => Promise<T>, retries = 2): Promise<T> {
function isJsonParseError(err: unknown): boolean {
if (err instanceof SyntaxError) return true;
if (!(err instanceof Error)) return false;
// Some providers wrap JSON parsing failures in plain Error objects.
return /not valid json|unexpected token|json/i.test(err.message);
}
export async function parseWithRetry<T>(fn: () => Promise<T>, retries = 3): Promise<T> {
let lastErr: unknown;
for (let attempt = 0; attempt <= retries; attempt++) {
try {
return await fn();
} catch (err) {
if (err instanceof SyntaxError && attempt < retries) {
if (isJsonParseError(err) && attempt < retries) {
lastErr = err;
continue;
}