mslxdff 0.1.42 → 0.1.43

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/auto.js +8 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mslxdff",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "description": "测试项目,请勿使用。",
5
5
  "type": "module",
6
6
  "bin": {
package/src/auto.js CHANGED
@@ -1,14 +1,17 @@
1
1
  import { loadModelErrors, saveModelErrors, loadModelLatencies, saveModelLatencies } from "./state.js";
2
2
 
3
+ // auto 的默认首选模型:一处定义,全局生效(可用 MSLXDFF_PREFERRED_MODEL 覆盖)
4
+ export const PREFERRED_MODEL = (process.env.MSLXDFF_PREFERRED_MODEL || "big-pickle").trim();
5
+
3
6
  export const DEFAULT_AUTO_MODELS = [
7
+ PREFERRED_MODEL,
4
8
  "deepseek-v4-flash-free",
5
9
  "mimo-v2.5-free",
6
10
  "ling-3.0-flash-free",
7
11
  "nemotron-3-ultra-free",
8
12
  "north-mini-code-free",
9
13
  "laguna-s-2.1-free",
10
- "big-pickle",
11
- ];
14
+ ].filter((id, i, arr) => id && arr.indexOf(id) === i);
12
15
 
13
16
  export function isAutoModel(model) {
14
17
  return !model || model === "auto";
@@ -78,16 +81,16 @@ export function rankModels(ids, errors = {}, { now = Date.now(), cooldownMs = 0,
78
81
  id,
79
82
  e: normEntry(errors[id]),
80
83
  err: normEntry(errors[id])?.at ?? 0,
81
- isDeepseek: /deepseek/i.test(id),
84
+ isPreferred: id === PREFERRED_MODEL,
82
85
  cooling: inCooldown(id, errors, now, cooldownMs, slowCooldownMs),
83
86
  latency: normLatency(latencies[id]) ?? Number.MAX_SAFE_INTEGER,
84
87
  }))
85
88
  .sort(
86
89
  (a, b) =>
87
90
  (a.cooling ? 1 : 0) - (b.cooling ? 1 : 0) ||
91
+ (b.isPreferred ? 1 : 0) - (a.isPreferred ? 1 : 0) ||
88
92
  a.latency - b.latency ||
89
- a.err - b.err ||
90
- (b.isDeepseek ? 1 : 0) - (a.isDeepseek ? 1 : 0)
93
+ a.err - b.err
91
94
  )
92
95
  .map((x) => x.id);
93
96
  }