Skip to content

Commit

Permalink
fixed all the typing issues (#2893)
Browse files Browse the repository at this point in the history
Co-authored-by: Shakker Nerd <[email protected]>
  • Loading branch information
AIFlowML and shakkernerd authored Jan 28, 2025
1 parent 4773059 commit 8ba956f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
6 changes: 3 additions & 3 deletions packages/plugin-primus/src/actions/postTweetAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ export const postTweetAction: Action = {
similes: ["TWEET", "POST", "SEND_TWEET"],
validate: async (
// eslint-disable-next-line
runtime: IAgentRuntime,
_runtime: IAgentRuntime,
// eslint-disable-next-line
message: Memory,
_message: Memory,
// eslint-disable-next-line
state?: State
_state?: State
) => {
const hasCredentials =
!!process.env.TWITTER_USERNAME && !!process.env.TWITTER_PASSWORD;
Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-primus/src/adapter/primusAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ export class PrimusAdapter implements IVerifiableInferenceAdapter {
}

// Get provider-specific endpoint, auth header and response json path
let endpoint;
let authHeader;
let responseParsePath;
let endpoint: string;
let authHeader: string;
let responseParsePath: string;

switch (provider) {
case ModelProviderName.OPENAI:
Expand All @@ -70,7 +70,7 @@ export class PrimusAdapter implements IVerifiableInferenceAdapter {
models[provider].model[modelClass].temperature,
};
const attestation = await generateProof(endpoint,"POST",headers,JSON.stringify(body),responseParsePath);
elizaLogger.log(`model attestation:`, attestation);
elizaLogger.log("model attestation:", attestation);

const responseData = JSON.parse(attestation.data);
const text = JSON.parse(responseData.content);
Expand Down
10 changes: 8 additions & 2 deletions packages/plugin-primus/src/providers/tokenPriceProvider.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import {elizaLogger, type IAgentRuntime, type Memory, type Provider, type State} from "@elizaos/core";
import {generateProof, verifyProof} from "../util/primusUtil.ts";

interface PrimusAttestation {
data: string;
[key: string]: unknown;
}

const tokenPriceProvider: Provider = {
// eslint-disable-next-line
get: async (runtime: IAgentRuntime, message: Memory, state?: State) => {
get: async (_runtime: IAgentRuntime, _message: Memory, _state?: State) => {
//get btc price
const url = `${process.env.BINANCE_API_URL||'https://api.binance.com'}/api/v3/ticker/price?symbol=${process.env.BINANCE_SYMBOL || 'BTCUSDT'}`;
const method = 'GET';
Expand All @@ -17,7 +22,8 @@ const tokenPriceProvider: Provider = {
}
elizaLogger.info('price attestation:',attestation);
try{
const responseData = JSON.parse((attestation as any).data);
const responseData = JSON.parse((attestation as PrimusAttestation).data);
// const responseData = JSON.parse((attestation as any).data);
const price = responseData.content;
return `
Get BTC price from Binance:
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-primus/src/providers/tweetProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {TwitterScraper} from "../util/twitterScraper.ts";

const tweetProvider: Provider = {
// eslint-disable-next-line
get: async (runtime: IAgentRuntime, message: Memory, state?: State) => {
get: async (_runtime: IAgentRuntime, _message: Memory, _state?: State) => {
const scraperWithPrimus = new TwitterScraper();
try {
elizaLogger.info("Attempting Twitter login");
Expand Down

0 comments on commit 8ba956f

Please sign in to comment.