@mojieai/dsh-mojie-model-provider 0.1.0 → 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/README.md +75 -67
- package/cordis.patch.yml +9 -3
- package/lib/adapter.js +3 -1
- package/lib/catalog.d.ts +18 -2
- package/lib/catalog.generated.d.ts +2 -2
- package/lib/catalog.generated.js +5 -4
- package/lib/catalog.js +65 -18
- package/lib/client.js +1870 -203
- package/lib/commands/image.d.ts +4 -0
- package/lib/commands/image.js +218 -30
- package/lib/config.d.ts +17 -5
- package/lib/config.js +15 -3
- package/lib/core/client.d.ts +15 -1
- package/lib/core/client.js +8 -3
- package/lib/discovery.d.ts +16 -3
- package/lib/discovery.js +4 -0
- package/lib/index.d.ts +11 -1
- package/lib/index.js +22 -1
- package/lib/media/client.d.ts +11 -5
- package/lib/media/client.js +8 -10
- package/lib/media/dimensions.d.ts +23 -0
- package/lib/media/dimensions.js +114 -0
- package/lib/media/input-image.d.ts +75 -0
- package/lib/media/input-image.js +348 -0
- package/lib/media/model-memory.d.ts +48 -0
- package/lib/media/model-memory.js +64 -0
- package/lib/media/session-file.d.ts +33 -0
- package/lib/media/session-file.js +50 -0
- package/lib/media/task-store.d.ts +79 -0
- package/lib/media/task-store.js +149 -0
- package/lib/media/url-allowlist.d.ts +23 -0
- package/lib/media/url-allowlist.js +42 -0
- package/lib/order.d.ts +32 -0
- package/lib/order.js +71 -0
- package/lib/reasoning.d.ts +57 -0
- package/lib/reasoning.js +111 -0
- package/lib/serialize.d.ts +11 -0
- package/lib/serialize.js +3 -0
- package/lib/service.js +4 -1
- package/lib/tools/image.d.ts +17 -11
- package/lib/tools/image.js +60 -134
- package/lib/translate.js +124 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
<a href="https://mojieaigc.com"><img src="docs/assets/mojie-logo.png" alt="Mojie" width="112" /></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<h1 align="center">Mojie
|
|
5
|
+
<h1 align="center">Mojie dsh-mojie-model-provider</h1>
|
|
6
|
+
<p align="center">MojieAgentFlow全站模型deepseek-harness插件</p>
|
|
6
7
|
|
|
7
8
|
<p align="center">
|
|
8
9
|
<a href="https://github.com/MoJIeAIGC">GitHub</a> ·
|
|
@@ -10,53 +11,76 @@
|
|
|
10
11
|
<a href="https://www.douyin.com/user/MS4wLjABAAAA3JbjlCqKd8WXklSYmO64wxWeMBg4efViyTg8Gz6VZdI">抖音</a>
|
|
11
12
|
</p>
|
|
12
13
|
|
|
13
|
-
## 这是什么
|
|
14
14
|
由MojieAI开发的deepseek-harness插件,用于将Mojieaigc.com的所有平台能力无缝接入到DSH中,无需多余配置,直接让你的DSH拥有原生多模型,生图生视频能力。
|
|
15
15
|
|
|
16
16
|
| 用一个 Key,聊全球主流模型 | 一句话,让 AI 出图 | 像原生模型一样用 |
|
|
17
17
|
| :-- | :-- | :-- |
|
|
18
|
-
| GPT、Claude、Gemini、Qwen、DeepSeek、豆包、Kimi、Grok、GLM 等主流模型,全部出现在 DSH 的模型下拉里。 | `/image 一只戴帽子的猫` 直接把图画进对话;也可以对 AI 说「帮我画……」,它自己调用画图工具。 |
|
|
18
|
+
| GPT、Claude、Gemini、Qwen、DeepSeek、豆包、Kimi、Grok、GLM 等主流模型,全部出现在 DSH 的模型下拉里。 | `/image 一只戴帽子的猫` 直接把图画进对话;也可以对 AI 说「帮我画……」,它自己调用画图工具。 | 全部沿用 DSH 原生能力,习惯不用改 |
|
|
19
19
|
|
|
20
|
-
插件做三件事,并且只做这三件事:
|
|
21
|
-
|
|
22
|
-
- **接入模型** —— 把 Mojie 的 `/v1/models` 与聊天接口映射成一条 DSH provider 路由(`mojie`);
|
|
23
|
-
- **接入画图** —— 提供 `/image` 斜杠命令和 4 个原生画图工具,结果图存进本机附件目录;
|
|
24
|
-
- **接入视频**(暂待更新) —— 提供 `/video` 斜杠命令和 原生视频工具,结果视频存进本机附件目录;
|
|
25
|
-
- **保管钥匙** —— API Key 走 DSH 的凭据服务或环境变量,不进插件配置,也不进对话内容。
|
|
26
20
|
|
|
27
21
|
---
|
|
28
22
|
|
|
29
23
|
## 快速开始
|
|
30
24
|
|
|
31
|
-
> 🚀 三步:装插件 → 填 Key →
|
|
25
|
+
> 🚀 三步:装插件 → 填 Key → 开始使用。
|
|
26
|
+
|
|
27
|
+
## 安装前的准备
|
|
28
|
+
|
|
29
|
+
### 1. DSH 已经装好
|
|
30
|
+
|
|
31
|
+
桌面版或命令行版都行,能打开、能收发消息就可以。
|
|
32
|
+
|
|
33
|
+
- **桌面版**:在「设置 → 通用」里能看到「当前版本:x.x.x」;
|
|
34
|
+
- **命令行版**:在终端里执行:
|
|
35
|
+
|
|
36
|
+
```powershell
|
|
37
|
+
dsh --version
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
打印出 `0.2.1-rc.2` 或更高版本就可以继续。
|
|
41
|
+
|
|
42
|
+
### 1. 创建APIKEY
|
|
43
|
+
1. 登录 [mojieaigc.com](https://www.mojieaigc.com);
|
|
44
|
+
2. 点击右上角**个人头像**;
|
|
45
|
+
3. 进入 **我的APIKEY**;
|
|
46
|
+
4. 点击**新建密钥**,给 Key 起个名字(例如 `codex`),复制生成的那串。
|
|
47
|
+
|
|
48
|
+

|
|
49
|
+
|
|
50
|
+
进入后是 APIKEY 管理页,点右上角 **新建密钥**:
|
|
32
51
|
|
|
33
|
-
|
|
52
|
+

|
|
34
53
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
创建后回到列表,点 Key 后面的复制图标把它复制走:
|
|
57
|
+
|
|
58
|
+

|
|
38
59
|
|
|
39
|
-
> [!TIP]
|
|
40
|
-
> 聊天按 token 计费、画图按张 / 分辨率计费,都从主站点数里扣。先确认余额,再开始玩。
|
|
41
60
|
|
|
42
61
|
> [!WARNING]
|
|
43
|
-
>
|
|
62
|
+
> APIKEY 是你与 MojieAgentFlow 通信的重要凭证,请妥善保管;如怀疑泄露,请及时删除并重新创建,
|
|
44
63
|
|
|
45
|
-
###
|
|
64
|
+
### 2. 安装插件
|
|
46
65
|
|
|
47
66
|
#### 方式 A · 插件市场(推荐)
|
|
48
67
|
|
|
49
68
|
1. 打开 DSH,进入 **设置**。
|
|
50
69
|
2. 找到 **插件 / 插件市场** 页面。
|
|
51
70
|
3. 搜索 **Mojie**(或包名 `@mojieai/dsh-mojie-model-provider`)。
|
|
52
|
-
4.
|
|
71
|
+
4. 点**安装**,等它提示「已安装,请重启 DSH 加载它」,再点**完成**。
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+

|
|
75
|
+
|
|
76
|
+

|
|
53
77
|
|
|
54
78
|
#### 方式 B · 一行命令
|
|
55
79
|
|
|
56
80
|
打开终端(PowerShell / Terminal):
|
|
57
81
|
|
|
58
82
|
```sh
|
|
59
|
-
dsh plugin --profile desktop add https://github.com/MoJIeAIGC/dsh-mojie-model-provider/releases/latest/download/mojieai-dsh-mojie-model-provider-0.
|
|
83
|
+
dsh plugin --profile desktop add https://github.com/MoJIeAIGC/dsh-mojie-model-provider/releases/latest/download/mojieai-dsh-mojie-model-provider-0.2.0.tgz
|
|
60
84
|
```
|
|
61
85
|
|
|
62
86
|
> [!NOTE]
|
|
@@ -69,19 +93,17 @@ dsh plugin --profile desktop add https://github.com/MoJIeAIGC/dsh-mojie-model-pr
|
|
|
69
93
|
- **Windows 桌面版**:右键托盘图标 → **退出**(只关窗口不算退出),再双击 `DeepSeek Harness` 重新打开。
|
|
70
94
|
- **命令行版**:结束当前的 `dsh` 进程,重新启动。
|
|
71
95
|
|
|
72
|
-
###
|
|
96
|
+
### 3. 填入API Key(一次就好)
|
|
73
97
|
|
|
74
98
|
1. 重启后进入 **设置 → 模型**。
|
|
75
|
-
2. 找到 **Mojie provider
|
|
76
|
-
3. 在 **API
|
|
77
|
-
4.
|
|
99
|
+
2. 找到 **Mojie** provider 行;卡片会显示「API 密钥」。
|
|
100
|
+
3. 在 **API 密钥** 输入框里粘贴第 1 步复制的 Key。
|
|
101
|
+
4. 点卡片底部的 **保存**,看到「已保存。」即可,以后不用再填。
|
|
78
102
|
|
|
79
|
-
> [!TIP]
|
|
80
|
-
> 不想在界面里填也行:启动 DSH 前把 Key 放进环境变量 `MOJIE_API_KEY`,效果完全一样。具体写法见 [设置项](#设置项)。
|
|
81
103
|
|
|
82
|
-
###
|
|
104
|
+
### 4. 正确使用
|
|
83
105
|
|
|
84
|
-
|
|
106
|
+
**对话界面** —— 在 **设置 → 模型** 或聊天界面的模型下拉里,选一个 Mojie 提供的模型(例如 `claude-opus-5.5`、`gpt-6-astra`、`Kimi-k3.1-pro`),然后像平时一样发消息。它和原生模型一样支持:
|
|
85
107
|
|
|
86
108
|
- **工具调用**(读写文件、跑命令、搜索等)
|
|
87
109
|
- **看图**(把图片拖进输入框,选一个支持图片的模型)
|
|
@@ -105,6 +127,7 @@ dsh plugin --profile desktop add https://github.com/MoJIeAIGC/dsh-mojie-model-pr
|
|
|
105
127
|
| 想做什么 | 输入 |
|
|
106
128
|
| :-- | :-- |
|
|
107
129
|
| 画一张(用当前默认模型) | `/image 一只戴帽子的猫` |
|
|
130
|
+
| 编辑 / 融合(附带图片) | 把图片拖进输入框,输入 `/image 把这两张图融合成一张` |
|
|
108
131
|
| 本次换模型 | `/image 一只猫 --model mojie-nanobanana-2` |
|
|
109
132
|
| 指定分辨率与比例 | `/image 赛博朋克风的城市夜景 --resolution 2K --ratio 16:9` |
|
|
110
133
|
| 列出可用的画图模型 | `/image models` |
|
|
@@ -113,25 +136,31 @@ dsh plugin --profile desktop add https://github.com/MoJIeAIGC/dsh-mojie-model-pr
|
|
|
113
136
|
| 续查没跑完的任务 | `/image task <任务ID>` |
|
|
114
137
|
| 查看用法 | `/image help` |
|
|
115
138
|
|
|
139
|
+
> 🖼 只要这次 `/image` 带着图片附件,命令就自动走**编辑**:附件按上传顺序作为 `input_image_urls` 提交给上游,不需要 `/image edit` 语法。`--model` / `--resolution` / `--ratio` 依然可叠加;`models`、`model`、`task`、`help` 这些子命令照常可用,附带的图片会被静默忽略(不会报错,也不影响你暂存的原图)。
|
|
140
|
+
|
|
116
141
|
参数可以简写:`--model`/`-m`、`--resolution`/`-r`、`--ratio`/`--aspect-ratio`/`-a`,也支持 `--model=mojie-nanobanana-2` 这种等号写法。
|
|
117
142
|
|
|
118
143
|
### 任务没跑完怎么办
|
|
119
144
|
|
|
120
|
-
|
|
145
|
+
图片生成是异步任务。`/image` 提交后**立即返回**(输入框的附件和发送记录会马上清空),图片在后台完成后自动放进对话;如果提交后进程退出、或想手动取回,用 `/image task <任务ID>` 续查即可,**图不会丢**。
|
|
121
146
|
|
|
122
|
-
-
|
|
123
|
-
- 想要多张,就多敲几次 `/image
|
|
147
|
+
- 原图会写进当前会话的工作目录(文件名带任务 ID),重启 DSH 后对话里仍能看到图。
|
|
148
|
+
- 想要多张,就多敲几次 `/image`,每张都会单独落一个文件、单独发进对话。
|
|
124
149
|
|
|
125
150
|
### 设置默认画图模型
|
|
126
151
|
|
|
127
|
-
1. **设置 → 模型 → Mojie
|
|
152
|
+
1. **设置 → 模型 → Mojie** 行,展开 **自定义设置**。
|
|
128
153
|
2. 找到 **图片生成默认模型** 下拉框;列表为空就点右侧 **刷新图片模型**。
|
|
129
|
-
3. 选一个(例如 `
|
|
154
|
+
3. 选一个(例如 `seedream-5-image`、`mojie-nanobanana-2`),点卡片底部的 **保存**。
|
|
130
155
|
|
|
131
156
|
之后 `/image …` 和 AI 自己画图都会用这个模型。也可以随时用 `/image model <模型名>` 切换——两处改的是同一个设置。
|
|
132
157
|
|
|
133
|
-
> [!
|
|
134
|
-
>
|
|
158
|
+
> [!IMPORTANT]
|
|
159
|
+
> 对话里 AI 调用画图工具时,**只有你明确点名某个模型**它才会传 `model` 参数;没点名就省略,使用这里设置的默认模型。
|
|
160
|
+
>
|
|
161
|
+
>
|
|
162
|
+
> 模型名可以模糊说(例如“用 image 2.5”):AI 会先用 `mojie_list_image_models` 把模糊名解析成唯一的确切 id;如果有多个模型都匹配,它会先问你要哪一个。
|
|
163
|
+
|
|
135
164
|
|
|
136
165
|
### 让 AI 自己画 / 改图
|
|
137
166
|
|
|
@@ -140,19 +169,20 @@ dsh plugin --profile desktop add https://github.com/MoJIeAIGC/dsh-mojie-model-pr
|
|
|
140
169
|
| 工具 | 用途 |
|
|
141
170
|
| :-- | :-- |
|
|
142
171
|
| `mojie_generate_image` | 文字生图,可指定模型、分辨率、比例 |
|
|
143
|
-
| `mojie_edit_image` | 改图 /
|
|
172
|
+
| `mojie_edit_image` | 改图 / 重绘 / 多图融合;所有参考图都放 `input_images` 数组(一张也传数组),按顺序提交 |
|
|
144
173
|
| `mojie_list_image_models` | 列出当前 Key 可用的画图模型 |
|
|
145
174
|
| `mojie_image_task` | 查询任务状态,完成后把图取回对话 |
|
|
146
175
|
|
|
147
176
|
- **画**:直接说「帮我画一张……」即可,AI 会把图画进对话。
|
|
148
177
|
- **改**:把图片拖进输入框,说「把这张图的背景换成沙滩」「改成蓝色电影色调」,AI 会把结果图发回来。
|
|
178
|
+
- **多图融合**:一句话里给多张参考图(对话里贴多张,或让 AI 用 `input_images` 传多个路径),按你给的顺序提交。
|
|
179
|
+
- **图在哪**:生成/编辑的原图按厂商字节直接写进**当前会话的工作目录**(`mojie-<任务ID>-<序号>.<扩展名>`,也会保存url在历史记录中,不覆盖、不压缩、Provider 返回几张就存几张);对话里显示的压缩副本(由 DSH 附件存储按默认规则规范化,仅用于看),原图路径在「查看详情」里。
|
|
180
|
+
|
|
149
181
|
|
|
150
182
|
---
|
|
151
183
|
|
|
152
184
|
## 模型清单
|
|
153
185
|
|
|
154
|
-
> 🧠 一个 Key,主流模型。上下文窗口、输出上限、图片输入能力由 `/v1/models` 实时发现,并以内置快照兜底。
|
|
155
|
-
|
|
156
186
|
<details>
|
|
157
187
|
<summary><b>OpenAI · GPT</b>(11)</summary>
|
|
158
188
|
|
|
@@ -217,37 +247,16 @@ dsh plugin --profile desktop add https://github.com/MoJIeAIGC/dsh-mojie-model-pr
|
|
|
217
247
|
</details>
|
|
218
248
|
|
|
219
249
|
> [!NOTE]
|
|
220
|
-
>
|
|
221
|
-
|
|
250
|
+
> 清单会随主站更新。每个模型的 **上下文窗口、最大输出 token 数、输入类型、推理等级** 会一并自动填写。点 **获取可用模型** 可以搜索、勾选并 **更新列表**;
|
|
222
251
|
---
|
|
223
252
|
|
|
224
|
-
## 设置项
|
|
225
|
-
|
|
226
|
-
界面上的字段都在 **设置 → 模型 → Mojie provider 设置** 里:
|
|
227
|
-
|
|
228
|
-
| 界面上的叫法 | 配置字段 | 默认值 |
|
|
229
|
-
| :-- | :-- | :-- |
|
|
230
|
-
| API Key | 凭据 `MOJIE_API_KEY` | 空(必填) |
|
|
231
|
-
| 凭据引用 | `apiKeyEnv` | `MOJIE_API_KEY` |
|
|
232
|
-
| Base URL | `baseURL` | `https://mojieaigc.com` |
|
|
233
|
-
| 模型列表 | `models` | 空(自动发现 + 内置快照) |
|
|
234
|
-
| 图片生成默认模型 | `imageDefaultModel` | `seedream-5-image` |
|
|
235
|
-
|
|
236
|
-
Base URL 会自动填写 `https://mojieaigc.com`;
|
|
237
|
-
带 `www.` 或带 `/v1` 后缀都能识别,多余的路径会被去掉。
|
|
238
|
-
|
|
239
|
-
想用环境变量代替界面填 Key(PowerShell,设置后重开 DSH):
|
|
240
|
-
|
|
241
|
-
```powershell
|
|
242
|
-
[Environment]::SetEnvironmentVariable('MOJIE_API_KEY','你的 Mojie API Key','User')
|
|
243
|
-
```
|
|
244
253
|
|
|
245
254
|
## 常见问题
|
|
246
255
|
|
|
247
256
|
<details>
|
|
248
|
-
<summary><b
|
|
257
|
+
<summary><b>设置里模型目录是空的?</b></summary>
|
|
249
258
|
|
|
250
|
-
|
|
259
|
+
模型目录默认由内置快照自动填写,即使还没联网也能看到全部模型。要拿到主站最新清单,先确认 API Key 已保存(卡片上会显示「已配置凭据」),再展开 **自定义设置** 点 **获取可用模型**,勾选后点 **更新列表**;画图模型则点 **刷新图片模型**。如果仍然为空,检查主站余额是否用完,或 API 地址是否被改错。
|
|
251
260
|
|
|
252
261
|
</details>
|
|
253
262
|
|
|
@@ -271,7 +280,7 @@ Key 复制错了或已失效。回主站「个人中心 → API-KEY」重新复
|
|
|
271
280
|
按顺序自查:
|
|
272
281
|
|
|
273
282
|
1. 插件已安装,并且**重启过** DSH;
|
|
274
|
-
2. 设置 →
|
|
283
|
+
2. 设置 → 模型里能看到 **Mojie** 这一行(行内是 API 密钥 + 自定义设置);
|
|
275
284
|
3. 在输入框敲 `/`,菜单里能看到 **image**。
|
|
276
285
|
|
|
277
286
|
</details>
|
|
@@ -292,7 +301,7 @@ Key 复制错了或已失效。回主站「个人中心 → API-KEY」重新复
|
|
|
292
301
|
dsh plugin --profile desktop remove "@mojieai/dsh-mojie-model-provider"
|
|
293
302
|
```
|
|
294
303
|
|
|
295
|
-
然后重启 DSH
|
|
304
|
+
然后重启 DSH。已生成的原图仍在各会话的工作目录里,不会被删掉。
|
|
296
305
|
|
|
297
306
|
</details>
|
|
298
307
|
|
|
@@ -310,11 +319,10 @@ dsh plugin --profile desktop remove "@mojieai/dsh-mojie-model-provider"
|
|
|
310
319
|
|
|
311
320
|
- **Key 只在本机**:保存在 DSH 的凭据存储里(或 `MOJIE_API_KEY` 环境变量),不写进插件配置,也不进入对话内容。
|
|
312
321
|
- **请求直连主站**:聊天与画图请求直接发往 `mojieaigc.com`,不经过第三方中转。
|
|
313
|
-
-
|
|
322
|
+
- **图片留在本地**:生成的原图(与厂商字节一致)写进当前会话的工作目录,方便之后继续查看或二次编辑;对话显示副本存放在本机附件目录。
|
|
314
323
|
- **别把 Key 贴出去**:不要贴进对话、截图或代码仓库;怀疑泄露时,去主站重置 Key 再改一遍设置。
|
|
315
324
|
|
|
316
325
|
---
|
|
317
326
|
|
|
318
|
-
|
|
319
|
-
遇到问题或想提需求,欢迎到 [MojieAgentflow](https://www.mojieaigc.com) 留言,附上 DSH 版本、操作系统和报错原文会更好排查。账号、余额、Key 相关的问题,请找 Mojie 主站客服。
|
|
327
|
+
遇到问题或想提需求,欢迎到 [MojieAgentflow](https://www.mojieaigc.com) 查看联系方式。
|
|
320
328
|
|
package/cordis.patch.yml
CHANGED
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
config:
|
|
11
11
|
apiKeyEnv: MOJIE_API_KEY
|
|
12
12
|
baseURL: 'https://mojieaigc.com'
|
|
13
|
-
# Empty means:
|
|
14
|
-
#
|
|
15
|
-
#
|
|
13
|
+
# Empty means: inherit /v1/models discovery plus the built-in catalog.
|
|
14
|
+
# The Models page card fills this list for you (model rows, context
|
|
15
|
+
# windows, input types, and thinking levels); hand-written entries here
|
|
16
|
+
# still win and pin the values. Thinking levels come from the per-vendor
|
|
17
|
+
# recommendation unless a row pins `reasoningEfforts`, and
|
|
18
|
+
# `reasoning: 'off'` declares a model that cannot think at all.
|
|
16
19
|
models: []
|
|
20
|
+
# Send `reasoning.effort` for every model that does not opt out, even
|
|
21
|
+
# though the site publishes no effort vocabulary. Set false to stop.
|
|
22
|
+
reasoningDefaults: true
|
package/lib/adapter.js
CHANGED
|
@@ -43,7 +43,9 @@ export class MojieAdapter extends LlmAdapter {
|
|
|
43
43
|
}
|
|
44
44
|
resolveModelWith(provider, model, config, discovered) {
|
|
45
45
|
const configured = config.models.find((entry) => entry.id === model);
|
|
46
|
-
return mergeResolvedModelInfo(provider, model, configured, discovered
|
|
46
|
+
return mergeResolvedModelInfo(provider, model, configured, discovered, {
|
|
47
|
+
reasoningDefaults: config.reasoningDefaults,
|
|
48
|
+
});
|
|
47
49
|
}
|
|
48
50
|
/** Discovery row for one model from the last successful listing, when it still matches the endpoint. */
|
|
49
51
|
discoveredModel(config, model) {
|
package/lib/catalog.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LlmDiscoveredModel, LlmModelInfo, LlmResolvedModelInfo, ModelModality, ReasoningEffortId } from '@deepseek-ai/dsh-llm';
|
|
2
2
|
import type { MojieModelConfig } from './config.js';
|
|
3
|
+
import type { MojieDiscoveredModel } from './discovery.js';
|
|
3
4
|
/**
|
|
4
5
|
* Built-in metadata for one Mojie model. `scripts/sync-catalog.mjs` writes the rows
|
|
5
6
|
* from the live `/v1/models` listing, so this list follows the site instead of being
|
|
@@ -31,6 +32,16 @@ export declare function builtinModel(id: string): MojieCatalogModel | undefined;
|
|
|
31
32
|
* @returns merged list-model entry.
|
|
32
33
|
*/
|
|
33
34
|
export declare function mergeModelInfo(provider: string, id: string, configured?: MojieModelConfig, discovered?: LlmDiscoveredModel): LlmModelInfo;
|
|
35
|
+
/** Options that shape one exact-model resolution. */
|
|
36
|
+
export interface ResolveModelOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Apply the per-vendor thinking ladder when neither the configuration nor the
|
|
39
|
+
* built-in snapshot declares efforts. Defaults to on: the site publishes no
|
|
40
|
+
* effort vocabulary, so the recommendation is the only useful answer, and the
|
|
41
|
+
* parameter is sent whether or not the relay honors it.
|
|
42
|
+
*/
|
|
43
|
+
readonly reasoningDefaults?: boolean;
|
|
44
|
+
}
|
|
34
45
|
/**
|
|
35
46
|
* Resolve exact model metadata with provider defaults and unknown-model fallbacks.
|
|
36
47
|
* Unknown models default to text-only with their id as the display name.
|
|
@@ -38,15 +49,20 @@ export declare function mergeModelInfo(provider: string, id: string, configured?
|
|
|
38
49
|
* @param id - exact model id.
|
|
39
50
|
* @param configured - explicitly configured model entry, when present.
|
|
40
51
|
* @param discovered - remote discovery entry, when present.
|
|
52
|
+
* @param options - resolution switches (vendor thinking defaults).
|
|
41
53
|
* @returns merged exact model metadata.
|
|
42
54
|
*/
|
|
43
|
-
export declare function mergeResolvedModelInfo(provider: string, id: string, configured?: MojieModelConfig, discovered?:
|
|
55
|
+
export declare function mergeResolvedModelInfo(provider: string, id: string, configured?: MojieModelConfig, discovered?: MojieDiscoveredModel, options?: ResolveModelOptions): LlmResolvedModelInfo;
|
|
44
56
|
/**
|
|
45
57
|
* Merge configured and discovered models into one advisory catalog.
|
|
46
58
|
* Configured entries override the same ids from discovery; discovery still contributes additional ids.
|
|
59
|
+
*
|
|
60
|
+
* The result is ordered by display name (then id, numbers compared as numbers),
|
|
61
|
+
* so the composer lists every vendor's models together and in alphabetical
|
|
62
|
+
* order even when a new model was appended to the stored `models` list last.
|
|
47
63
|
* @param provider - route id.
|
|
48
64
|
* @param configured - explicit config entries.
|
|
49
65
|
* @param discovered - remote discovery entries.
|
|
50
|
-
* @returns merged catalog in
|
|
66
|
+
* @returns merged catalog in selector display order.
|
|
51
67
|
*/
|
|
52
68
|
export declare function mergeCatalog(provider: string, configured: readonly MojieModelConfig[], discovered: readonly LlmDiscoveredModel[]): LlmModelInfo[];
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Mojie model catalog snapshot — GENERATED FILE, DO NOT EDIT BY HAND.
|
|
3
3
|
*
|
|
4
4
|
* Source: `GET https://mojieaigc.com/v1/models`
|
|
5
|
-
* Fetched: 2026-
|
|
6
|
-
* Models:
|
|
5
|
+
* Fetched: 2026-11-05T09:42:22.730Z
|
|
6
|
+
* Models: 66
|
|
7
7
|
*
|
|
8
8
|
* Refresh with `pnpm sync:catalog` (scripts/sync-catalog.mjs). This snapshot keeps the
|
|
9
9
|
* first request of a session correct before live discovery answers; the live listing
|
package/lib/catalog.generated.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Mojie model catalog snapshot — GENERATED FILE, DO NOT EDIT BY HAND.
|
|
3
3
|
*
|
|
4
4
|
* Source: `GET https://mojieaigc.com/v1/models`
|
|
5
|
-
* Fetched: 2026-
|
|
6
|
-
* Models:
|
|
5
|
+
* Fetched: 2026-11-05T09:42:22.730Z
|
|
6
|
+
* Models: 66
|
|
7
7
|
*
|
|
8
8
|
* Refresh with `pnpm sync:catalog` (scripts/sync-catalog.mjs). This snapshot keeps the
|
|
9
9
|
* first request of a session correct before live discovery answers; the live listing
|
|
@@ -29,6 +29,7 @@ export const BUILTIN_CATALOG_MODELS = [
|
|
|
29
29
|
{ id: 'qwen3.8-flash', name: 'qwen3.8-flash', inputModalities: ['text', 'image'] },
|
|
30
30
|
{ id: 'qwen3.8-max', name: 'qwen3.8-max', inputModalities: ['text', 'image'] },
|
|
31
31
|
{ id: 'qwen3.8-omni-flash', name: 'qwen3.8-omni-flash', inputModalities: ['text', 'image'] },
|
|
32
|
+
{ id: 'gpt-6.1-terra', name: 'gpt-6.1-terra', inputModalities: ['text', 'image'] },
|
|
32
33
|
{ id: 'gpt-6-sol', name: 'gpt-6-sol', inputModalities: ['text', 'image'] },
|
|
33
34
|
{ id: 'gpt-6-luna', name: 'gpt-6-luna', inputModalities: ['text', 'image'] },
|
|
34
35
|
{ id: 'gpt-6.1-sol', name: 'gpt-6.1-sol', inputModalities: ['text', 'image'] },
|
|
@@ -53,7 +54,7 @@ export const BUILTIN_CATALOG_MODELS = [
|
|
|
53
54
|
{ id: 'gemini-3.7-flash', name: 'gemini-3.7-flash', inputModalities: ['text', 'image'] },
|
|
54
55
|
{ id: 'gemini-3.8-flash', name: 'gemini-3.8-flash', inputModalities: ['text', 'image'] },
|
|
55
56
|
{ id: 'gemini-4-argon', name: 'gemini-4-argon', inputModalities: ['text', 'image'] },
|
|
56
|
-
{ id: 'deepseek-v4-pro', name: 'deepseek-v4-pro', inputModalities: ['text'] },
|
|
57
|
+
{ id: 'deepseek-v4-pro', name: 'deepseek-v4-pro', inputModalities: ['text', 'image'] },
|
|
57
58
|
{ id: 'deepseek-v4-flash', name: 'deepseek-v4-flash', inputModalities: ['text'] },
|
|
58
59
|
{
|
|
59
60
|
id: 'claude-sonnet-4.5',
|
|
@@ -139,7 +140,7 @@ export const BUILTIN_CATALOG_MODELS = [
|
|
|
139
140
|
{ id: 'doubao-seed-2-1-lite', name: 'doubao-seed-2-1-lite', inputModalities: ['text', 'image'] },
|
|
140
141
|
{ id: 'doubao-seed-2-0-lite', name: 'doubao-seed-2-0-lite', inputModalities: ['text', 'image'] },
|
|
141
142
|
{ id: 'doubao-seed-2-0-mini', name: 'doubao-seed-2-0-mini', inputModalities: ['text', 'image'] },
|
|
142
|
-
{ id: 'doubao-seed-2-0-code-preview', name: 'doubao-seed-2-0-code-preview', inputModalities: ['text'] },
|
|
143
|
+
{ id: 'doubao-seed-2-0-code-preview', name: 'doubao-seed-2-0-code-preview', inputModalities: ['text', 'image'] },
|
|
143
144
|
{ id: 'doubao-seed-character', name: 'doubao-seed-character', inputModalities: ['text', 'image'] },
|
|
144
145
|
{ id: 'doubao-seed-2-1-turbo', name: 'doubao-seed-2-1-turbo', inputModalities: ['text', 'image'] },
|
|
145
146
|
];
|
package/lib/catalog.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ReasoningEffortId as brandReasoningEffort } from '@deepseek-ai/dsh-llm';
|
|
2
2
|
import { BUILTIN_CATALOG_MODELS } from './catalog.generated.js';
|
|
3
|
+
import { sortModelOrder } from './order.js';
|
|
4
|
+
import { describeEfforts, vendorReasoningProfile } from './reasoning.js';
|
|
3
5
|
/** Snapshot lookup: built-ins keep the first request of a session correct before discovery answers. */
|
|
4
6
|
const BUILTIN_CATALOG = new Map(BUILTIN_CATALOG_MODELS.map((model) => [model.id, model]));
|
|
5
7
|
/**
|
|
@@ -35,6 +37,59 @@ export function mergeModelInfo(provider, id, configured, discovered) {
|
|
|
35
37
|
inputModalities: [...inputModalities],
|
|
36
38
|
};
|
|
37
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the thinking ladder for one model.
|
|
42
|
+
*
|
|
43
|
+
* Order: an explicit per-model opt-out, then declared efforts (configuration,
|
|
44
|
+
* then built-in snapshot), then the vendor recommendation. The recommendation is
|
|
45
|
+
* skipped only when the caller disabled defaults or the live listing reports the
|
|
46
|
+
* model cannot think at all; an unlisted capability stays optimistic so the first
|
|
47
|
+
* request of a session still has a picker.
|
|
48
|
+
* @param id - exact model id.
|
|
49
|
+
* @param configured - explicitly configured model entry, when present.
|
|
50
|
+
* @param builtin - shipped snapshot row, when known.
|
|
51
|
+
* @param discovered - live discovery row, when the cache has one for this endpoint.
|
|
52
|
+
* @param options - resolution switches.
|
|
53
|
+
* @returns published reasoning metadata, or undefined when the model has no picker.
|
|
54
|
+
*/
|
|
55
|
+
function resolveReasoning(id, configured, builtin, discovered, options) {
|
|
56
|
+
if (configured?.reasoning === 'off')
|
|
57
|
+
return undefined;
|
|
58
|
+
const profile = options.reasoningDefaults === false ? undefined : vendorReasoningProfile(id);
|
|
59
|
+
const declaredIds = configured?.reasoningEfforts?.length
|
|
60
|
+
? configured.reasoningEfforts
|
|
61
|
+
: builtin?.reasoningEfforts?.length
|
|
62
|
+
? builtin.reasoningEfforts
|
|
63
|
+
: undefined;
|
|
64
|
+
if (declaredIds !== undefined) {
|
|
65
|
+
// A declared ladder may name levels the vendor profile does not know, so the
|
|
66
|
+
// default has to appear in the declared list to be legal.
|
|
67
|
+
const configuredDefault = configured?.defaultReasoningEffort ?? builtin?.defaultReasoningEffort;
|
|
68
|
+
const defaultEffort = configuredDefault !== undefined && declaredIds.includes(configuredDefault)
|
|
69
|
+
? configuredDefault
|
|
70
|
+
: profile !== undefined && declaredIds.includes(profile.defaultEffort)
|
|
71
|
+
? profile.defaultEffort
|
|
72
|
+
: undefined;
|
|
73
|
+
return {
|
|
74
|
+
efforts: describeEfforts(declaredIds, profile).map((effort) => ({
|
|
75
|
+
id: brandReasoningEffort(effort.id),
|
|
76
|
+
name: effort.name,
|
|
77
|
+
description: effort.description,
|
|
78
|
+
})),
|
|
79
|
+
...defaultEffort === undefined ? {} : { defaultEffort: brandReasoningEffort(defaultEffort) },
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (profile === undefined || discovered?.supportsReasoning === false)
|
|
83
|
+
return undefined;
|
|
84
|
+
return {
|
|
85
|
+
efforts: profile.efforts.map((effort) => ({
|
|
86
|
+
id: brandReasoningEffort(effort.id),
|
|
87
|
+
name: effort.name,
|
|
88
|
+
description: effort.description,
|
|
89
|
+
})),
|
|
90
|
+
defaultEffort: brandReasoningEffort(profile.defaultEffort),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
38
93
|
/**
|
|
39
94
|
* Resolve exact model metadata with provider defaults and unknown-model fallbacks.
|
|
40
95
|
* Unknown models default to text-only with their id as the display name.
|
|
@@ -42,42 +97,34 @@ export function mergeModelInfo(provider, id, configured, discovered) {
|
|
|
42
97
|
* @param id - exact model id.
|
|
43
98
|
* @param configured - explicitly configured model entry, when present.
|
|
44
99
|
* @param discovered - remote discovery entry, when present.
|
|
100
|
+
* @param options - resolution switches (vendor thinking defaults).
|
|
45
101
|
* @returns merged exact model metadata.
|
|
46
102
|
*/
|
|
47
|
-
export function mergeResolvedModelInfo(provider, id, configured, discovered) {
|
|
103
|
+
export function mergeResolvedModelInfo(provider, id, configured, discovered, options = {}) {
|
|
48
104
|
const builtin = builtinModel(id);
|
|
49
105
|
const base = mergeModelInfo(provider, id, configured, discovered);
|
|
50
106
|
const contextWindow = configured?.contextWindow ?? discovered?.contextWindow ?? builtin?.contextWindow;
|
|
51
107
|
const defaultMaxTokens = configured?.maxTokens ?? discovered?.maxTokens ?? builtin?.maxTokens;
|
|
52
|
-
const
|
|
53
|
-
? configured.reasoningEfforts
|
|
54
|
-
: builtin?.reasoningEfforts?.length
|
|
55
|
-
? builtin.reasoningEfforts
|
|
56
|
-
: undefined;
|
|
108
|
+
const reasoning = resolveReasoning(id, configured, builtin, discovered, options);
|
|
57
109
|
return {
|
|
58
110
|
...base,
|
|
59
111
|
...contextWindow === undefined ? {} : { context: { contextWindow } },
|
|
60
112
|
...defaultMaxTokens === undefined ? {} : { defaultMaxTokens },
|
|
61
113
|
...configured?.systemPromptUpdate === undefined ? {} : { systemPromptUpdate: configured.systemPromptUpdate },
|
|
62
|
-
...
|
|
63
|
-
? {}
|
|
64
|
-
: {
|
|
65
|
-
reasoning: {
|
|
66
|
-
efforts: reasoningEfforts.map((effort) => ({ id: brandReasoningEffort(effort), name: String(effort) })),
|
|
67
|
-
...configured?.defaultReasoningEffort !== undefined && reasoningEfforts.includes(configured.defaultReasoningEffort)
|
|
68
|
-
? { defaultEffort: brandReasoningEffort(configured.defaultReasoningEffort) }
|
|
69
|
-
: {},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
114
|
+
...reasoning === undefined ? {} : { reasoning },
|
|
72
115
|
};
|
|
73
116
|
}
|
|
74
117
|
/**
|
|
75
118
|
* Merge configured and discovered models into one advisory catalog.
|
|
76
119
|
* Configured entries override the same ids from discovery; discovery still contributes additional ids.
|
|
120
|
+
*
|
|
121
|
+
* The result is ordered by display name (then id, numbers compared as numbers),
|
|
122
|
+
* so the composer lists every vendor's models together and in alphabetical
|
|
123
|
+
* order even when a new model was appended to the stored `models` list last.
|
|
77
124
|
* @param provider - route id.
|
|
78
125
|
* @param configured - explicit config entries.
|
|
79
126
|
* @param discovered - remote discovery entries.
|
|
80
|
-
* @returns merged catalog in
|
|
127
|
+
* @returns merged catalog in selector display order.
|
|
81
128
|
*/
|
|
82
129
|
export function mergeCatalog(provider, configured, discovered) {
|
|
83
130
|
const discoveredMap = new Map(discovered.map((model) => [model.id, model]));
|
|
@@ -93,5 +140,5 @@ export function mergeCatalog(provider, configured, discovered) {
|
|
|
93
140
|
result.push(mergeModelInfo(provider, model.id, undefined, model));
|
|
94
141
|
seen.add(model.id);
|
|
95
142
|
}
|
|
96
|
-
return result;
|
|
143
|
+
return sortModelOrder(result);
|
|
97
144
|
}
|