Skip to content

Commit

Permalink
Merge pull request elizaOS#2545 from elizaOS/tcm-fix-devlop
Browse files Browse the repository at this point in the history
fix: develop branch build/start failed
  • Loading branch information
tcm390 authored Jan 20, 2025
2 parents 4d5be44 + d364b74 commit e3a4e77
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
36 changes: 21 additions & 15 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ import { hyperliquidPlugin } from "@elizaos/plugin-hyperliquid";
import { echoChambersPlugin } from "@elizaos/plugin-echochambers";
import { dexScreenerPlugin } from "@elizaos/plugin-dexscreener";
import { pythDataPlugin } from "@elizaos/plugin-pyth-data";
import { openaiPlugin } from '@elizaos/plugin-openai';
import { openaiPlugin } from "@elizaos/plugin-openai";

import { zksyncEraPlugin } from "@elizaos/plugin-zksync-era";
import Database from "better-sqlite3";
Expand Down Expand Up @@ -209,7 +209,9 @@ export async function loadCharacterFromOnchain(): Promise<Character[]> {

// .id isn't really valid
const characterId = character.id || character.name;
const characterPrefix = `CHARACTER.${characterId.toUpperCase().replace(/ /g, "_")}.`;
const characterPrefix = `CHARACTER.${characterId
.toUpperCase()
.replace(/ /g, "_")}.`;

const characterSettings = Object.entries(process.env)
.filter(([key]) => key.startsWith(characterPrefix))
Expand Down Expand Up @@ -281,7 +283,9 @@ async function jsonToCharacter(

// .id isn't really valid
const characterId = character.id || character.name;
const characterPrefix = `CHARACTER.${characterId.toUpperCase().replace(/ /g, "_")}.`;
const characterPrefix = `CHARACTER.${characterId
.toUpperCase()
.replace(/ /g, "_")}.`;
const characterSettings = Object.entries(process.env)
.filter(([key]) => key.startsWith(characterPrefix))
.reduce((settings, [key, value]) => {
Expand Down Expand Up @@ -391,8 +395,9 @@ export async function loadCharacters(
if (characterPaths?.length > 0) {
for (const characterPath of characterPaths) {
try {
const character: Character =
await loadCharacterTryPath(characterPath);
const character: Character = await loadCharacterTryPath(
characterPath
);
loadedCharacters.push(character);
} catch (e) {
process.exit(1);
Expand Down Expand Up @@ -555,9 +560,10 @@ export function getTokenForProvider(
settings.VENICE_API_KEY
);
case ModelProviderName.ATOMA:
return (
character.settings?.secrets?.ATOMASDK_BEARER_AUTH ||
settings.ATOMASDK_BEARER_AUTH
return (
character.settings?.secrets?.ATOMASDK_BEARER_AUTH ||
settings.ATOMASDK_BEARER_AUTH
);
case ModelProviderName.NVIDIA:
return (
character.settings?.secrets?.NVIDIA_API_KEY ||
Expand Down Expand Up @@ -1050,12 +1056,13 @@ export async function createAgent(
getSecret(character, "PYTH_MAINNET_PROGRAM_KEY")
? pythDataPlugin
: null,
getSecret(character, "LND_TLS_CERT") &&
getSecret(character, "LND_MACAROON") &&
getSecret(character, "LND_SOCKET")
? lightningPlugin
: null,
getSecret(character, "OPENAI_API_KEY") && getSecret(character, "ENABLE_OPEN_AI_COMMUNITY_PLUGIN")
getSecret(character, "LND_TLS_CERT") &&
getSecret(character, "LND_MACAROON") &&
getSecret(character, "LND_SOCKET")
? lightningPlugin
: null,
getSecret(character, "OPENAI_API_KEY") &&
getSecret(character, "ENABLE_OPEN_AI_COMMUNITY_PLUGIN")
? openaiPlugin
: null,
].filter(Boolean),
Expand Down Expand Up @@ -1301,4 +1308,3 @@ if (
console.error("unhandledRejection", err);
});
}

17 changes: 14 additions & 3 deletions packages/plugin-agentkit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,26 @@ console.log("│ Initializing AgentKit Plugin... │");
console.log("│ Version: 0.0.1 │");
console.log("└════════════════════════════════════════┘");

const initializeActions = async () => {
try {
const actions = await getAgentKitActions({
getClient,
});
console.log("✔ AgentKit actions initialized successfully.");
return actions;
} catch (error) {
console.error("❌ Failed to initialize AgentKit actions:", error);
return null;
}
};

export const agentKitPlugin: Plugin = {
name: "[AgentKit] Integration",
description: "AgentKit integration plugin",
providers: [walletProvider],
evaluators: [],
services: [],
actions: await getAgentKitActions({
getClient,
}),
actions: await initializeActions(),
};

export default agentKitPlugin;

0 comments on commit e3a4e77

Please sign in to comment.