Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(chore): Refactor generation to reflect handler pattern #3376

Merged
merged 3 commits into from
Feb 8, 2025
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@
- Implement Redis Caching for Performance [\#1277](https://github.com/elizaOS/eliza/issues/1277)
- Improve logging for the Coinbase plugin [\#1261](https://github.com/elizaOS/eliza/issues/1261)
- doc: Add Twitter automation label requirement to quickstart guide [\#1253](https://github.com/elizaOS/eliza/issues/1253)
- Enhance Logging in /packages/plugin-coinbase/src/plugins Using elizaLogger [\#1192](https://github.com/elizaOS/eliza/issues/1192)
- Enhance Logging in /packages/plugin-coinbase/src/plugins Using logger [\#1192](https://github.com/elizaOS/eliza/issues/1192)
- Improve Logging in /packages/plugin-coinbase/src/plugins [\#1189](https://github.com/elizaOS/eliza/issues/1189)
- Feat: add github client to core agent [\#1130](https://github.com/elizaOS/eliza/issues/1130)

Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"dependencies": {
"@elizaos/plugin-bootstrap": "workspace:*",
"@elizaos/plugin-openai": "workspace:*",
"@elizaos/core": "workspace:*",
"@types/body-parser": "1.19.5",
"@types/cors": "2.8.17",
Expand Down
22 changes: 11 additions & 11 deletions packages/agent/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
type AgentRuntime,
type Character,
elizaLogger,
logger,
getEnvVariable,
type UUID,
validateCharacterConfig,
Expand Down Expand Up @@ -152,7 +152,7 @@ export function createApiRouter(
try {
validateCharacterConfig(character);
} catch (e) {
elizaLogger.error(`Error parsing character: ${e}`);
logger.error(`Error parsing character: ${e}`);
res.status(400).json({
success: false,
message: e.message,
Expand All @@ -163,9 +163,9 @@ export function createApiRouter(
// start it up (and register it)
try {
agent = await directClient.startAgent(character);
elizaLogger.log(`${character.name} started`);
logger.log(`${character.name} started`);
} catch (e) {
elizaLogger.error(`Error starting agent: ${e}`);
logger.error(`Error starting agent: ${e}`);
res.status(500).json({
success: false,
message: e.message,
Expand All @@ -191,11 +191,11 @@ export function createApiRouter(
2
)
);
elizaLogger.info(
logger.info(
`Character stored successfully at ${filepath}`
);
} catch (error) {
elizaLogger.error(
logger.error(
`Failed to store character: ${error.message}`
);
}
Expand Down Expand Up @@ -324,7 +324,7 @@ export function createApiRouter(
// );
// res.json({ agents: allAgents, attestation: attestation });
// } catch (error) {
// elizaLogger.error("Failed to get TEE agents:", error);
// logger.error("Failed to get TEE agents:", error);
// res.status(500).json({
// error: "Failed to get TEE agents",
// });
Expand All @@ -350,7 +350,7 @@ export function createApiRouter(
// );
// res.json({ agent: teeAgent, attestation: attestation });
// } catch (error) {
// elizaLogger.error("Failed to get TEE agent:", error);
// logger.error("Failed to get TEE agent:", error);
// res.status(500).json({
// error: "Failed to get TEE agent",
// });
Expand Down Expand Up @@ -391,7 +391,7 @@ export function createApiRouter(
// attestation: attestation,
// });
// } catch (error) {
// elizaLogger.error("Failed to get TEE logs:", error);
// logger.error("Failed to get TEE logs:", error);
// res.status(500).json({
// error: "Failed to get TEE logs",
// });
Expand All @@ -417,14 +417,14 @@ export function createApiRouter(
throw new Error("No character path or JSON provided");
}
await directClient.startAgent(character);
elizaLogger.log(`${character.name} started`);
logger.log(`${character.name} started`);

res.json({
id: character.id,
character: character,
});
} catch (e) {
elizaLogger.error(`Error parsing character: ${e}`);
logger.error(`Error parsing character: ${e}`);
res.status(400).json({
error: e.message,
});
Expand Down
8 changes: 5 additions & 3 deletions packages/agent/src/defaultCharacter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { type Character, ModelProviderName } from "@elizaos/core";
import { type Character } from "@elizaos/core";
import { openaiPlugin } from "@elizaos/plugin-openai";

export const defaultCharacter: Character = {
name: "Eliza",
username: "eliza",
plugins: [],
modelProvider: ModelProviderName.OPENAI,
plugins: [
openaiPlugin
],
settings: {
secrets: {},
voice: {
Expand Down
Loading
Loading