dsh-qwenwork-connect 0.1.9 → 0.2.0
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/lib/loopback.js +17 -2
- package/lib/models.js +10 -0
- package/package.json +1 -1
package/lib/loopback.js
CHANGED
|
@@ -9,6 +9,20 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/** 本地插件面可被寻址的环回主机名。 */
|
|
12
|
+
/**
|
|
13
|
+
* 额外信任的 Host(逗号分隔)。DSH 常通过 dsh.lan 之类的反代域名访问,
|
|
14
|
+
* 那时 Host 不是环回但请求仍来自本机代理;部署时用这个环境变量补齐。
|
|
15
|
+
*/
|
|
16
|
+
function extraTrustedHosts() {
|
|
17
|
+
const raw = process.env.QWENWORK_TRUSTED_HOSTS ?? '';
|
|
18
|
+
return new Set(
|
|
19
|
+
raw
|
|
20
|
+
.split(',')
|
|
21
|
+
.map((item) => item.trim().toLowerCase())
|
|
22
|
+
.filter((item) => item.length > 0),
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
12
26
|
const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '[::1]']);
|
|
13
27
|
|
|
14
28
|
/**
|
|
@@ -46,7 +60,8 @@ function hostnameOfHost(host) {
|
|
|
46
60
|
*/
|
|
47
61
|
export function hostIsLoopback(host) {
|
|
48
62
|
if (host === undefined || host.trim() === '') return false;
|
|
49
|
-
|
|
63
|
+
const hostname = hostnameOfHost(host);
|
|
64
|
+
return LOOPBACK_HOSTS.has(hostname) || extraTrustedHosts().has(hostname);
|
|
50
65
|
}
|
|
51
66
|
|
|
52
67
|
/**
|
|
@@ -60,7 +75,7 @@ export function originIsLoopback(origin) {
|
|
|
60
75
|
if (origin === undefined || origin.trim() === '') return true;
|
|
61
76
|
try {
|
|
62
77
|
const { hostname } = new URL(origin);
|
|
63
|
-
return LOOPBACK_HOSTS.has(hostname) || hostname === '::1';
|
|
78
|
+
return LOOPBACK_HOSTS.has(hostname) || hostname === '::1' || extraTrustedHosts().has(hostname);
|
|
64
79
|
} catch {
|
|
65
80
|
return false;
|
|
66
81
|
}
|
package/lib/models.js
CHANGED
|
@@ -100,6 +100,16 @@ export const FALLBACK_QWENWORK_MODELS = [
|
|
|
100
100
|
maxTokens: MAX_OUTPUT_TOKENS,
|
|
101
101
|
isRecommended: true,
|
|
102
102
|
},
|
|
103
|
+
{
|
|
104
|
+
id: 'frontier-1',
|
|
105
|
+
shortName: 'Qwen4-Max 预览',
|
|
106
|
+
billingRate: 0.4,
|
|
107
|
+
supportsImages: true,
|
|
108
|
+
contextWindow: MAX_INPUT_TOKENS,
|
|
109
|
+
availableContextWindows: [MAX_INPUT_TOKENS],
|
|
110
|
+
maxTokens: MAX_OUTPUT_TOKENS,
|
|
111
|
+
isNew: true,
|
|
112
|
+
},
|
|
103
113
|
{
|
|
104
114
|
id: 'qwen3.8-max-preview',
|
|
105
115
|
shortName: 'Qwen3.8-Max',
|