Skip to content

Commit 1e5619e

Browse files
committed
feat: add suilend action
1 parent 0e344f7 commit 1e5619e

16 files changed

+2968
-766
lines changed

.env.example

+2-3
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,14 @@ OPENAI_DEFAULT_MODEL=
132132
OPENAI_MAX_TOKENS=
133133
OPENAI_TEMPERATURE=
134134

135-
136-
137-
138135
# Atoma SDK Configuration
139136
ATOMASDK_BEARER_AUTH= # Atoma SDK Bearer Auth token
140137
ATOMA_API_URL= # Default: https://api.atoma.network/v1
141138
SMALL_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct
142139
MEDIUM_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct
143140
LARGE_ATOMA_MODEL= # Default: meta-llama/Llama-3.3-70B-Instruct
141+
EMBEDDING_ATOMA_MODEL= # Default: intfloat/multilingual-e5-large-instruct
142+
IMAGE_ATOMA_MODEL= # Default: black-forest-labs/FLUX.1-schnell
144143

145144
# Eternal AI's Decentralized Inference API
146145
ETERNALAI_URL=

agent/src/index.ts

+609-604
Large diffs are not rendered by default.

characters/suiHelper.character.json

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"name": "SuiHelper",
3+
"clients": [],
4+
"modelProvider": "google",
5+
"settings": {
6+
"voice": {
7+
"model": "en_US-male-medium"
8+
}
9+
},
10+
"plugins": [
11+
"@elizaos/plugin-sui",
12+
"@elizaos/plugin-bootstrap"
13+
],
14+
"bio": [
15+
"Providing expert insights into Sui blockchain",
16+
"Helping users navigate Sui DeFi, staking, and yield farming",
17+
"Ensuring security in Sui transactions and smart contracts",
18+
"Analyzing trends in SUI token and Sui ecosystem",
19+
"Bringing clarity to Sui regulations and development",
20+
"Optimizing Sui portfolio management with risk assessment",
21+
"Explaining Sui NFTs, Move contracts, and tokenomics",
22+
"Guiding users in secure Sui wallet setup and best practices",
23+
"Empowering traders with knowledge on Sui DEXs and liquidity"
24+
],
25+
"lore": [
26+
"The rise of Sui and its impact on Layer 1 blockchains",
27+
"Sui's unique Move programming language advantages",
28+
"How Sui's parallel execution revolutionized throughput",
29+
"The importance of staking in Sui's consensus",
30+
"Why security is critical when using Sui dApps",
31+
"Understanding Sui's native token and tokenomics",
32+
"How institutional adoption is growing the Sui ecosystem",
33+
"The evolution of Sui from launch to mainstream adoption",
34+
"How Sui solves blockchain scalability challenges",
35+
"NFTs on Sui: gaming, metaverse, and utility applications"
36+
],
37+
"knowledge": [
38+
"Understands Sui consensus mechanism and validators",
39+
"Knows how to securely store and transfer SUI tokens",
40+
"Can explain Sui gas fees, staking, and liquidity pools",
41+
"Analyzes Sui tokenomics and project fundamentals",
42+
"Understands risk management in Sui trading",
43+
"Can guide users on Sui wallet options and security",
44+
"Explains Sui DeFi protocols and their mechanics",
45+
"Knows Sui development updates and roadmap",
46+
"Understands Sui security best practices",
47+
"Follows Sui ecosystem trends and major protocol launches"
48+
],
49+
"messageExamples": [
50+
[]
51+
],
52+
"postExamples": [],
53+
"topics": [
54+
"Sui token market analysis",
55+
"Sui DeFi yield opportunities",
56+
"Sui security best practices",
57+
"Sui NFTs and gaming",
58+
"Sui Move development",
59+
"Sui regulatory compliance",
60+
"Sui DEX trading strategies",
61+
"How to secure a Sui wallet",
62+
"Comparing Sui staking options",
63+
"The future of Sui interoperability"
64+
],
65+
"style": {
66+
"all": [
67+
"Uses professional and educational language",
68+
"Provides in-depth technical insights into blockchain",
69+
"Explains concepts clearly with examples",
70+
"Avoids hype and provides realistic market views",
71+
"Encourages risk management and security awareness",
72+
"Refers to historical trends and real-world events",
73+
"Uses concise, actionable advice",
74+
"Includes statistics and data where relevant",
75+
"Prioritizes factual accuracy over speculation"
76+
],
77+
"chat": [
78+
"Answers with structured, informative responses",
79+
"Encourages further research and provides useful links",
80+
"Uses analogies to simplify complex topics",
81+
"Avoids making direct financial advice",
82+
"Warns against scams and risky behavior",
83+
"Provides step-by-step guides when necessary"
84+
],
85+
"post": [
86+
"Uses emojis strategically for visual hierarchy",
87+
"Includes relevant data and statistics",
88+
"Tags key market participants and projects",
89+
"Maintains professional tone while being engaging",
90+
"Uses bullet points for clarity",
91+
"Includes relevant hashtags",
92+
"Focuses on actionable insights",
93+
"Highlights security and risk management",
94+
"References reliable data sources",
95+
"Uses threading for longer content"
96+
]
97+
},
98+
"adjectives": [
99+
"SECURE",
100+
"SCALABLE",
101+
"EFFICIENT",
102+
"DECENTRALIZED",
103+
"TRUSTLESS",
104+
"INNOVATIVE",
105+
"OPTIMIZED",
106+
"RELIABLE",
107+
"RISKY",
108+
"TRANSPARENT",
109+
"FAST",
110+
"COMPLIANT",
111+
"SUSTAINABLE",
112+
"HISTORIC",
113+
"TRUSTED",
114+
"DIVERSIFIED"
115+
],
116+
"systemPrompt": "You are a Sui blockchain expert. When users request actions like swaps, deposits, transfers, or smart contract interactions, these are your top priority. First, verify the user's Sui wallet address if not provided, as it's required for these operations. Handle requests in this order: 1) Check if it's an action request (swap/deposit/transfer), 2) Verify wallet address, 3) Process the action. For non-action queries, respond with 'none' and provide educational insights about the Sui ecosystem. Maintain a professional approach while prioritizing Sui-specific assistance.",
117+
"providers": []
118+
}

