dsh-connect-madao 0.8.4 → 0.9.1

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/FAQ.md CHANGED
@@ -296,7 +296,22 @@ DSH 会自动回到原来的模型(DeepSeek 官方)。插件不改动任何
296
296
 
297
297
  **为什么换小窗口模型有用**:DSH 的压缩策略按 `contextWindow - maxTokens - headroom` 计算,窗口小就更早触发压缩,历史不会无限累积到 350 条。
298
298
 
299
- **体积都花在哪**:主要是图片的 base64(一张 2 MB 图 ≈ 2.7 MB 请求体)。会话里攒十来张就接近 10 MB 了。
299
+ **体积都花在哪**:主要是图片的 base64(一张 2 MB 图 ≈ 2.7 MB 请求体)。会话里攒十来张就接近 10 MB 了。
300
+
301
+ ### 为什么 DSH 不自动压缩
302
+
303
+ 因为**两个限制的计量单位不同**:
304
+
305
+ ```
306
+ DSH 看 tokens → 1M 窗口的模型,压缩阈值 838K
307
+ 网关看 字节 → 10 MB 就拒绝
308
+ ```
309
+
310
+ 实测这类会话的 **47.7 字节/token**(正常纯文本是 3–4)。图片的 base64 让字节增长比 token 快十几倍,DSH 按 token 算永远觉得"还早",直到请求被拒。
311
+
312
+ **这不是插件能修的** —— 压缩逻辑在 DSH 内部。插件的守卫只能在 9.5 MB 时提前拦住并说明原因。
313
+
314
+ **实用建议**:长篇会话里别反复贴大图。图片用完就开新会话,把结论用文字带过去。
300
315
 
301
316
  ---
302
317
 
@@ -309,3 +324,4 @@ DSH 会自动回到原来的模型(DeepSeek 官方)。插件不改动任何
309
324
  3. DSH 版本 + 插件版本
310
325
 
311
326
  有这三样基本能定位。光说"不工作了"没法查。
327
+
package/cordis.patch.yml CHANGED
@@ -16,7 +16,7 @@
16
16
  models:
17
17
  - id: 'GLM-5.2'
18
18
  name: 'GLM-5.2 · 0.7x'
19
- contextWindow: 324403
19
+ contextWindow: 202752
20
20
  maxTokens: 32768
21
21
  input: [ text ]
22
22
  reasoningEfforts:
@@ -26,25 +26,25 @@
26
26
  max: 'max'
27
27
  - id: 'openpangu-2.0-flash'
28
28
  name: 'OpenPangu-2.0-Flash · 0.32x'
29
- contextWindow: 838861
29
+ contextWindow: 524288
30
30
  maxTokens: 32768
31
31
  input: [ text ]
32
32
  reasoningEfforts: false
33
33
  - id: 'openpangu-2.0-pro'
34
34
  name: 'OpenPangu-2.0-Pro · 0.7x'
35
- contextWindow: 838861
35
+ contextWindow: 524288
36
36
  maxTokens: 32768
37
37
  input: [ text ]
38
38
  reasoningEfforts: false
39
39
  - id: 'openpangu-2.1-pro'
40
40
  name: 'OpenPangu-2.1-Pro · 0.07x'
41
- contextWindow: 838861
41
+ contextWindow: 524288
42
42
  maxTokens: 32768
43
43
  input: [ text ]
44
44
  reasoningEfforts: false
45
45
  - id: 'glm-5.3'
46
46
  name: 'GLM-5.3 · 0.79x'
47
- contextWindow: 1677722
47
+ contextWindow: 1048576
48
48
  maxTokens: 32768
49
49
  input: [ text ]
50
50
  reasoningEfforts:
@@ -54,7 +54,7 @@
54
54
  max: 'max'
55
55
  - id: 'glm-5.3-flash'
56
56
  name: 'GLM-5.3-Flash · 0.08x'
57
- contextWindow: 1677722
57
+ contextWindow: 1048576
58
58
  maxTokens: 32768
59
59
  input: [ text, image ]
60
60
  reasoningEfforts:
@@ -64,7 +64,7 @@
64
64
  max: 'max'
65
65
  - id: 'glm-5.2-sft-harmony'
66
66
  name: 'GLM-5.2-ArkTS-SPARK · 0.7x'
67
- contextWindow: 324403
67
+ contextWindow: 202752
68
68
  maxTokens: 32768
69
69
  input: [ text ]
