@saltcorn/copilot 0.7.5 → 0.8.1

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.
@@ -57,7 +57,7 @@ class GeneratePageSkill {
57
57
  `${name}.html`,
58
58
  "text/html",
59
59
  html,
60
- user.id,
60
+ user?.id,
61
61
  100,
62
62
  );
63
63
 
@@ -96,7 +96,7 @@ class GeneratePageSkill {
96
96
  );
97
97
  } else return "Metadata recieved";
98
98
  },
99
- postProcess: async ({ tool_call, generate }) => {
99
+ postProcess: async ({ tool_call, generate, req }) => {
100
100
  const str = await generate(
101
101
  `Now generate the contents of the ${tool_call.input.name} HTML page. If I asked you to embed a view,
102
102
  use the <embed-view> self-closing tag to do so, setting the view name in the viewname attribute. For example,
@@ -120,6 +120,19 @@ class GeneratePageSkill {
120
120
  ? str.split("```html")[1].split("```")[0]
121
121
  : str;
122
122
 
123
+ if (this.yoloMode) {
124
+ await this.userActions.build_copilot_page_gen({
125
+ user: req?.user,
126
+ name: tool_call.input.name,
127
+ title: tool_call.input.title,
128
+ description: tool_call.input.description,
129
+ html,
130
+ });
131
+ return {
132
+ stop: true,
133
+ add_response: `Page ${tool_call.input.name} created.`,
134
+ };
135
+ }
123
136
  return {
124
137
  stop: true,
125
138
  add_response: iframe({
@@ -127,10 +140,10 @@ class GeneratePageSkill {
127
140
  width: 500,
128
141
  height: 800,
129
142
  }),
130
- add_system_prompt: `If the user asks you to regenerate the page,
131
- you must run the generate_page tool again. After running this tool
132
- you will be prompted to generate the html again. You should repeat
133
- the html from the previous answer except for the changes the user
143
+ add_system_prompt: `If the user asks you to regenerate the page,
144
+ you must run the generate_page tool again. After running this tool
145
+ you will be prompted to generate the html again. You should repeat
146
+ the html from the previous answer except for the changes the user
134
147
  is requesting.`,
135
148
  add_user_action: {
136
149
  name: "build_copilot_page_gen",