Skip to content

Commit 086429e

Browse files
committed
feat(plugin-nft-generation): change mintTemplate.
1 parent db49a68 commit 086429e

File tree

1 file changed

+24
-46
lines changed

1 file changed

+24
-46
lines changed

packages/plugin-nft-generation/src/actions/mintNFTAction.ts

+24-46
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ Example response:
2727
}
2828
\`\`\`
2929
30-
{{message}}
30+
{{recentMessages}}
3131
3232
Given the recent messages, extract the following information about the requested mint nft:
3333
- collection contract address
3434
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+
3639

3740
export interface MintContent extends Content {
3841
collectionAddress: string;
@@ -87,22 +90,25 @@ const mintNFTAction: Action = {
8790
const agentName = runtime.character.name;
8891
const roomId = stringToUuid("nft_generate_room-" + agentName);
8992

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+
}
106112

107113
// Compose transfer context
108114
const transferContext = composeContext({
@@ -189,34 +195,6 @@ const mintNFTAction: Action = {
189195
});
190196
return false;
191197
}
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-
// });
220198
return [];
221199
} catch (e: any) {
222200
console.log(e);

0 commit comments

Comments
 (0)