Skip to content

Commit 3d1e65d

Browse files
add recentMessages to deployContractTemplate
Signed-off-by: Agustín Ramiro Díaz <agustin.ramiro.diaz@gmail.com>
1 parent ac1a296 commit 3d1e65d

File tree

1 file changed

+50
-3
lines changed

1 file changed

+50
-3
lines changed

packages/plugin-genlayer/src/actions/deployContract.ts

+50-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ const deployContractTemplate = `
1616
1717
# Instructions: The user is requesting to deploy a contract to the GenLayer protocol.
1818
19-
Here is the user's request:
19+
<latest user message>
2020
{{userMessage}}
21+
</latest user message>
22+
23+
<data from recent messages>
24+
{{recentMessagesData}}
25+
</data from recent messages>
2126
2227
# Your response must be formatted as a JSON block with this structure:
2328
\`\`\`json
@@ -51,7 +56,8 @@ export const deployContractAction: Action = {
5156
const options = await getParamsWithLLM<DeployContractParams>(
5257
runtime,
5358
message,
54-
deployContractTemplate
59+
deployContractTemplate,
60+
state
5561
);
5662

5763
if (!options) {
@@ -88,7 +94,7 @@ export const deployContractAction: Action = {
8894
{
8995
user: "{{user1}}",
9096
content: {
91-
text: "Deploy a new contract with code 'contract MyContract { uint256 value; function set(uint256 v) public { value = v; } }' and no constructor arguments",
97+
text: "Deploy a new contract from /home/az/yeagerai/genlayer-studio/examples/contracts/wizard_of_coin.py with the argument 'true'",
9298
},
9399
},
94100
{
@@ -99,5 +105,46 @@ export const deployContractAction: Action = {
99105
},
100106
},
101107
],
108+
[
109+
{
110+
user: "{{user1}}",
111+
content: {
112+
text: "Please help me deploy a contract",
113+
},
114+
},
115+
{
116+
user: "{{agentName}}",
117+
content: {
118+
text: "Sure! I'll help you deploy a contract. Please provide the code file path and constructor arguments.",
119+
action: "CONTINUE",
120+
},
121+
},
122+
{
123+
user: "{{user1}}",
124+
content: {
125+
text: "The code file is /home/az/yeagerai/genlayer-studio/examples/contracts/wizard_of_coin.py",
126+
},
127+
},
128+
{
129+
user: "{{agentName}}",
130+
content: {
131+
text: "Understood, I'll help you deploy the contract from /home/az/yeagerai/genlayer-studio/examples/contracts/wizard_of_coin.py. Now, please provide the constructor arguments.",
132+
action: "CONTINUE",
133+
},
134+
},
135+
{
136+
user: "{{user1}}",
137+
content: {
138+
text: "The constructor argument is 'true'",
139+
},
140+
},
141+
{
142+
user: "{{agentName}}",
143+
content: {
144+
text: "Perfect, I'll help you deploy the contract from /home/az/yeagerai/genlayer-studio/examples/contracts/wizard_of_coin.py with the argument 'true'.",
145+
action: "DEPLOY_CONTRACT",
146+
},
147+
},
148+
],
102149
],
103150
};

0 commit comments

Comments
 (0)