diff --git a/agent/src/index.ts b/agent/src/index.ts index 190e9254d9..c9fd57793b 100644 --- a/agent/src/index.ts +++ b/agent/src/index.ts @@ -29,7 +29,7 @@ import { newsPlugin } from "@ai16z/plugin-news"; import { zgPlugin } from "@ai16z/plugin-0g"; import { bootstrapPlugin } from "@ai16z/plugin-bootstrap"; import createGoatPlugin from "@ai16z/plugin-goat"; -import { intifacePlugin } from "@ai16z/plugin-intiface"; +//import { intifacePlugin } from "@ai16z/plugin-intiface"; import { DirectClient } from "@ai16z/client-direct"; import { aptosPlugin } from "@ai16z/plugin-aptos"; import { @@ -483,7 +483,6 @@ export async function createAgent( // character.plugins are handled when clients are added plugins: [ bootstrapPlugin, - newsPlugin, getSecret(character, "CONFLUX_CORE_PRIVATE_KEY") ? confluxPlugin : null, diff --git a/packages/plugin-news/src/actions/news.ts b/packages/plugin-news/src/actions/news.ts index 5304d9af19..887315bc64 100644 --- a/packages/plugin-news/src/actions/news.ts +++ b/packages/plugin-news/src/actions/news.ts @@ -10,11 +10,15 @@ import { type Action, } from "@ai16z/eliza"; - export const currentNewsAction: Action = { name: "CURRENT_NEWS", similes: ["NEWS", "GET_NEWS", "GET_CURRENT_NEWS"], validate: async (_runtime: IAgentRuntime, _message: Memory) => { + const apiKey = process.env.NEWS_API_KEY; + if (!apiKey) { + console.error('NEWS_API_KEY environment variable is not set'); + return false; + } return true; }, description: @@ -28,11 +32,6 @@ export const currentNewsAction: Action = { ): Promise => { async function getCurrentNews(searchTerm: string) { try { - const apiKey = process.env.NEWS_API_KEY; - if (!apiKey) { - throw new Error('NEWS_API_KEY environment variable is not set'); - } - // Add quotes and additional context terms const enhancedSearchTerm = encodeURIComponent(`"${searchTerm}" AND (Spain OR Spanish OR Madrid OR Felipe)`); @@ -43,7 +42,7 @@ export const currentNewsAction: Action = { `sortBy=relevancy&` + `language=en&` + `pageSize=50&` + - `apiKey=${apiKey}` + `apiKey=${process.env.NEWS_API_KEY}` ), fetch( `https://newsapi.org/v2/top-headlines?` + @@ -51,7 +50,7 @@ export const currentNewsAction: Action = { `country=es&` + `language=en&` + `pageSize=50&` + - `apiKey=${apiKey}` + `apiKey=${process.env.NEWS_API_KEY}` ) ]);