-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathmock_agent.py
111 lines (108 loc) · 3.51 KB
/
mock_agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import json
mock_function_call_list = [
("function_define",{
"functions": [
{
"integration_name": "webhook",
"resource_name": "default",
"operation_name": "default",
"comments": "This is the entry point of the workflow, the workflow will be executed when the user clicks the button",
"TODO": [
"According to the UI description, this trigger may not need any parameters to fill in"
]
},
{
"integration_name": "n8nTrainingCustomerDatastore",
"resource_name": "default",
"operation_name": "getOnePerson",
"comments": "Use this action to simulate the operation of obtaining model version information",
"TODO": [
"After implementing this action, you need to check the data format of the model version information to prepare for the implementation of the workflow"
]
},
{
"integration_name": "slack",
"resource_name": "message",
"operation_name": "post",
"comments": "Use this action to send model version information and self-introduction to the #general channel of slack",
"TODO": [
"After implementing this action, you need to check the data format required for sending information to prepare for the implementation of the workflow"
]
}
]
}),
("function_rewrite_params",{
"function_name": "action_1",
"params": json.dumps(
{
"select": "channel",
"channelId": {
"mode": "name",
"value": "#general"
},
"messageType": "text",
"text": "Hello everyone, I'm ChatGPT"
}
),
"comments": "This is the trigger point of the workflow, the workflow will be executed when the user clicks a button",
"TODO": [
"Execute this trigger and then check the output to see if it meets our expectations"
]
}),
("function_rewrite_params",{
"function_name": "trigger_0",
"params": json.dumps(
{
"httpMethod": "GET",
"path": "/trigger",
"responseMode": "onReceived",
"responseData": "allEntries"
}
),
"comments": "This is the trigger point of the workflow, the workflow will be executed when the user sends a get request",
"TODO": [
"Execute this trigger and then check the output to see if it meets our expectations"
]
}),
("workflow_implment",{
"workflow_name": "mainWorkflow",
"code": """
def mainWorkflow(trigger_input: [{...}]):
\"\"\"
comments: You need to give comments when implementing mainWorkflow
TODOs:
- first define some actions
- define a trigger
- then implement this
\"\"\"
print("Please call Workflow-implement first")
print(trigger_input)
subworkflow_auto(trigger_input)
print(trigger_input)
subworkflow_auto(trigger_input)
print(trigger_input)
trigger_input.append({})
subworkflow_auto(trigger_input)
assert False, "nmsl"
""",
}),
("workflow_implment",{
"workflow_name": "subworkflow_auto",
"code": """
def subworkflow_auto(father_input):
output = subworkflow_hihihi(father_input)
father_input.append({})
return output
""",
}),
("workflow_implment",{
"workflow_name": "subworkflow_hihihi",
"code": """
def subworkflow_hihihi(father_input):
print("hihihi")
if len(father_input) > 1:
return action_1(father_input)
return father_input
""",
})
]