utilitas 2000.3.8 → 2000.3.10
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/config.sample.json +7 -0
- package/dist/utilitas.lite.mjs +1 -1
- package/dist/utilitas.lite.mjs.map +1 -1
- package/lib/alan.mjs +17 -9
- package/lib/manifest.mjs +1 -1
- package/lib/web.mjs +2 -2
- package/package.json +1 -1
package/lib/alan.mjs
CHANGED
|
@@ -151,7 +151,7 @@ const MODELS = {
|
|
|
151
151
|
},
|
|
152
152
|
[GPT_51_CODEX]: { ...OPENAI_RULES },
|
|
153
153
|
[GPT_5_IMAGE]: { ...OPENAI_RULES, image: true },
|
|
154
|
-
[JINA_DEEPSEARCH]: {
|
|
154
|
+
[JINA_DEEPSEARCH]: { // @todo: parse more details from results, eg: "reed urls".
|
|
155
155
|
label: '✴️', contextWindow: Infinity, maxInputTokens: Infinity,
|
|
156
156
|
maxOutputTokens: Infinity, imageCostTokens: 0, maxImageSize: Infinity,
|
|
157
157
|
supportedMimeTypes: [MIME_PNG, MIME_JPEG, MIME_TEXT, MIME_WEBP, MIME_PDF],
|
|
@@ -241,7 +241,7 @@ for (const n in MODELS) {
|
|
|
241
241
|
|
|
242
242
|
// Default models for each provider
|
|
243
243
|
const DEFAULT_MODELS = {
|
|
244
|
-
[OPENROUTER]:
|
|
244
|
+
[OPENROUTER]: GEMINI_25_FLASH,
|
|
245
245
|
[SILICONFLOW]: SF_DEEPSEEK_R1,
|
|
246
246
|
[JINA]: JINA_DEEPSEARCH,
|
|
247
247
|
[OLLAMA]: GEMMA_3_27B,
|
|
@@ -371,8 +371,8 @@ const setupAi = ai => {
|
|
|
371
371
|
ais.push({
|
|
372
372
|
id, name: buildAiName(ai.provider, ai.model),
|
|
373
373
|
features: buildAiFeatures(ai.model), initOrder: ais.length,
|
|
374
|
-
priority:
|
|
375
|
-
|
|
374
|
+
...ai, priority: ai.priority || 0,
|
|
375
|
+
prompt: async (text, opts) => await ai.prompt(id, text, opts),
|
|
376
376
|
});
|
|
377
377
|
};
|
|
378
378
|
|
|
@@ -383,6 +383,7 @@ const init = async (options = {}) => {
|
|
|
383
383
|
}
|
|
384
384
|
options.provider = options.provider || OPENROUTER;
|
|
385
385
|
const provider = unifyProvider(options.provider);
|
|
386
|
+
const priority = options.priority;
|
|
386
387
|
let models;
|
|
387
388
|
if (options.model === '*') { // All models
|
|
388
389
|
models = Object.values(MODELS).filter(
|
|
@@ -407,7 +408,9 @@ const init = async (options = {}) => {
|
|
|
407
408
|
baseURL: 'https://deepsearch.jina.ai/v1/', ...options,
|
|
408
409
|
});
|
|
409
410
|
for (let model of models) {
|
|
410
|
-
setupAi({
|
|
411
|
+
setupAi({
|
|
412
|
+
provider, model, client, prompt: promptOpenAI, priority,
|
|
413
|
+
});
|
|
411
414
|
}
|
|
412
415
|
break;
|
|
413
416
|
case OLLAMA:
|
|
@@ -418,7 +421,9 @@ const init = async (options = {}) => {
|
|
|
418
421
|
baseURL, apiKey: 'ollama', ...options,
|
|
419
422
|
});
|
|
420
423
|
for (let model of models) {
|
|
421
|
-
setupAi({
|
|
424
|
+
setupAi({
|
|
425
|
+
provider, model, client, prompt: promptOpenAI, priority,
|
|
426
|
+
});
|
|
422
427
|
ignoreErrFunc(async () => {
|
|
423
428
|
phLog(await (await fetch(`${baseURL}completions`, {
|
|
424
429
|
method: 'POST', body: JSON.stringify({
|
|
@@ -434,7 +439,9 @@ const init = async (options = {}) => {
|
|
|
434
439
|
baseURL: 'https://api.siliconflow.cn/v1', ...options,
|
|
435
440
|
});
|
|
436
441
|
for (let model of models) {
|
|
437
|
-
setupAi({
|
|
442
|
+
setupAi({
|
|
443
|
+
provider, model, client, prompt: promptOpenAI, priority,
|
|
444
|
+
});
|
|
438
445
|
}
|
|
439
446
|
break;
|
|
440
447
|
default:
|
|
@@ -443,7 +450,7 @@ const init = async (options = {}) => {
|
|
|
443
450
|
for (let model of models) {
|
|
444
451
|
setupAi({
|
|
445
452
|
provider: OPENROUTER || provider, model, client,
|
|
446
|
-
prompt: promptOpenAI,
|
|
453
|
+
prompt: promptOpenAI, priority,
|
|
447
454
|
});
|
|
448
455
|
}
|
|
449
456
|
}
|
|
@@ -642,7 +649,8 @@ const packResp = async (resp, options) => {
|
|
|
642
649
|
// "start_index": 0,
|
|
643
650
|
// "title": "在線時鐘- 目前時間- 線上時鐘- 時鐘線上 - 鬧鐘",
|
|
644
651
|
// "url": "https://naozhong.tw/shijian/",
|
|
645
|
-
// "content": "- [鬧鐘](https://naozhong.tw/)\n- [計時器](https://naozhong.tw/jishiqi/)\n- [碼錶](https://naozhong.tw/miaobiao/)\n- [時間](https://naozhong.tw/shijian/)\n\n# 現在時間\n\n加入\n\n- [編輯](javascript:;)\n- [移至頂端](javascript:;)\n- [上移](javascript:;)\n- [下移](javascript:;)\n- [刪除](javascript:;)\n\n# 最常用\n\n| | |\n| --- | --- |\n| [台北](https://naozhong.tw/shijian/%E5%8F%B0%E5%8C%97/) | 10:09:14 |\n| [北京,中國](https://naozhong.tw/shijian/%E5%8C%97%E4%BA%AC-%E4%B8%AD%E5%9C%8B/) | 10:09:14 |\n| [上海,中國](https://naozhong.tw/shijian/%E4%B8%8A%E6%B5%B7-%E4%B8%AD%E5%9C%8B/) | 10:09:14 |\n| [烏魯木齊,中國](https://naozhong.tw/shijian/%E7%83%8F%E9%AD%AF%"
|
|
652
|
+
// "content": "- [鬧鐘](https://naozhong.tw/)\n- [計時器](https://naozhong.tw/jishiqi/)\n- [碼錶](https://naozhong.tw/miaobiao/)\n- [時間](https://naozhong.tw/shijian/)\n\n# 現在時間\n\n加入\n\n- [編輯](javascript:;)\n- [移至頂端](javascript:;)\n- [上移](javascript:;)\n- [下移](javascript:;)\n- [刪除](javascript:;)\n\n# 最常用\n\n| | |\n| --- | --- |\n| [台北](https://naozhong.tw/shijian/%E5%8F%B0%E5%8C%97/) | 10:09:14 |\n| [北京,中國](https://naozhong.tw/shijian/%E5%8C%97%E4%BA%AC-%E4%B8%AD%E5%9C%8B/) | 10:09:14 |\n| [上海,中國](https://naozhong.tw/shijian/%E4%B8%8A%E6%B5%B7-%E4%B8%AD%E5%9C%8B/) | 10:09:14 |\n| [烏魯木齊,中國](https://naozhong.tw/shijian/%E7%83%8F%E9%AD%AF%",
|
|
653
|
+
// "dateTime": "2025-03-13 06:48:01" // jina deepsearch only
|
|
646
654
|
// }
|
|
647
655
|
// },
|
|
648
656
|
// ];
|
package/lib/manifest.mjs
CHANGED
package/lib/web.mjs
CHANGED
|
@@ -332,8 +332,8 @@ const distill = async (url, options = {}) => {
|
|
|
332
332
|
fetch: {
|
|
333
333
|
headers: {
|
|
334
334
|
'Authorization': `Bearer ${key}`,
|
|
335
|
-
|
|
336
|
-
// 'X-Respond-With': 'readerlm-v2',
|
|
335
|
+
'X-Engine': 'cf-browser-rendering',
|
|
336
|
+
// 'X-Respond-With': 'readerlm-v2', // too slow
|
|
337
337
|
'X-Base': 'final',
|
|
338
338
|
}
|
|
339
339
|
}, ...options || {},
|