@@ -27,12 +27,15 @@ Example response:
27
27
}
28
28
\`\`\`
29
29
30
- {{message }}
30
+ {{recentMessages }}
31
31
32
32
Given the recent messages, extract the following information about the requested mint nft:
33
33
- collection contract address
34
34
35
- Respond with a JSON markdown block containing only the extracted values.` ;
35
+ Respond with a JSON markdown block containing only the extracted values.
36
+
37
+ Note: Make sure to extract the collection address from the most recent messages whenever possible.`
38
+
36
39
37
40
export interface MintContent extends Content {
38
41
collectionAddress : string ;
@@ -87,22 +90,25 @@ const mintNFTAction: Action = {
87
90
const agentName = runtime . character . name ;
88
91
const roomId = stringToUuid ( "nft_generate_room-" + agentName ) ;
89
92
90
- const memory : Memory = {
91
- agentId : userId ,
92
- userId,
93
- roomId,
94
- content : {
95
- text : message . content . text ,
96
- source : "nft-generator" ,
97
- } ,
98
- createdAt : Date . now ( ) ,
99
- embedding : getEmbeddingZeroVector ( ) ,
100
- } ;
101
- const state = await runtime . composeState ( memory , {
102
- message : message . content . text ,
103
- } ) ;
104
-
105
- elizaLogger . log ( "state:" , state ) ;
93
+ // const memory: Memory = {
94
+ // agentId: userId,
95
+ // userId,
96
+ // roomId,
97
+ // content: {
98
+ // text: message.content.text,
99
+ // source: "nft-generator",
100
+ // },
101
+ // createdAt: Date.now(),
102
+ // embedding: getEmbeddingZeroVector(),
103
+ // };
104
+ // const state = await runtime.composeState(memory, {
105
+ // message: message.content.text,
106
+ // });
107
+ if ( ! state ) {
108
+ state = ( await runtime . composeState ( message ) ) as State ;
109
+ } else {
110
+ state = await runtime . updateRecentMessageState ( state ) ;
111
+ }
106
112
107
113
// Compose transfer context
108
114
const transferContext = composeContext ( {
@@ -189,34 +195,6 @@ const mintNFTAction: Action = {
189
195
} ) ;
190
196
return false ;
191
197
}
192
-
193
- //
194
- // const userId = runtime.agentId;
195
- // elizaLogger.log("User ID:", userId);
196
- //
197
- // const collectionAddressRes = await createCollection({
198
- // runtime,
199
- // collectionName: runtime.character.name,
200
- // });
201
- //
202
- // const collectionInfo = collectionAddressRes.collectionInfo;
203
- //
204
- // elizaLogger.log("Collection Address:", collectionAddressRes);
205
-
206
- //
207
- // elizaLogger.log("NFT Address:", nftRes);
208
- //
209
- //
210
- // callback({
211
- // text: `Congratulations to you! 🎉🎉🎉 \nCollection : ${collectionAddressRes.link}\n NFT: ${nftRes.link}`, //caption.description,
212
- // attachments: [],
213
- // });
214
- // await sleep(15000);
215
- // await verifyNFT({
216
- // runtime,
217
- // collectionAddress: collectionAddressRes.address,
218
- // NFTAddress: nftRes.address,
219
- // });
220
198
return [ ] ;
221
199
} catch ( e : any ) {
222
200
console . log ( e ) ;
0 commit comments