tju-llm-dsh 1.0.0 → 1.0.2

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
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## 配置写入
4
4
 
5
+ ### Q: 我完全没用过 dsh,怎么开始?
6
+
7
+ 先装 DeepSeek Harness(官方开源项目):
8
+
9
+ 1. 装 Node.js ≥ 18([nodejs.org](https://nodejs.org/) 下载 LTS,Windows 可 `winget install OpenJS.NodeJS.LTS`);
10
+ 2. `npm install -g @deepseek-ai/dsh`;
11
+ 3. 终端跑 `dsh web`——首次运行自动初始化 profile 并生成 `~/.dsh/` 目录,按输出地址打开浏览器(一般是 `http://127.0.0.1:3080`)确认能访问。
12
+
13
+ 然后回来照 README「三步接入」走即可。用 DeepSeek 桌面版的话,`desktop` profile 同样被本工具支持。
14
+
5
15
  ### Q: 工具到底改了哪两个文件?
6
16
 
7
17
  1. `~/.dsh/profiles/<profile>/cordis.patch.yml` — 顶层补丁数组中加入/合并 `llm-pi-ai` 插件条目,provider 名为 `tju`。
@@ -24,9 +34,18 @@
24
34
 
25
35
  ## 连通与使用
26
36
 
37
+ ### Q: 怎么获取 API Key?
38
+
39
+ 两步(依据[信息与网络中心推文](https://mp.weixin.qq.com/s/iNoT0yAlxM0iv9NjJ15s6Q)):
40
+
41
+ 1. **申请开通**:登录融合门户 → 网上办事大厅 → 检索「Token」或「大模型」→ 填写《本地大模型免费 Token 服务开通申请表》提交,**系统自动开通 API 访问权限**;
42
+ 2. **获取 Key**:登录[智能体广场](https://ai.tju.edu.cn),获取 `tk-` 开头的个人 API Key,同页可查用量、管理密钥。
43
+
44
+ 注意:仅限校园网访问;额度每人每月上行 10 亿 / 下行 1000 万词元;Key 不得转借或公开发布;咨询 022-27404455。
45
+
27
46
  ### Q: verify 报「Prompt token limit exceeded」?
28
47
 
29
- 这是**账户层面**的额度限制,与请求大小无关(一个 "hi" 也会报)。通常是免费额度用尽或账户受限。去 [ai.tju.edu.cn](https://ai.tju.edu.cn) 查看用量,或换一个 Key。
48
+ 这是**账户层面**的额度限制,与请求大小无关(一个 "hi" 也会报)。通常是额度用尽、账户受限,或**服务未开通**(先按上一条走开通流程)。去 [ai.tju.edu.cn](https://ai.tju.edu.cn) 查看用量,或换一个 Key。
30
49
 
31
50
  ### Q: verify 报 429?
32
51
 
package/README.md CHANGED
@@ -14,11 +14,47 @@
14
14
  - **数据不出校**:请求直接发往校内网关,不经过第三方
15
15
  - **模型新**:DeepSeek / Qwen 系列最新模型,最高 512K 上下文
16
16
 
17
+ ## 从零开始:先装 DeepSeek Harness(没用过 dsh?看这里)
18
+
19
+ dsh 是 DeepSeek 官方的开源 agent 入口([deepseek-ai/deepseek-harness](https://github.com/deepseek-ai/deepseek-harness))。从未接触过的话,三步装好:
20
+
21
+ 1. **装 Node.js ≥ 18**(还没有的话):去 [nodejs.org](https://nodejs.org/) 下载 LTS 版安装,Windows 也可以在 PowerShell 里执行 `winget install OpenJS.NodeJS.LTS`。装完在终端跑 `node --version` 能看到版本号即可。
22
+ 2. **装 dsh**:
23
+
24
+ ```powershell
25
+ npm install -g @deepseek-ai/dsh
26
+ ```
27
+
28
+ 3. **跑一次**:
29
+
30
+ ```powershell
31
+ dsh web
32
+ ```
33
+
34
+ 首次运行会自动初始化 Web profile 并生成 `~/.dsh/` 配置目录(Windows 即 `%USERPROFILE%\.dsh`);按终端输出的本地地址打开浏览器即可使用(一般是 `http://127.0.0.1:3080`)。确认页面能打开后 Ctrl+C 停掉,回到下面的接入步骤。
35
+
36
+ > 用 DeepSeek 桌面版的同学:它使用的 `desktop` profile 本工具同样支持,装好本工具直接配置即可。
37
+
17
38
  ## 前置条件
18
39
 
19
40
  1. **Node.js ≥ 18**(dsh 用户天然满足)
20
- 2. **已安装并运行过一次 dsh**(`npm i -g @deepseek-ai/dsh`,跑一次让它生成 `~/.dsh/profiles/`)
21
- 3. **天大智算 API Key**(`tk-` 开头,在 [ai.tju.edu.cn](https://ai.tju.edu.cn) 个人设置里生成)
41
+ 2. **已安装并运行过一次 dsh**(没装过?照上一节《从零开始》三步即可)
42
+ 3. **天大智算 API Key**(`tk-` 开头)——需要先申请开通服务,见[下一节](#如何获取-api-key)
43
+
44
+ ## 如何获取 API Key(两步)
45
+
46
+ > 依据信息与网络中心推文[《学校智能体广场上新"词元(Token)"API服务》](https://mp.weixin.qq.com/s/iNoT0yAlxM0iv9NjJ15s6Q)(2026-05)。
47
+
48
+ **第 1 步 · 申请开通(没有这一步就没有额度)**:登录融合门户 → **网上办事大厅** → 检索「**Token**」或「**大模型**」→ 填写《本地大模型免费 Token 服务开通申请表》并提交。**提交后系统自动开通 API 访问权限。**
49
+
50
+ **第 2 步 · 获取 Key**:登录[**智能体广场**](https://ai.tju.edu.cn),获取个人 API Key(`tk-` 开头);同一页面可查询用量、管理密钥。
51
+
52
+ 注意事项:
53
+
54
+ - 服务仅限**校园网络环境**内访问;
55
+ - 密钥须妥善保管,**不得转借、不得发布于公开平台**;
56
+ - 词元额度按月统计:每人每月**上行 10 亿、下行 1000 万**;
57
+ - 遇到问题可咨询信息与网络中心:**022-27404455**。
22
58
 
23
59
  ## 三步接入
24
60
 
package/SKILL.md CHANGED
@@ -23,17 +23,23 @@ cd <安装目录> && npm install --omit=dev
23
23
  # 之后用 node bin/tju-dsh.mjs 代替 tju-dsh
24
24
  ```
25
25
 
26
- 前置检查:`node --version`(需 ≥ 18);目录 `~/.dsh/profiles/` 是否存在
27
- (Windows 为 `%USERPROFILE%\.dsh\profiles`)。不存在就先让用户安装并运行一次
28
- `dsh`(`npm i -g @deepseek-ai/dsh`),没有 dsh 就没有配置目标。
26
+ 前置检查:`node --version`(需 ≥ 18,没有就去 nodejs.org 装 LTS 或 `winget install OpenJS.NodeJS.LTS`);目录 `~/.dsh/profiles/` 是否存在
27
+ (Windows 为 `%USERPROFILE%\.dsh\profiles`)。不存在就让用户装 dsh 并跑一次:
28
+ `npm install -g @deepseek-ai/dsh` 然后 `dsh web`(首次运行自动生成 `~/.dsh/profiles/`,
29
+ 按输出地址打开浏览器确认能访问)。没有 dsh 就没有配置目标。
29
30
 
30
31
  ## 对话脚本(按顺序,不要跳步)
31
32
 
32
33
  ### 1. 问用户要 Key(唯一必须问的)
33
34
 
34
- > 「请把天大智算的 API Key 发给我(tk- 开头,在 https://ai.tju.edu.cn 个人设置里生成)」
35
+ 先确认用户**是否已开通服务**——Key 不是上来就能生成的,依据信息与网络中心推文([原文](https://mp.weixin.qq.com/s/iNoT0yAlxM0iv9NjJ15s6Q))需要两步:
35
36
 
36
- 用户没有 Key → 引导去上面网址生成,等用户拿到再继续。
37
+ 1. **申请开通**:融合门户 → **网上办事大厅** → 检索「Token」或「大模型」→ 填《本地大模型免费 Token 服务开通申请表》提交,**系统自动开通**;
38
+ 2. **获取 Key**:登录[**智能体广场**](https://ai.tju.edu.cn)获取 `tk-` 开头的个人 API Key(同页可查用量)。
39
+
40
+ > 话术:「天大智算的 Key 需要先开通服务:登录融合门户→网上办事大厅→搜『Token』提交开通申请(自动生效),然后到 ai.tju.edu.cn(智能体广场)拿你的 tk- 开头 Key 发给我。」
41
+
42
+ 用户没有 Key → 按上面话术引导,等拿到再继续。额度规则(可顺带告知):每人每月上行 10 亿 / 下行 1000 万词元;仅限校园网访问;咨询 022-27404455。
37
43
 
38
44
  ### 2. profile(多数情况不用问)
39
45
 
@@ -78,7 +84,7 @@ tju-dsh verify --model <用户最关心的那个模型,缺省 tju-llm>
78
84
 
79
85
  | 现象 | 原因与话术 |
80
86
  |---|---|
81
- | HTTP 429 且 body 含 `Prompt token limit exceeded` | **账户额度用尽/受限**,与请求大小无关。让用户上 ai.tju.edu.cn 查用量或换 Key |
87
+ | HTTP 429 且 body 含 `Prompt token limit exceeded` | **账户额度用尽/受限,或服务根本没开通**(要先去网上办事大厅申请)。让用户上 ai.tju.edu.cn 查用量 |
82
88
  | 纯 429 | 限流 60 次/分钟,等几秒重试 |
83
89
  | 401/403 | Key 无效或过期 → `remove` 后用新 Key 重配 |
84
90
  | `model not found` | 模型名大小写错了(只认小写)或已下线 → `tju-dsh models` 看列表 |
package/bin/tju-dsh.mjs CHANGED
@@ -193,7 +193,7 @@ async function pickProfile(opts, p) {
193
193
  return opts.profile;
194
194
  }
195
195
  if (profiles.length === 0) {
196
- die('没有找到任何 dsh profile。请先安装并运行一次 dsh(它会生成 ~/.dsh/profiles/),再运行本工具。');
196
+ die('没有找到任何 dsh profile。请先运行一次 dsh web(首次运行会自动生成 ~/.dsh/profiles/),再运行本工具。');
197
197
  }
198
198
  if (profiles.length === 1) {
199
199
  info(`使用唯一的 profile:${profiles[0]}`);
@@ -458,7 +458,7 @@ async function cmdSetup(opts) {
458
458
  console.log(c.cyan('\n== tju-dsh:把天津大学智算平台接入 DeepSeek Harness ==\n'));
459
459
 
460
460
  if (!existsSync(p.dshDir)) {
461
- die(`未找到 ${p.dshDir}。请先安装并运行一次 dsh(npm i -g @deepseek-ai/dsh 后执行 dsh),再运行本工具。`);
461
+ die(`未找到 ${p.dshDir}。若从未用过 dsh:先装 Node.js ≥ 18(nodejs.org),再执行 npm install -g @deepseek-ai/dsh,然后运行一次 dsh web(自动生成配置目录),最后重新运行本工具。`);
462
462
  }
463
463
 
464
464
  const profile = await pickProfile(opts, p);
@@ -506,7 +506,7 @@ async function cmdSetup(opts) {
506
506
  ok(`已存在 ${ENV_KEY},保持不变(如需更换:tju-dsh remove 后重新配置,或直接编辑 ${p.credsFile})`);
507
507
  } else if (!key) {
508
508
  console.log('');
509
- console.log(`请粘贴天大智算的 API Key(tk- 开头,在 https://ai.tju.edu.cn 个人设置里生成;输入不回显)`);
509
+ console.log(`请粘贴天大智算的 API Key(tk- 开头;需先在融合门户网上办事大厅申请开通服务,再到智能体广场 ai.tju.edu.cn 获取 Key。输入不回显)`);
510
510
  key = await prompt('API Key: ', { hidden: true });
511
511
  if (!key) die('API Key 不能为空。');
512
512
  }
@@ -543,9 +543,9 @@ async function cmdVerify(opts) {
543
543
  if (e.message.includes('\n')) console.log(c.dim(e.message.split('\n').slice(1).join('\n')));
544
544
  console.log('');
545
545
  if (e.status === 401 || e.status === 403) {
546
- info('多为 API Key 无效/过期。去 https://ai.tju.edu.cn 重新生成,然后 tju-dsh remove && tju-dsh 重配。');
546
+ info('多为 API Key 无效/过期,或服务未开通(需先在融合门户网上办事大厅申请)。去 https://ai.tju.edu.cn 重新生成,然后 tju-dsh remove && tju-dsh 重配。');
547
547
  } else if (/Prompt token limit/i.test(e.body || '')) {
548
- info('网关返回「Prompt token limit exceeded」:通常是账户额度用尽或受限(与请求本身无关)。去 https://ai.tju.edu.cn 查看用量,或换一个 Key 试。');
548
+ info('网关返回「Prompt token limit exceeded」:通常是额度用尽/受限,或服务未开通(网上办事大厅搜「Token」申请)。去 https://ai.tju.edu.cn 查看用量,或换一个 Key 试。');
549
549
  } else if (e.status === 404 || /model/i.test(e.message)) {
550
550
  info(`模型 ${model} 可能不存在或已下线,运行 tju-dsh models 查看可用列表。`);
551
551
  } else if (e.status === 429) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tju-llm-dsh",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "把天津大学智算平台(ai.tju.edu.cn)接入 DeepSeek Harness(dsh)——社区工具,非官方",
5
5
  "type": "module",
6
6
  "bin": {