@saltcorn/agents 0.8.0 → 0.8.2

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.
Files changed (3) hide show
  1. package/action.js +4 -1
  2. package/agent-view.js +14 -12
  3. package/package.json +1 -1
package/action.js CHANGED
@@ -109,6 +109,8 @@ module.exports = {
109
109
  ...rest
110
110
  }) => {
111
111
  const userinput = interpolate(configuration.prompt, row, user);
112
+ let triggering_row_id;
113
+ if (table && row) triggering_row_id = row[table.pk_name];
112
114
 
113
115
  const run =
114
116
  rest.run ||
@@ -123,6 +125,7 @@ module.exports = {
123
125
  interactions: [],
124
126
  html_interactions: [],
125
127
  funcalls: {},
128
+ triggering_row_id,
126
129
  },
127
130
  }));
128
131
 
@@ -150,7 +153,7 @@ module.exports = {
150
153
  use_agent_view_config?.layout,
151
154
  req?.user,
152
155
  ),
153
- );
156
+ );
154
157
 
155
158
  return await process_interaction(
156
159
  run,
package/agent-view.js CHANGED
@@ -1537,18 +1537,20 @@ const execute_user_action = async (
1537
1537
  [req.user.id],
1538
1538
  );
1539
1539
  // remove from html_interactions
1540
- run.context.html_interactions = run.context.html_interactions.map(
1541
- (hi) => {
1542
- if (hi.includes(`button data-useraction-id="${uadata.rndid}"`))
1543
- return wrapSegment(
1544
- uadata.click_replace_text,
1545
- "You",
1546
- true,
1547
- config.layout,
1548
- req?.user,
1549
- );
1550
- return hi;
1551
- },
1540
+ run.context.html_interactions = run.context.html_interactions.map((hi) =>
1541
+ hi.replace(
1542
+ `button data-useraction-id="${uadata.rndid}"`,
1543
+ `button style="display: none;" data-useraction-id="${uadata.rndid}"`,
1544
+ ),
1545
+ );
1546
+ run.context.html_interactions.push(
1547
+ wrapSegment(
1548
+ uadata.click_replace_text,
1549
+ "You",
1550
+ true,
1551
+ config.layout,
1552
+ req?.user,
1553
+ ),
1552
1554
  );
1553
1555
  await run.update({ context: run.context });
1554
1556
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/agents",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "AI agents for Saltcorn",
5
5
  "main": "index.js",
6
6
  "dependencies": {