θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
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
8 changes: 7 additions & 1 deletion server/utils/agents/aibitat/plugins/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
6 changes: 5 additions & 1 deletion server/utils/agents/aibitat/providers/anthropic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
7 changes: 5 additions & 2 deletions server/utils/agents/aibitat/providers/openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions server/utils/agents/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down