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