feat(fetch): add Ollama Cloud web fetch provider

This commit is contained in:
Sami Basra
2026-09-03 10:12:41 +07:00
committed by decolua
parent 6ab9ca9eb1
commit e0ffc7e2a1
6 changed files with 255 additions and 8 deletions

View File

@@ -85,7 +85,40 @@ describe("web fetch account state", () => {
expect(mocks.clearAccountError).toHaveBeenCalledWith(
"jina-connection",
expect.objectContaining({ connectionName: "Jina Test" }),
"webfetch:jina-reader",
);
expect(mocks.getProviderCredentials).toHaveBeenCalledWith(
"jina-reader",
expect.any(Set),
"webfetch:jina-reader",
);
expect(mocks.markAccountUnavailable).not.toHaveBeenCalled();
});
it("scopes provider failures to web fetch", async () => {
mocks.handleFetchCore.mockResolvedValue({
success: false,
status: 429,
error: "quota exceeded",
});
mocks.markAccountUnavailable.mockResolvedValue({ shouldFallback: false });
const response = await handleFetch(new Request("http://localhost/v1/web/fetch", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
provider: "jina-reader",
url: "https://example.com/article",
}),
}));
expect(response.status).toBe(429);
expect(mocks.markAccountUnavailable).toHaveBeenCalledWith(
"jina-connection",
429,
"quota exceeded",
"jina-reader",
"webfetch:jina-reader",
);
});
});