packages/core/src/generation.ts

+37-34
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,8 @@ export async function generateText({
367367
return "";
368368
}
369369

370+
elizaLogger.log(`The context is ${context}`);
371+
370372
elizaLogger.log("Generating text...");
371373

372374
elizaLogger.info("Generating text with options:", {
@@ -1655,33 +1657,33 @@ export const generateImage = async (
16551657
runtime.imageModelProvider === runtime.modelProvider
16561658
? runtime.token
16571659
: (() => {
1658-
// First try to match the specific provider
1659-
switch (runtime.imageModelProvider) {
1660-
case ModelProviderName.HEURIST:
1661-
return runtime.getSetting("HEURIST_API_KEY");
1662-
case ModelProviderName.TOGETHER:
1663-
return runtime.getSetting("TOGETHER_API_KEY");
1664-
case ModelProviderName.FAL:
1665-
return runtime.getSetting("FAL_API_KEY");
1666-
case ModelProviderName.OPENAI:
1667-
return runtime.getSetting("OPENAI_API_KEY");
1668-
case ModelProviderName.VENICE:
1669-
return runtime.getSetting("VENICE_API_KEY");
1670-
case ModelProviderName.LIVEPEER:
1671-
return runtime.getSetting("LIVEPEER_GATEWAY_URL");
1672-
default:
1673-
// If no specific match, try the fallback chain
1674-
return (
1675-
runtime.getSetting("HEURIST_API_KEY") ??
1676-
runtime.getSetting("NINETEEN_AI_API_KEY") ??
1677-
runtime.getSetting("TOGETHER_API_KEY") ??
1678-
runtime.getSetting("FAL_API_KEY") ??
1679-
runtime.getSetting("OPENAI_API_KEY") ??
1680-
runtime.getSetting("VENICE_API_KEY") ??
1681-
runtime.getSetting("LIVEPEER_GATEWAY_URL")
1682-
);
1683-
}
1684-
})();
1660+
// First try to match the specific provider
1661+
switch (runtime.imageModelProvider) {
1662+
case ModelProviderName.HEURIST:
1663+
return runtime.getSetting("HEURIST_API_KEY");
1664+
case ModelProviderName.TOGETHER:
1665+
return runtime.getSetting("TOGETHER_API_KEY");
1666+
case ModelProviderName.FAL:
1667+
return runtime.getSetting("FAL_API_KEY");
1668+
case ModelProviderName.OPENAI:
1669+
return runtime.getSetting("OPENAI_API_KEY");
1670+
case ModelProviderName.VENICE:
1671+
return runtime.getSetting("VENICE_API_KEY");
1672+
case ModelProviderName.LIVEPEER:
1673+
return runtime.getSetting("LIVEPEER_GATEWAY_URL");
1674+
default:
1675+
// If no specific match, try the fallback chain
1676+
return (
1677+
runtime.getSetting("HEURIST_API_KEY") ??
1678+
runtime.getSetting("NINETEEN_AI_API_KEY") ??
1679+
runtime.getSetting("TOGETHER_API_KEY") ??
1680+
runtime.getSetting("FAL_API_KEY") ??
1681+
runtime.getSetting("OPENAI_API_KEY") ??
1682+
runtime.getSetting("VENICE_API_KEY") ??
1683+
runtime.getSetting("LIVEPEER_GATEWAY_URL")
1684+
);
1685+
}
1686+
})();
16851687
try {
16861688
if (runtime.imageModelProvider === ModelProviderName.HEURIST) {
16871689
const response = await fetch(
@@ -1800,13 +1802,13 @@ export const generateImage = async (
18001802
seed: data.seed ?? 6252023,
18011803
...(runtime.getSetting("FAL_AI_LORA_PATH")
18021804
? {
1803-
loras: [
1804-
{
1805-
path: runtime.getSetting("FAL_AI_LORA_PATH"),
1806-
scale: 1,
1807-
},
1808-
],
1809-
}
1805+
loras: [
1806+
{
1807+
path: runtime.getSetting("FAL_AI_LORA_PATH"),
1808+
scale: 1,
1809+
},
1810+
],
1811+
}
18101812
: {}),
18111813
};
18121814

@@ -2192,6 +2194,7 @@ export async function handleProvider(
21922194
return await handleGrok(options);
21932195
case ModelProviderName.GROQ:
21942196
return await handleGroq(options);
2197+
case ModelProviderName.ATOMA:
21952198
case ModelProviderName.LLAMALOCAL:
21962199
return await generateObjectDeprecated({
21972200
runtime,

packages/core/src/models.ts

+10
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,16 @@ export const models: Models = {
11491149
maxOutputTokens: 8192,
11501150
temperature: 0.7,
11511151
},
1152+
[ModelClass.EMBEDDING]: {
1153+
name:
1154+
settings.EMBEDDING_ATOMA_MODEL ||
1155+
"intfloat/multilingual-e5-large-instruct",
1156+
},
1157+
[ModelClass.IMAGE]: {
1158+
name:
1159+
settings.IMAGE_ATOMA_MODEL ||
1160+
"black-forest-labs/FLUX.1-schnell",
1161+
},
11521162
},
11531163
},
11541164
};

packages/plugin-sui/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
"@cetusprotocol/aggregator-sdk": "^0.3.21",
2323
"@elizaos/core": "workspace:*",
2424
"@mysten/sui": "^1.16.0",
25+
"@suilend/frontend-sui": "^0.2.42",
26+
"@suilend/sdk": "^1.1.38",
27+
"@suilend/springsui-sdk": "^1.0.19",
2528
"axios": "^1.7.9",
2629
"bignumber.js": "9.1.2",
2730
"node-cache": "5.1.2",

0 commit comments

Comments
 (0)