dsh-connect-madao 0.8.3 → 0.8.4

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/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: 506880
19
+ contextWindow: 324403
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: 1310720
29
+ contextWindow: 838861
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: 1310720
35
+ contextWindow: 838861
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: 1310720
41
+ contextWindow: 838861
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: 2621440
47
+ contextWindow: 1677722
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: 2621440
57
+ contextWindow: 1677722
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: 506880
67
+ contextWindow: 324403
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: 2621440
77
+ contextWindow: 1677722
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: 2621440
87
+ contextWindow: 1677722
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: 2621440
97
+ contextWindow: 1677722
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: 2621440
107
+ contextWindow: 1677722
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: 2621440
117
+ contextWindow: 1677722
118
118
  maxTokens: 32768
119
119
  input: [ text ]
120
120
  reasoningEfforts: false
package/lib/index.js CHANGED
@@ -2015,9 +2015,11 @@ async function chatCompletion(res, client, rawBody, ctxModels) {
2015
2015
  });
2016
2016
  }
2017
2017
  if (info && info.context > 0) {
2018
- const limit = Math.floor(info.context * 1.2);
2018
+ const RESERVED_FOR_OUTPUT = 4096;
2019
+ const realInputLimit = Math.max(1, info.context - RESERVED_FOR_OUTPUT);
2020
+ const limit = Math.floor(realInputLimit * 1.2);
2019
2021
  if (estTokens > limit) {
2020
- const bigger = ctxModels.filter((m) => m.context * 0.9 > estTokens).sort((a, b) => a.context - b.context).slice(0, 4).map((m) => `${m.name}\uFF08${m.context}\uFF09`);
2022
+ const bigger = ctxModels.filter((m) => m.context - RESERVED_FOR_OUTPUT > estTokens).sort((a, b) => a.context - b.context).slice(0, 4).map((m) => `${m.name}\uFF08${m.context - RESERVED_FOR_OUTPUT}\uFF09`);
2021
2023
  chatLog(
2022
2024
  `chat REJECT context ${estTokens} (msgs ${estMessages} + tools ${estTools}/${toolCount}) > ${limit} for ${model}`
2023
2025
  );
@@ -2378,10 +2380,10 @@ function q(s) {
2378
2380
  function displayName(m) {
2379
2381
  return m.ratio ? `${m.name} \xB7 ${m.ratio}` : m.name;
2380
2382
  }
2381
- var CONTEXT_DISPLAY_FACTOR = 2.5;
2383
+ var CONTEXT_DISPLAY_FACTOR = 1.6;
2382
2384
  function displayContextWindow(real) {
2383
2385
  if (!Number.isFinite(real) || real <= 0) return real;
2384
- return Math.round(real * CONTEXT_DISPLAY_FACTOR);
2386
+ return Math.max(real, Math.round(real * CONTEXT_DISPLAY_FACTOR));
2385
2387
  }
2386
2388
  function renderModel(m) {
2387
2389
  const lines = [];
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.3",
5
+ "version": "0.8.4",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "engines": {