70
70
  reasoningEfforts:
@@ -74,7 +74,7 @@
74
74
  max: 'max'
75
75
  - id: 'deepseek-v4.1-flash'
76
76
  name: 'DeepSeek-V4.1-Flash · 0.18x'
77
- contextWindow: 1677722
77
+ contextWindow: 1048576
78
78
  maxTokens: 32768
79
79
  input: [ text, image ]
80
80
  reasoningEfforts:
@@ -84,7 +84,7 @@
84
84
  max: 'max'
85
85
  - id: 'deepseek-v4.1-flash-1017'
86
86
  name: 'DeepSeek-V4.1-Flash-1017 · 0.18x'
87
- contextWindow: 1677722
87
+ contextWindow: 1048576
88
88
  maxTokens: 32768
89
89
  input: [ text, image ]
90
90
  reasoningEfforts:
@@ -94,7 +94,7 @@
94
94
  max: 'max'
95
95
  - id: 'kimi-k3'
96
96
  name: 'Kimi-K3 · 2.38x'
97
- contextWindow: 1677722
97
+ contextWindow: 1048576
98
98
  maxTokens: 32768
99
99
  input: [ text, image ]
100
100
  reasoningEfforts:
@@ -104,7 +104,7 @@
104
104
  max: 'max'
105
105
  - id: 'kimi-k3.1-pro'
106
106
  name: 'Kimi-K3.1-Pro · 1.63x'
107
- contextWindow: 1677722
107
+ contextWindow: 1048576
108
108
  maxTokens: 32768
109
109
  input: [ text, image ]
110
110
  reasoningEfforts:
@@ -114,7 +114,7 @@
114
114
  max: 'max'
115
115
  - id: 'speed'
116
116
  name: '智速模式 · 0.18x'
117
- contextWindow: 1677722
117
+ contextWindow: 1048576
118
118
  maxTokens: 32768
119
119
  input: [ text ]
120
120
  reasoningEfforts: false
package/lib/index.js CHANGED
@@ -1999,7 +1999,7 @@ async function chatCompletion(res, client, rawBody, ctxModels) {
1999
1999
  const msgCount = Array.isArray(rawBody.messages) ? rawBody.messages.length : 0;
2000
2000
  chatLog(`chat REJECT body ${mb}MB (msgs ${msgCount} + tools ${toolCountForMsg}) > 9.5MB for ${model}`);
2001
2001
  const smaller = ctxModels.filter((m) => m.context <= 262144).slice(0, 4).map((m) => `${m.name}\uFF08${m.context}\uFF09`);
2002
- return json(res, 400, {
2002
+ return json(res, 413, {
2003
2003
  error: {
2004
2004
  message: `\u5F53\u524D\u4F1A\u8BDD\u7684\u8BF7\u6C42\u4F53 ${mb} MB\uFF0C\u8D85\u8FC7\u7801\u9053\u7F51\u5173\u7EA6 10 MB \u7684\u5355\u6B21\u4E0A\u9650\u3002
2005
2005
  \u8FD9\u4E0D\u662F\u914D\u7F6E\u95EE\u9898\uFF0C\u7F51\u5173\u4F1A\u8FD4\u56DE\u300C\u53C2\u6570\u65E0\u6548\u300D\u800C\u4E0D\u8BF4\u662F\u4F53\u79EF\u8D85\u4E86\u3002
@@ -2380,7 +2380,7 @@ function q(s) {
2380
2380
  function displayName(m) {
2381
2381
  return m.ratio ? `${m.name} \xB7 ${m.ratio}` : m.name;
2382
2382
  }
2383
- var CONTEXT_DISPLAY_FACTOR = 1.6;
2383
+ var CONTEXT_DISPLAY_FACTOR = 1;
2384
2384
  function displayContextWindow(real) {
2385
2385
  if (!Number.isFinite(real) || real <= 0) return real;
2386
2386
  return Math.max(real, Math.round(real * CONTEXT_DISPLAY_FACTOR));
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-connect-madao",
3
3
  "displayName": "DSH Connect 码道",
4
4
  "description": "把华为云码道(CodeArts Agent)的模型接入 DeepSeek Harness:自签 SDK-HMAC-SHA256、P-256 密钥协商与 SM4-GCM 载荷加密,对外提供 OpenAI 兼容接口,并带设置面板与状态胶囊。",
5
- "version": "0.8.4",
5
+ "version": "0.9.1",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "engines": {