Skip to content

Commit

Permalink
compatibility with mistral AI working
Browse files Browse the repository at this point in the history
  • Loading branch information
Concedo authored and Concedo committed Dec 30, 2023
1 parent 7dea041 commit 3b13239
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6155,12 +6155,16 @@
}
}

let oaiheaders = {
'Authorization': 'Bearer '+desired_oai_key,
};
if (!desired_oai_ep.toLowerCase().includes("api.mistral.ai")) {
oaiheaders["x-api-key"] = desired_oai_key;
}

fetch((desired_oai_ep + oai_models_endpoint), {
method: 'GET',
headers: {
'Authorization': 'Bearer '+desired_oai_key,
'x-api-key': desired_oai_key,
},
headers: oaiheaders,
referrerPolicy: 'no-referrer',
})
.then((response) => response.json())
Expand Down Expand Up @@ -8903,13 +8907,17 @@
// //use cors proxy for mistral ai
// targetep = cors_proxy + "?" + targetep;
// }
if(targetep.toLowerCase().includes("openrouter.ai")
|| targetep.toLowerCase().includes("api.mistral.ai"))
if(!targetep.toLowerCase().includes("openrouter.ai") &&
!targetep.toLowerCase().includes("api.mistral.ai"))
{
oaiheaders["HTTP-Referer"] = "https://lite.koboldai.net";
}else{
oaiheaders["x-api-key"] = custom_oai_key;
}

if(targetep.toLowerCase().includes("openrouter.ai"))
{
oaiheaders["HTTP-Referer"] = "https://lite.koboldai.net";
}

fetch(targetep, {
method: 'POST',
headers: oaiheaders,
Expand Down

0 comments on commit 3b13239

Please sign in to comment.