utilitas 1998.2.13 → 1998.2.15

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/lib/alan.mjs CHANGED
@@ -968,7 +968,7 @@ const packResult = resp => {
968
968
  resp.text, { noCode: true, noLink: true }
969
969
  ).replace(/\[\^\d\^\]/ig, ''),
970
970
  };
971
- log(`Response: ${JSON.stringify(result.text)}`);
971
+ log(`Response (${result.model}): ${JSON.stringify(result.text)}`);
972
972
  // log(result);
973
973
  return result;
974
974
  };
@@ -1160,14 +1160,16 @@ const analyzeSessions = async (sessionIds, options) => {
1160
1160
  }
1161
1161
  const pmt = options?.prompt || (
1162
1162
  'Help me organize the dialogues in the following JSON into a title '
1163
- + 'dictionary and return it in JSON format. Try to summarize the '
1164
- + 'content briefly without copying the original text. The returned JSON'
1165
- + ' uses the key from the original JSON session data as the key and the'
1166
- + ' title as the value. The return format is as follows '
1167
- + '`{"id": "title"}`. The following is a conversation data that needs '
1168
- + 'to be organized: \n\n');
1163
+ + 'dictionary and return it in JSON format. The input data may contain '
1164
+ + 'one or more sets of data. Try to summarize the content briefly '
1165
+ + 'without copying the original text. The returned JSON uses the key '
1166
+ + 'from the original JSON session data as the key, and the title should'
1167
+ + ' be a brief summary of your review of that chat record. Title '
1168
+ + 'should be a brief text string. The return format is as follows '
1169
+ + '`{"id_1": "title_1", "id_2": "title_2"}`. The following is a '
1170
+ + 'conversation data that needs to be organized: \n\n');
1169
1171
  const getInput = () =>
1170
- `${pmt}\`\`\`JSON\n${JSON.stringify(sses, null, 2)}\n\`\`\``;
1172
+ `${pmt}\`\`\`JSON\n${JSON.stringify(sses)}\n\`\`\``;
1171
1173
  await trimPrompt(getInput, () => {
1172
1174
  if (!Object.values(sses).sort((x, y) =>
1173
1175
  y.messages.length - x.messages.length)[0].messages.shift()) {
@@ -1180,7 +1182,7 @@ const analyzeSessions = async (sessionIds, options) => {
1180
1182
  jsonMode: true, fast: true, simple: true, ...options || {}
1181
1183
  })) : {};
1182
1184
  assert(aiResp, 'Unable to analyze sessions.');
1183
- ids.map(x => resp[x] = aiResp[x] || null)
1185
+ ids.map(x => resp[x] = aiResp[x] || null);
1184
1186
  return Array.isArray(sessionIds) ? resp : resp[sessionIds[0]];
1185
1187
  };
1186
1188
 
package/lib/manifest.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const manifest = {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1998.2.13",
4
+ "version": "1998.2.15",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for JavaScript.",
4
- "version": "1998.2.13",
4
+ "version": "1998.2.15",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",