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/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +8 -0
- package/lib/manifest.mjs +1 -1
- package/lib/web.mjs +4 -9
- package/package.json +1 -1
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
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
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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)) {
|