dsh-model-rotator 0.2.2 → 0.2.3
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/client.js +24 -2
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -403,6 +403,18 @@ window.__ModuleLoader__.load({
|
|
|
403
403
|
const SEPARATORS = /[-_./\s]+/g;
|
|
404
404
|
const normSearch = (value) => String(value || "").toLowerCase().replace(SEPARATORS, "");
|
|
405
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Whether a one-character token starts a word.
|
|
408
|
+
*
|
|
409
|
+
* Normalisation strips the very separators a word boundary is made of, so this
|
|
410
|
+
* reads the RAW name: "ds-flash" contributes the words ds and flash, so "f"
|
|
411
|
+
* starts a word there, while the "f" inside "flash" does not.
|
|
412
|
+
*/
|
|
413
|
+
const startsWord = (raw, token) => String(raw)
|
|
414
|
+
.toLowerCase()
|
|
415
|
+
.split(/[-_./\s]+/)
|
|
416
|
+
.some((word) => word.length > 0 && word[0] === token);
|
|
417
|
+
|
|
406
418
|
/** Every character of q appears in s, in order (not necessarily adjacent). */
|
|
407
419
|
const isSubsequence = (s, q) => {
|
|
408
420
|
let at = 0;
|
|
@@ -438,10 +450,20 @@ window.__ModuleLoader__.load({
|
|
|
438
450
|
? []
|
|
439
451
|
: query.trim().split(/\s+/).map(normSearch).filter((t) => t !== "");
|
|
440
452
|
if (tokens.length === 0) return query.trim() === "" ? 1 : 0;
|
|
441
|
-
const
|
|
453
|
+
const raw = String(row.provider) + "/" + String(row.model);
|
|
454
|
+
const hay = normSearch(raw);
|
|
442
455
|
let weakest = 2;
|
|
443
456
|
for (const token of tokens) {
|
|
444
|
-
|
|
457
|
+
// A one-character token is only useful on its own. Measured on the live
|
|
458
|
+
// roster, 25 of 36 characters match more than 200 of 950 names ("o"
|
|
459
|
+
// matches 892), so as one term of a multi-term query it constrains
|
|
460
|
+
// nothing - "a b" still returned 264 rows. Narrow it to a word boundary,
|
|
461
|
+
// which is what a reader typing "ds f" or "q4 3" actually means, and keep
|
|
462
|
+
// the loose form only when the single letter IS the whole query.
|
|
463
|
+
const solo = tokens.length === 1;
|
|
464
|
+
const tier = token.length === 1 && !solo
|
|
465
|
+
? (startsWord(raw, token) ? 2 : 0)
|
|
466
|
+
: tierOf(hay, token);
|
|
445
467
|
if (tier === 0) return 0;
|
|
446
468
|
if (tier < weakest) weakest = tier;
|
|
447
469
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-model-rotator",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Model auto-ranking and transparent failover for DeepSeek Harness: ranks discovered models by measured connectivity and speed, switches to the next candidate inside the same turn when the current one is unusable, and ships a grouped model list with per-channel switches. Never modifies model or provider configuration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|