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/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +12 -4
- package/lib/manifest.mjs +1 -1
- package/lib/web.mjs +9 -3
- package/package.json +1 -1
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
|
|
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
|
-
|
|
754
|
-
|
|
755
|
-
|
|
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
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: {
|
|
333
|
-
|
|
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
|
}
|