fetchModels returns false on error
This commit is contained in:
parent
032dce2a52
commit
36158e3e3a
1 changed files with 2 additions and 2 deletions
|
|
@ -31,7 +31,7 @@ export class OpenAI {
|
||||||
|
|
||||||
|
|
||||||
fetchModels = async () => {
|
fetchModels = async () => {
|
||||||
const response = await fetch("https://api.openai.com/v1/models", {
|
const response = await fetch("https://api.openai.com/v1/mod3els", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|
@ -43,7 +43,7 @@ export class OpenAI {
|
||||||
const errorDetail = await response.text();
|
const errorDetail = await response.text();
|
||||||
let err_msg = "[ThunderAI] OpenAI API request failed: " + response.status + " " + response.statusText + ", Detail: " + errorDetail;
|
let err_msg = "[ThunderAI] OpenAI API request failed: " + response.status + " " + response.statusText + ", Detail: " + errorDetail;
|
||||||
console.log(err_msg);
|
console.log(err_msg);
|
||||||
throw new Error(err_msg);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let output = await response.json();
|
let output = await response.json();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue