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

chore: error style #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading