Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
chore: error style
Browse files Browse the repository at this point in the history
  • Loading branch information
gitcommitshow committed Aug 10, 2023
1 parent e7e749e commit c749ab7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
13 changes: 6 additions & 7 deletions lib/llm/apiManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,12 @@ class ApiManager {
console.debug("The OPENAI_API_KEY is not correct for chat completion request: "+configuration.apiKey);
}
}
} else {
if (error.request) {
console.error('No response received:', error.request);
}
// Something happened in setting up the request that triggered an error
console.error('Error setting up request:', error.message);
}
}
if (error.request) {
console.error('No response received:', JSON.stringify(error.request, null, 4));
}
// Something happened in setting up the request that triggered an error
console.error('Error setting up request:', error.message);
console.error('Error config:', error.config);
throw error;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/llm/llmUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ async function createChatCompletion(options) {
console.log("API Bad gateway. Waiting {backoff} seconds...");
console.error("Reached rate limit, passing...");
await time.sleep(10*(attempt+1));
} else if (error.response.status === 401) {
console.log("You need to set the correct LLM API key for chat completion.");
break;
} else {
if (error.response.status === 401) {
console.log("You need to set the correct LLM API key for chat completion.");
}
if (!warnedUser) {
console.log("Please double check that you have setup a PAID OpenAI API Account. "+ "You can read more here: {Fore.CYAN}https://docs.agpt.co/setup/#getting-an-api-key");
warnedUser = true;
}
break;
}
if (!warnedUser) {
console.log("Please double check that you have setup a PAID OpenAI API Account. "+ "You can read more here: {Fore.CYAN}https://docs.agpt.co/setup/#getting-an-api-key");
warnedUser = true;
}
}
}
}
Expand Down

0 comments on commit c749ab7

Please sign in to comment.