utilitas 1999.1.32 → 1999.1.33

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
@@ -747,12 +747,20 @@ const packResp = async (resp, options) => {
747
747
  ).join('\n');
748
748
  }
749
749
  txt = txt.split('\n');
750
- const reJina = new RegExp(`^\s*${THINK_STR}(.*)${THINK_END}\s*$`);
750
+ const [reJinaStr, reJinaEnd]
751
+ = [`^\s*(${THINK_STR})`, `(${THINK_END})\s*$`].map(x => new RegExp(x));
751
752
  const fixJina = [];
752
753
  for (let l of txt) {
753
- if (reJina.test(l)) {
754
- fixJina.push(THINK_STR, l.replace(reJina, '$1'), THINK_END);
755
- } else { fixJina.push(l); }
754
+ let catched = false;
755
+ if (reJinaStr.test(l)) {
756
+ fixJina.push(THINK_STR);
757
+ l = l.replace(reJinaStr, '');
758
+ }
759
+ if (reJinaEnd.test(l)) {
760
+ l = l.replace(reJinaEnd, '');
761
+ catched = true;
762
+ }
763
+ fixJina.push(l, ...catched ? [THINK_END, ''] : []);
756
764
  }
757
765
  txt = fixJina;
758
766
  for (let i in txt) {
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": "1999.1.32",
4
+ "version": "1999.1.33",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/lib/web.mjs CHANGED
@@ -222,7 +222,7 @@ const search = async (query, options = {}) => {
222
222
  headers: {
223
223
  'Authorization': `Bearer ${key}`,
224
224
  'Accept': options?.aiFriendly ? MIME_TEXT : MIME_JSON,
225
- 'X-Respond-With': 'no-content',
225
+ ...options?.fetch ? {} : { 'X-Respond-With': 'no-content' },
226
226
  ...options?.aiFriendly ? {} : { 'X-With-Favicons': true },
227
227
  }
228
228
  }, ...options || {},
@@ -329,8 +329,14 @@ const distill = async (url, options = {}) => {
329
329
  const key = options.apiKey || jinaApiKey;
330
330
  if (key) {
331
331
  const resp = await get(`https://r.jina.ai/${encodeURIComponent(url)}`, {
332
- fetch: { headers: { 'Authorization': `Bearer ${key}` } },
333
- ...options || {},
332
+ fetch: {
333
+ headers: {
334
+ 'Authorization': `Bearer ${key}`,
335
+ // 'X-Engine': 'cf-browser-rendering',
336
+ // 'X-Respond-With': 'readerlm-v2',
337
+ 'X-Base': 'final',
338
+ }
339
+ }, ...options || {},
334
340
  });
335
341
  return { content: null, summary: resp?.content };
336
342
  }
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": "1999.1.32",
4
+ "version": "1999.1.33",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",