Update openai_comp.js

Allow path other than v1
This commit is contained in:
kcrkor 2024-10-14 21:50:35 +01:00 committed by GitHub
parent c4279ddd94
commit 6ffcba5c0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -40,7 +40,7 @@ export class OpenAIComp {
};
if(this.apiKey !== '') curr_headers["Authorization"] = "Bearer "+ this.apiKey;
const response = await fetch(this.host + "/v1/models", {
const response = await fetch(this.host + "/models", {
method: "GET",
headers: curr_headers,
});
@ -70,7 +70,7 @@ export class OpenAIComp {
if(this.apiKey !== '') curr_headers["Authorization"] = "Bearer "+ this.apiKey;
try {
const response = await fetch(this.host + "/v1/chat/completions", {
const response = await fetch(this.host + "/chat/completions", {
method: "POST",
headers: curr_headers,
body: JSON.stringify({