utilitas 1999.1.28 → 1999.1.30

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,6 +747,14 @@ 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*$`);
751
+ const fixJina = [];
752
+ 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); }
756
+ }
757
+ txt = fixJina;
750
758
  for (let i in txt) {
751
759
  switch (txt[i]) {
752
760
  case THINK_STR: txt[i] = MD_CODE + THINK; break;
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.28",
4
+ "version": "1999.1.30",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",
package/lib/web.mjs CHANGED
@@ -326,18 +326,13 @@ const initDistill = async (options = {}) => {
326
326
  };
327
327
 
328
328
  const distill = async (url, options = {}) => {
329
- if (ensureString(options.provider, { case: 'UP' }) === 'JINA') {
330
- const key = options.apiKey || jinaApiKey;
331
- assert(key, 'Jina API key is required.');
332
- var url = `https://r.jina.ai/${encodeURIComponent(url)}`;
333
- var resp = await get(url, {
329
+ const key = options.apiKey || jinaApiKey;
330
+ if (key) {
331
+ const resp = await get(`https://r.jina.ai/${encodeURIComponent(url)}`, {
334
332
  fetch: { headers: { 'Authorization': `Bearer ${key}` } },
335
333
  ...options || {},
336
334
  });
337
- return {
338
- content: null,
339
- summary: resp?.content
340
- };
335
+ return { content: null, summary: resp?.content };
341
336
  }
342
337
  let content;
343
338
  if (isYoutubeUrl(url)) {
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.28",
4
+ "version": "1999.1.30",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",