dsh-agentone 0.5.15 → 0.5.16
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/model.js +13 -3
- package/package.json +1 -1
package/lib/model.js
CHANGED
|
@@ -21,8 +21,9 @@ const REASONING_EFFORTS = { off: null, low: 'low', medium: 'medium', high: 'high
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* 把平台 /models 条目转成 llm-pi-ai models 配置。
|
|
24
|
-
* input
|
|
25
|
-
*
|
|
24
|
+
* input(视觉)、reasoning(思考)与 contextWindow(上下文窗口)是平台
|
|
25
|
+
* 能力表下发的声明,插件只翻译:未声明的旧平台版本回退到全档位思考 +
|
|
26
|
+
* 纯文本 + 不写上下文(llm-pi-ai 回退自身 catalog 默认)。
|
|
26
27
|
*/
|
|
27
28
|
function platformModelEntry(item) {
|
|
28
29
|
const id = typeof item === 'string' ? item : item?.id;
|
|
@@ -30,6 +31,9 @@ function platformModelEntry(item) {
|
|
|
30
31
|
const entry = { id, name: friendlyModelName(id) };
|
|
31
32
|
const input = Array.isArray(item?.input) ? item.input : ['text'];
|
|
32
33
|
if (input.includes('image')) entry.input = ['text', 'image'];
|
|
34
|
+
if (typeof item?.contextWindow === 'number' && item.contextWindow > 0) {
|
|
35
|
+
entry.contextWindow = item.contextWindow;
|
|
36
|
+
}
|
|
33
37
|
if (item?.reasoning === false) entry.reasoningEfforts = false;
|
|
34
38
|
else entry.reasoningEfforts = { ...REASONING_EFFORTS };
|
|
35
39
|
return entry;
|
|
@@ -137,7 +141,13 @@ export async function fetchPlatformModels(platformUrl, accessToken) {
|
|
|
137
141
|
const data = await response.json().catch(() => ({}));
|
|
138
142
|
const models = Array.isArray(data.data)
|
|
139
143
|
? data.data
|
|
140
|
-
.map((item) =>
|
|
144
|
+
.map((item) =>
|
|
145
|
+
typeof item === 'string'
|
|
146
|
+
? item
|
|
147
|
+
: item?.id
|
|
148
|
+
? { id: item.id, input: item.input, reasoning: item.reasoning, contextWindow: item.contextWindow }
|
|
149
|
+
: null,
|
|
150
|
+
)
|
|
141
151
|
.filter(Boolean)
|
|
142
152
|
: [];
|
|
143
153
|
if (models.length === 0) throw new Error('平台返回的可用模型列表为空');
|
package/package.json
CHANGED