mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
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:
@@ -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": "*" }
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user