@saltcorn/agents 0.5.2 → 0.5.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/agent-view.js CHANGED
@@ -194,8 +194,8 @@ const realTimeCollabScript = (viewname) => {
194
194
  else {
195
195
  //legacy
196
196
  ensure_script_loaded("/static_assets/${
197
- db.connectObj.version_tag
198
- }/socket.io.min.js");
197
+ db.connectObj.version_tag
198
+ }/socket.io.min.js");
199
199
  callback();
200
200
  }`)
201
201
  );
@@ -321,18 +321,21 @@ const run = async (
321
321
  }
322
322
  }
323
323
  }
324
-
325
- interactMarkups.push(
326
- div(
327
- { class: "interaction-segment" },
328
- span({ class: "badge bg-secondary" }, action.name),
329
- typeof interact.content === "string"
330
- ? md.render(interact.content)
331
- : typeof interact.content?.content === "string"
332
- ? md.render(interact.content.content)
333
- : interact.content
334
- )
335
- );
324
+ if (
325
+ typeof interact.content === "string" ||
326
+ typeof interact.content?.content === "string"
327
+ )
328
+ interactMarkups.push(
329
+ div(
330
+ { class: "interaction-segment" },
331
+ span({ class: "badge bg-secondary" }, action.name),
332
+ typeof interact.content === "string"
333
+ ? md.render(interact.content)
334
+ : typeof interact.content?.content === "string"
335
+ ? md.render(interact.content.content)
336
+ : interact.content
337
+ )
338
+ );
336
339
  break;
337
340
  case "tool":
338
341
  if (interact.content !== "Action run") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/agents",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "AI agents for Saltcorn",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -129,6 +129,12 @@ class RunJsCodeSkill {
129
129
  },
130
130
  ],
131
131
  }),
132
+ {
133
+ name: "display_result",
134
+ label: "Display result",
135
+ type: "Bool",
136
+ sublabel: "Show the value returned in JSON format",
137
+ },
132
138
  {
133
139
  name: "add_sys_prompt",
134
140
  label: "Additional prompt",
@@ -154,12 +160,14 @@ class RunJsCodeSkill {
154
160
  /*renderToolCall({ phrase }, { req }) {
155
161
  return div({ class: "border border-primary p-2 m-2" }, phrase);
156
162
  },*/
157
- renderToolResponse: async (response, { req }) => {
158
- return div(
159
- { class: "border border-success p-2 m-2" },
160
- typeof response === "string" ? response : JSON.stringify(response)
161
- );
162
- },
163
+ renderToolResponse: this.display_result
164
+ ? async (response, { req }) => {
165
+ return div(
166
+ { class: "border border-success p-2 m-2" },
167
+ typeof response === "string" ? response : JSON.stringify(response)
168
+ );
169
+ }
170
+ : undefined,
163
171
  function: {
164
172
  name: this.tool_name,
165
173
  description: this.tool_description,