@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.
@@ -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: "Saltcorn Agent copilot",
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: "Saltcorn Agent copilot",
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
@@ -23,6 +23,8 @@ module.exports = {
23
23
  agent_skills: [
24
24
  require("./agent-skills/pagegen.js"),
25
25
  require("./agent-skills/database-design.js"),
26
+ require("./agent-skills/workflow.js"),
27
+ require("./agent-skills/viewgen.js"),
26
28
  ],
27
29
  },
28
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/copilot",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "AI assistant for building Saltcorn applications",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -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);