Skip to content

Commit

Permalink
Merge pull request #108 from rawpixel-vincent/fix-chroma-rawget-auth
Browse files Browse the repository at this point in the history
Great catch and thanks for making the PR. Ping in discord for contributor badge if you are in there!
  • Loading branch information
timothycarambat committed Dec 31, 2023
2 parents 6cad8a3 + ba188d9 commit d4c2b8e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions backend/utils/vectordatabases/providers/chroma/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ class Chroma {
path: settings.instanceURL,
...(settings?.authToken
? {
fetchOptions: {
headers: {
[settings.authTokenHeader || "X-Api-Key"]: settings.authToken,
},
fetchOptions: {
headers: {
[settings.authTokenHeader || "X-Api-Key"]: settings.authToken,
},
}
},
}
: {}),
});

Expand Down Expand Up @@ -114,13 +114,23 @@ class Chroma {
}

async rawGet(collectionId, pageSize = 10, offset = 0) {
const { settings } = this.config;
return await fetch(
`${this.config.settings.instanceURL}/api/v1/collections/${collectionId}/get`,
{
method: "POST",
headers: {

accept: "application/json",
"Content-Type": "application/json",
...(settings?.authToken
? {
[settings.authTokenHeader || "X-Api-Key"]:
settings.authTokenHeader === 'Authorization'
? `Bearer ${settings.authToken}` :
settings.authToken,
}
: {}),
},
body: JSON.stringify({
limit: pageSize,
Expand Down

0 comments on commit d4c2b8e

Please sign in to comment.