@eddyskywalker/dsh-chatgpt-subscription 0.6.5 → 0.6.8
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/client.js +99 -0
- package/lib/client.js.map +1 -1
- package/lib/index.js +83 -10
- package/lib/types/client/kimi-code/KimiCodeSection.d.ts.map +1 -1
- package/lib/types/client/kimi-code/locales.d.ts +23 -2
- package/lib/types/client/kimi-code/locales.d.ts.map +1 -1
- package/lib/types/host/kimi-code/mapper.d.ts +40 -3
- package/lib/types/host/kimi-code/mapper.d.ts.map +1 -1
- package/lib/types/host/kimi-code/routes.d.ts.map +1 -1
- package/lib/types/shared/kimi-code-contracts.d.ts +8 -0
- package/lib/types/shared/kimi-code-contracts.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -3255,6 +3255,13 @@ window.__ModuleLoader__.load({
|
|
|
3255
3255
|
cacheOutput: "输出 tokens",
|
|
3256
3256
|
cacheRequests: "请求数",
|
|
3257
3257
|
cacheHint: "同一会话内:系统提示与工具列表一旦变化会使缓存整体失效,因此保持工具集合稳定、把新增内容追加在末尾,命中率最高。",
|
|
3258
|
+
cacheDrift: "最近前缀状态",
|
|
3259
|
+
cacheDriftFirst: "首个请求(缓存为空)",
|
|
3260
|
+
cacheDriftStable: "稳定(前缀未变)",
|
|
3261
|
+
cacheDriftSystemPrompt: "系统提示已变化(缓存失效)",
|
|
3262
|
+
cacheDriftTools: "工具列表已变化(缓存失效)",
|
|
3263
|
+
cacheDriftCacheKey: "缓存键已变化(会话切换)",
|
|
3264
|
+
cacheDriftColdKey: "未发送缓存键(无法命中)",
|
|
3258
3265
|
preserveThinking: "保留思考 (Preserved Thinking)",
|
|
3259
3266
|
preserveOn: "已开启(官方默认):跨轮保留 reasoning_content,多轮工具调用更连贯,但思考 token 也计入输出。",
|
|
3260
3267
|
preserveOff: "已关闭:不要求服务回传推理内容。可设置 DSH_KIMI_CODE_PRESERVE_THINKING=0 关闭。",
|
|
@@ -3368,6 +3375,13 @@ window.__ModuleLoader__.load({
|
|
|
3368
3375
|
cacheOutput: "Output tokens",
|
|
3369
3376
|
cacheRequests: "Requests",
|
|
3370
3377
|
cacheHint: "Within one session: any change to the system prompt or the tool list invalidates the whole prefix cache, so keep the tool set stable and append new material at the tail for the best hit rate.",
|
|
3378
|
+
cacheDrift: "Last prefix state",
|
|
3379
|
+
cacheDriftFirst: "First request (cache cold)",
|
|
3380
|
+
cacheDriftStable: "Stable (prefix unchanged)",
|
|
3381
|
+
cacheDriftSystemPrompt: "System prompt changed (cache invalidated)",
|
|
3382
|
+
cacheDriftTools: "Tool list changed (cache invalidated)",
|
|
3383
|
+
cacheDriftCacheKey: "Cache key changed (session switch)",
|
|
3384
|
+
cacheDriftColdKey: "No cache key sent (cannot hit)",
|
|
3371
3385
|
preserveThinking: "Preserved Thinking",
|
|
3372
3386
|
preserveOn: "On (the official default): reasoning_content is retained across turns, which keeps multi-step tool use coherent — its tokens are billed as output.",
|
|
3373
3387
|
preserveOff: "Off: the service is not asked to return reasoning. Set DSH_KIMI_CODE_PRESERVE_THINKING=0 to disable.",
|
|
@@ -3517,6 +3531,18 @@ window.__ModuleLoader__.load({
|
|
|
3517
3531
|
max: zh$2.effortMax,
|
|
3518
3532
|
none: zh$2.effortNone
|
|
3519
3533
|
};
|
|
3534
|
+
/** Human label for the last request's prefix-drift cause. */
|
|
3535
|
+
function driftLabel(cause, t) {
|
|
3536
|
+
switch (cause) {
|
|
3537
|
+
case "first-request": return t.cacheDriftFirst;
|
|
3538
|
+
case "stable": return t.cacheDriftStable;
|
|
3539
|
+
case "system-prompt": return t.cacheDriftSystemPrompt;
|
|
3540
|
+
case "tools": return t.cacheDriftTools;
|
|
3541
|
+
case "cache-key": return t.cacheDriftCacheKey;
|
|
3542
|
+
case "cold-key": return t.cacheDriftColdKey;
|
|
3543
|
+
default: return String(cause);
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3520
3546
|
function KimiCodeSection({ onModelChange, loadModelDirectory }) {
|
|
3521
3547
|
const [status, setStatus] = (0, react.useState)(null);
|
|
3522
3548
|
const [loading, setLoading] = (0, react.useState)(true);
|
|
@@ -3974,6 +4000,79 @@ window.__ModuleLoader__.load({
|
|
|
3974
4000
|
})
|
|
3975
4001
|
]
|
|
3976
4002
|
}),
|
|
4003
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
4004
|
+
className: "dsha-group",
|
|
4005
|
+
children: [
|
|
4006
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4007
|
+
className: "dsha-grouphead",
|
|
4008
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", { children: t.cacheSection })
|
|
4009
|
+
}),
|
|
4010
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4011
|
+
className: "dsha-muted",
|
|
4012
|
+
children: t.cacheDesc
|
|
4013
|
+
}),
|
|
4014
|
+
status?.cache == null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4015
|
+
className: "dsha-empty",
|
|
4016
|
+
children: t.cacheEmpty
|
|
4017
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4018
|
+
className: "dsha-quota-card",
|
|
4019
|
+
children: [
|
|
4020
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4021
|
+
className: "dsha-meter-wrap",
|
|
4022
|
+
children: [
|
|
4023
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4024
|
+
className: "dsha-meter-label",
|
|
4025
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t.cacheHitRatio }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: status.cache.hitRatio === null ? "—" : `${(status.cache.hitRatio * 100).toFixed(1)}%` })]
|
|
4026
|
+
}),
|
|
4027
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
4028
|
+
className: `dsha-meter ${(status.cache.hitRatio ?? 0) >= .9 ? "dsha-meter-green" : "dsha-meter-cyan"}`,
|
|
4029
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { style: { width: `${Math.round((status.cache.hitRatio ?? 0) * 100)}%` } })
|
|
4030
|
+
}),
|
|
4031
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4032
|
+
className: "dsha-meter-meta",
|
|
4033
|
+
children: [
|
|
4034
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
4035
|
+
t.cacheCached,
|
|
4036
|
+
": ",
|
|
4037
|
+
status.cache.cachedTokens.toLocaleString()
|
|
4038
|
+
] }),
|
|
4039
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
4040
|
+
t.cacheFresh,
|
|
4041
|
+
": ",
|
|
4042
|
+
status.cache.freshTokens.toLocaleString()
|
|
4043
|
+
] }),
|
|
4044
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
4045
|
+
t.cacheOutput,
|
|
4046
|
+
": ",
|
|
4047
|
+
status.cache.outputTokens.toLocaleString()
|
|
4048
|
+
] }),
|
|
4049
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
4050
|
+
t.cacheRequests,
|
|
4051
|
+
": ",
|
|
4052
|
+
status.cache.requests
|
|
4053
|
+
] })
|
|
4054
|
+
]
|
|
4055
|
+
})
|
|
4056
|
+
]
|
|
4057
|
+
}),
|
|
4058
|
+
status.cache.lastDrift !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
4059
|
+
className: "dsha-row",
|
|
4060
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4061
|
+
className: "dsha-label",
|
|
4062
|
+
children: t.cacheDrift
|
|
4063
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
4064
|
+
className: "dsha-value",
|
|
4065
|
+
children: driftLabel(status.cache.lastDrift, t)
|
|
4066
|
+
})]
|
|
4067
|
+
}),
|
|
4068
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
4069
|
+
className: "dsha-muted",
|
|
4070
|
+
children: t.cacheHint
|
|
4071
|
+
})
|
|
4072
|
+
]
|
|
4073
|
+
})
|
|
4074
|
+
]
|
|
4075
|
+
}),
|
|
3977
4076
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3978
4077
|
className: "dsha-group",
|
|
3979
4078
|
children: [
|