mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-10 17:00:11 +01:00
parent
f9ac27e9a4
commit
8ebe1a515b
@ -48,7 +48,13 @@ const websocket = {
|
||||
name: this.name,
|
||||
setup(aibitat) {
|
||||
aibitat.onError(async (error) => {
|
||||
console.error(chalk.red(` error: ${error?.message}`));
|
||||
if (!!error?.message) {
|
||||
console.error(chalk.red(` error: ${error.message}`));
|
||||
aibitat.introspect(
|
||||
`Error encountered while running: ${error.message}`
|
||||
);
|
||||
}
|
||||
|
||||
if (error instanceof RetryError) {
|
||||
console.error(chalk.red(` retrying in 60 seconds...`));
|
||||
setTimeout(() => {
|
||||
|
@ -117,10 +117,14 @@ class AnthropicProvider extends Provider {
|
||||
cost,
|
||||
};
|
||||
} catch (error) {
|
||||
// If invalid Auth error we need to abort because no amount of waiting
|
||||
// will make auth better.
|
||||
if (error instanceof Anthropic.AuthenticationError) throw error;
|
||||
|
||||
if (
|
||||
error instanceof Anthropic.RateLimitError ||
|
||||
error instanceof Anthropic.InternalServerError ||
|
||||
error instanceof Anthropic.APIError
|
||||
error instanceof Anthropic.APIError // Also will catch AuthenticationError!!!
|
||||
) {
|
||||
throw new RetryError(error.message);
|
||||
}
|
||||
|
@ -102,11 +102,14 @@ class OpenAIProvider extends Provider {
|
||||
cost,
|
||||
};
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
// If invalid Auth error we need to abort because no amount of waiting
|
||||
// will make auth better.
|
||||
if (error instanceof OpenAI.AuthenticationError) throw error;
|
||||
|
||||
if (
|
||||
error instanceof OpenAI.RateLimitError ||
|
||||
error instanceof OpenAI.InternalServerError ||
|
||||
error instanceof OpenAI.APIError
|
||||
error instanceof OpenAI.APIError // Also will catch AuthenticationError!!!
|
||||
) {
|
||||
throw new RetryError(error.message);
|
||||
}
|
||||
|
@ -157,8 +157,8 @@ class AgentHandler {
|
||||
}
|
||||
) {
|
||||
this.aibitat = new AIbitat({
|
||||
provider: "openai",
|
||||
model: "gpt-3.5-turbo",
|
||||
provider: this.provider ?? "openai",
|
||||
model: this.model ?? "gpt-3.5-turbo",
|
||||
chats: await this.#chatHistory(20),
|
||||
handlerProps: {
|
||||
invocation: this.invocation,
|
||||
|
Loading…
Reference in New Issue
Block a user