fix(jina-reader): recover after transient errors and use JSON POST API

Clear stale provider error code and account lock after a successful web
fetch (the core fetch handler never consumed the onRequestSuccess
callback), switch Jina Reader to its documented JSON POST request, and
parse the Title: metadata line before falling back to a Markdown heading.
This commit is contained in:
jacardl
2026-07-23 16:28:37 +07:00
parent 007d372724
commit 3c17d3406b
5 changed files with 176 additions and 9 deletions
+1 -3
View File
@@ -195,13 +195,11 @@ async function handleSingleProviderFetch(body, providerInput, request, apiKey, s
providerSpecificData: newCreds.providerSpecificData,
testStatus: "active"
});
},
onRequestSuccess: async () => {
await clearAccountError(credentials.connectionId, credentials);
}
});
if (result.success) {
await clearAccountError(credentials.connectionId, credentials);
return new Response(JSON.stringify(result.data), {
headers: { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*" }
});
+7 -1
View File
@@ -285,7 +285,13 @@ export async function clearAccountError(connectionId, currentConnection, model =
// Only reset error state if no active locks remain
if (remainingActiveLocks.length === 0) {
Object.assign(clearObj, { testStatus: "active", lastError: null, lastErrorAt: null, backoffLevel: 0 });
Object.assign(clearObj, {
testStatus: "active",
lastError: null,
errorCode: null,
lastErrorAt: null,
backoffLevel: 0
});
}
await updateProviderConnection(connectionId, clearObj);