@saltcorn/copilot 0.7.2 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/generate-tables.js +13 -2
- package/actions/generate-workflow.js +106 -20
- package/agent-skills/database-design.js +191 -27
- package/agent-skills/pagegen.js +0 -11
- package/agent-skills/viewgen.js +198 -0
- package/agent-skills/workflow.js +638 -0
- package/builder-gen.js +17 -6
- package/chat-copilot.js +0 -2
- package/copilot-as-agent.js +19 -3
- package/index.js +2 -0
- package/package.json +1 -1
- package/page-gen-action.js +0 -5
package/copilot-as-agent.js
CHANGED
|
@@ -32,25 +32,30 @@ const { getState } = require("@saltcorn/data/db/state");
|
|
|
32
32
|
const get_state_fields = () => [];
|
|
33
33
|
|
|
34
34
|
const sys_prompt = ``;
|
|
35
|
+
const viewname = "Saltcorn Agent copilot";
|
|
35
36
|
|
|
36
37
|
const get_agent_view = () => {
|
|
37
38
|
const agent_action = new Trigger({
|
|
38
39
|
action: "Agent",
|
|
39
40
|
when_trigger: "Never",
|
|
40
41
|
configuration: {
|
|
42
|
+
viewname,
|
|
41
43
|
sys_prompt,
|
|
42
44
|
skills: [
|
|
43
45
|
{ skill_type: "Generate Page" },
|
|
44
46
|
{ skill_type: "Database design" },
|
|
47
|
+
{ skill_type: "Generate Workflow" },
|
|
48
|
+
{ skill_type: "Generate View" },
|
|
45
49
|
],
|
|
46
50
|
},
|
|
47
51
|
});
|
|
48
52
|
return new View({
|
|
49
53
|
viewtemplate: "Agent Chat",
|
|
50
|
-
name:
|
|
54
|
+
name: viewname,
|
|
51
55
|
min_role: 1,
|
|
52
56
|
configuration: {
|
|
53
57
|
agent_action,
|
|
58
|
+
viewname,
|
|
54
59
|
},
|
|
55
60
|
});
|
|
56
61
|
};
|
|
@@ -64,12 +69,23 @@ const interact = async (table_id, viewname, config, body, reqres) => {
|
|
|
64
69
|
return await view.runRoute("interact", body, reqres.res, reqres);
|
|
65
70
|
};
|
|
66
71
|
|
|
72
|
+
const execute_user_action = async (
|
|
73
|
+
table_id,
|
|
74
|
+
viewname,
|
|
75
|
+
config,
|
|
76
|
+
body,
|
|
77
|
+
reqres,
|
|
78
|
+
) => {
|
|
79
|
+
const view = get_agent_view();
|
|
80
|
+
return await view.runRoute("execute_user_action", body, reqres.res, reqres);
|
|
81
|
+
};
|
|
82
|
+
|
|
67
83
|
module.exports = {
|
|
68
|
-
name:
|
|
84
|
+
name: viewname,
|
|
69
85
|
display_state_form: false,
|
|
70
86
|
get_state_fields,
|
|
71
87
|
tableless: true,
|
|
72
88
|
singleton: true,
|
|
73
89
|
run,
|
|
74
|
-
routes: { interact },
|
|
90
|
+
routes: { interact, execute_user_action },
|
|
75
91
|
};
|
package/index.js
CHANGED
package/package.json
CHANGED
package/page-gen-action.js
CHANGED
|
@@ -126,10 +126,6 @@ const upsertHtmlPreviewPage = async (name, html, title, description, user) => {
|
|
|
126
126
|
module.exports = {
|
|
127
127
|
description: "Generate page with AI copilot",
|
|
128
128
|
configFields: ({ table, mode }) => {
|
|
129
|
-
console.log({
|
|
130
|
-
table,
|
|
131
|
-
mode,
|
|
132
|
-
}, "OOOOOOOOOO");
|
|
133
129
|
if (mode === "workflow") {
|
|
134
130
|
return [
|
|
135
131
|
{
|
|
@@ -210,7 +206,6 @@ module.exports = {
|
|
|
210
206
|
},
|
|
211
207
|
];
|
|
212
208
|
} else if (table) {
|
|
213
|
-
console.log(JSON.stringify(table, null, 2), "TABLE");
|
|
214
209
|
const textFields = table.fields
|
|
215
210
|
.filter((f) => f.type?.sql_name === "text")
|
|
216
211
|
.map((f) => f.name);
|