Skip to content

Commit

Permalink
Rename response to jinaResponse for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
pH-7 committed May 10, 2024
1 parent 04f15f0 commit 3ca87d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions client/modules/gossip.textGeneration.engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,15 @@ export namespace Gossip {
maxLength?: number;
},
) {
const response = await fetch(`https://r.jina.ai/${url}`);
const jinaResponse = await fetch(`https://r.jina.ai/${url}`);

if (!response) {
if (!jinaResponse) {
throw new Error("No response from server");
} else if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
} else if (!jinaResponse.ok) {
throw new Error(`HTTP error! status: ${jinaResponse.status}`);
}

const text = await response.text();
const text = await jinaResponse.text();

return text.trim().substring(0, options?.maxLength);
}
Expand Down

0 comments on commit 3ca87d1

Please sign in to comment.