@saltcorn/agents 0.8.1 → 0.8.3

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/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
@@ -309,13 +309,13 @@ const run = async (
309
309
 
310
310
  const initial_q = state.run_id ? undefined : state._q;
311
311
  if (state.run_id) {
312
- const run = prevRuns
313
- ? prevRuns.find((r) => r.id == state.run_id)
314
- : await WorkflowRun.findOne({
315
- trigger_id: action.id,
316
- ...(shared ? {} : { started_by: req.user?.id }),
317
- id: state.run_id,
318
- });
312
+ let run = prevRuns ? prevRuns.find((r) => r.id == state.run_id) : null;
313
+ if (!run)
314
+ run = await WorkflowRun.findOne({
315
+ trigger_id: action.id,
316
+ ...(shared ? {} : { started_by: req.user?.id }),
317
+ id: state.run_id,
318
+ });
319
319
  const interactMarkups = [];
320
320
  if (run.context.html_interactions) {
321
321
  interactMarkups.push(...run.context.html_interactions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/agents",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "AI agents for Saltcorn",
5
5
  "main": "index.js",
6
6
  "dependencies": {