dsh-connect-modelscope-token-plan 0.1.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.
@@ -0,0 +1,53 @@
1
+ # dsh-connect-modelscope-token-plan — the bundle's own patch layer.
2
+ #
3
+ # 在 Plugins 页的插件卡里展示魔搭 API-Inference 免费额度的**本地用量面板**,
4
+ # 并可选把魔搭注册成 OpenAI 兼容 LLM provider。以下全是普通配置:在这里改
5
+ # (或在 profile 的 cordis.patch.yml 里覆盖同 id 字段)后重装/重载生效。
6
+ #
7
+ # 魔搭访问令牌(个人中心「访问令牌」,形如 ms-…)不在这里配置:插件默认读
8
+ # DSH 凭据服务里的 MODELSCOPE_API_KEY 引用(本机已存在),env
9
+ # MODELSCOPE_API_KEY 是回退。见 docs/SPIKE.md 与 README.md。
10
+ - insert:
11
+ - id: dsh-connect-modelscope-token-plan
12
+ name: dsh-connect-modelscope-token-plan
13
+ config:
14
+ # OpenAI 兼容推理源站(模型目录 + 探测/计数)。平台搬端点时才需要动。
15
+ apiBase: https://api-inference.modelscope.cn/v1
16
+ # 站点源站,只用于面板里的外链(访问令牌页 / 文档页)。
17
+ siteBase: https://modelscope.cn
18
+ # ------------------------------------------------------------------
19
+ # 面板头条是**官方魔粒余额**(balance 路由,真实值),所以这里**没有**
20
+ # 额度常数:官方改按「魔粒」计费后,次数口径的「每日 N 次 / 推算剩余」
21
+ # 是社区快照而非官方数据,与魔粒余额并排展示会误导(README「三条事实」
22
+ # 第 2 条)。早期版本里的 dailyQuotaTotal / dailyQuotaPerModel 已随之
23
+ # 删除——留着它们只会让人以为面板能算「还剩几次」,而它算不出。
24
+ # 本地计数的独家价值在分布 / 趋势 / 429 事件流,不在「离上限多远」。
25
+ # ------------------------------------------------------------------
26
+ # 本地趋势保留天数(插件私有状态文件里的天桶数量,与上游无关)。
27
+ trendDays: 14
28
+ # Host 侧对 /v1/models 的缓存秒数;面板脚注直接引用此值。上界 600。
29
+ cacheSeconds: 60
30
+ # 面板轮询间隔,由 Host 下发、面板跟随。上界 3600(1 小时)。
31
+ # ⚠️ 别把这两个值调大到「几小时」:pollSeconds × 1000 超过 2^31-1 ms 时
32
+ # Node 会把 setInterval 的延时**钳到 1ms**(TimeoutOverflowWarning),插件
33
+ # 于是变成每毫秒打一次魔搭目录。上界是硬夹的,越界值会被拉回上限。
34
+ pollSeconds: 30
35
+ # 单次魔搭请求超时(毫秒)。上界 600000(10 分钟)——同样是硬夹。
36
+ inferenceTimeoutMs: 30000
37
+ # ------------------------------------------------------------------
38
+ # 把魔搭注册成 DSH 的 LLM provider(id `modelscope-token-plan`,直连
39
+ # apiBase,OpenAI 兼容)。默认关(opt-in,与姊妹插件一致);面板「模型」
40
+ # tab 的「接入为 DSH 模型」开关可随时翻转,面板保存值优先于这里的默认。
41
+ # 注册后魔搭模型进入 DSH 模型选择器。
42
+ #
43
+ # 计数范围:注册开关打开后,DSH 的魔搭对话经本插件的适配器出去,每一次
44
+ # 调用与每一条 429/错误事件都由 src/host/usage-observer.ts 在流的出口
45
+ # 记进同一个 usage-store——所以面板「额度」tab 的本地计数覆盖**全部 DSH
46
+ # 魔搭调用**,不只反映面板自身的探针。直连魔搭的其它客户端仍不计入
47
+ # (本插件看不见它们),消耗总量以官方魔粒余额为准。
48
+ #
49
+ # 已知偏差方向是**少记**:peer 的重试在同一条流内部重发,观察器只看到
50
+ # 一条流。详见 src/host/usage-observer.ts 文件头与 README「诚实声明」。
51
+ registerProvider: false
52
+ # 追加可信 Host 名(默认 localhost / 127.0.0.1 / ::1,只增不替)。
53
+ # allowedHosts: []
package/icon.svg ADDED
@@ -0,0 +1,30 @@
1
+ <svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <!-- ModelScope 官方像素 "M" Logo 复刻:蓝紫圆角方块 + 白像素 M(含中央菱形与两侧 L 角) -->
3
+ <defs>
4
+ <linearGradient id="ms-bg" x1="6" y1="4" x2="58" y2="60" gradientUnits="userSpaceOnUse">
5
+ <stop stop-color="#5560F5" />
6
+ <stop offset="1" stop-color="#3739CC" />
7
+ </linearGradient>
8
+ </defs>
9
+
10
+ <rect x="1.5" y="1.5" width="61" height="61" rx="15" fill="url(#ms-bg)" />
11
+
12
+ <!-- 白色像素块组合(坐标与官方 150x167 参考图按 0.5 缩放对齐) -->
13
+ <g fill="#FFFFFF">
14
+ <!-- 顶部两竖臂 -->
15
+ <rect x="13" y="23" width="4" height="5" rx="0.3" />
16
+ <rect x="47" y="23" width="4" height="5" rx="0.3" />
17
+ <!-- 底部两竖臂 -->
18
+ <rect x="13" y="44" width="4" height="5" rx="0.3" />
19
+ <rect x="47" y="44" width="4" height="5" rx="0.3" />
20
+ <!-- 左侧 L 角:竖条 + 底部横条 -->
21
+ <rect x="5.5" y="29" width="2" height="13" rx="0.2" />
22
+ <rect x="5.5" y="37" width="8.5" height="4.5" rx="0.2" />
23
+ <!-- 右侧 L 角:竖条 + 底部横条(镜像) -->
24
+ <rect x="56.5" y="29" width="2" height="13" rx="0.2" />
25
+ <rect x="50" y="37" width="8.5" height="4.5" rx="0.2" />
26
+ <!-- 中央菱形(两个方块组成的 V 字形,中间留 1px 缝) -->
27
+ <rect x="26" y="36.5" width="5.5" height="4.5" rx="0.2" />
28
+ <rect x="32.5" y="36.5" width="5.5" height="4.5" rx="0.2" />
29
+ </g>
30
+ </svg>