@goodandready/dsh-ollama-cloud-provider 0.1.23 → 0.1.24
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/CHANGELOG.md +12 -0
- package/README.md +4 -4
- package/README.ru.md +4 -4
- package/README.zh.md +4 -4
- package/lib/client.js +292 -2
- package/lib/index.d.ts +11 -0
- package/lib/index.js +74 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.24 — 2026-11-05
|
|
4
|
+
|
|
5
|
+
- Added per-model capability/thinking overrides (`modelOverrides`) for
|
|
6
|
+
context, vision, thinking, reasoning efforts/default and enabled; the
|
|
7
|
+
override wins over manual entries and live discovery. Disabled models are
|
|
8
|
+
hidden from the picker.
|
|
9
|
+
- Added a model override editor exposing context, input/output/cacheRead
|
|
10
|
+
prices, visibility, vision/thinking/enabled tri-state and reset-to-live.
|
|
11
|
+
- `/api/show` capability probes remain TTL-cached and are invalidated on local
|
|
12
|
+
pull/remove.
|
|
13
|
+
- Added override precedence and validation tests; 129/129.
|
|
14
|
+
|
|
3
15
|
## 0.1.23 — 2026-11-05
|
|
4
16
|
|
|
5
17
|
- Richer model catalog rows grouped by effective context, collapsible groups,
|
package/README.md
CHANGED
|
@@ -137,17 +137,17 @@ npm pack
|
|
|
137
137
|
Install the published package:
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
140
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.24
|
|
141
141
|
# DSH Desktop:
|
|
142
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
142
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.24
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
Or install the packed tarball into a profile:
|
|
146
146
|
|
|
147
147
|
```bash
|
|
148
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
148
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
|
|
149
149
|
# DSH Desktop:
|
|
150
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
150
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
Restart dsh (or DSH Desktop), then pick **Ollama Cloud** in the model picker.
|
package/README.ru.md
CHANGED
|
@@ -103,17 +103,17 @@ npm pack
|
|
|
103
103
|
Установка опубликованного пакета из npm:
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
106
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.24
|
|
107
107
|
# DSH Desktop:
|
|
108
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
108
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.24
|
|
109
109
|
```
|
|
110
110
|
|
|
111
111
|
Либо установка из упакованного tarball:
|
|
112
112
|
|
|
113
113
|
```bash
|
|
114
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
114
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
|
|
115
115
|
# DSH Desktop:
|
|
116
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
116
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
После установки перезапустите dsh (или DSH Desktop) и выберите **Ollama Cloud** в списке моделей.
|
package/README.zh.md
CHANGED
|
@@ -102,17 +102,17 @@ npm pack
|
|
|
102
102
|
从 npm 安装已发布版本:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
|
-
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
105
|
+
dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.24
|
|
106
106
|
# DSH 桌面端:
|
|
107
|
-
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.
|
|
107
|
+
dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.24
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
或通过打包文件安装:
|
|
111
111
|
|
|
112
112
|
```bash
|
|
113
|
-
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
113
|
+
dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
|
|
114
114
|
# DSH 桌面端:
|
|
115
|
-
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.
|
|
115
|
+
dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.24.tgz
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
|
package/lib/client.js
CHANGED
|
@@ -137,6 +137,18 @@ window.__ModuleLoader__.load({
|
|
|
137
137
|
manualEffortsHint: "Comma-separated levels, e.g. off, low, medium, high.",
|
|
138
138
|
defaultReasoning: "Default effort",
|
|
139
139
|
enabled: "Enabled",
|
|
140
|
+
edit: "Edit",
|
|
141
|
+
overrideEditor: "Model overrides",
|
|
142
|
+
resetToLive: "Reset to live",
|
|
143
|
+
priceInput: "Input $/1M",
|
|
144
|
+
priceOutput: "Output $/1M",
|
|
145
|
+
priceCacheRead: "Cache read $/1M",
|
|
146
|
+
visibility: "Visibility",
|
|
147
|
+
inherit: "Inherit",
|
|
148
|
+
show: "Show",
|
|
149
|
+
hide: "Hide",
|
|
150
|
+
yes: "Yes",
|
|
151
|
+
no: "No",
|
|
140
152
|
generation: "Generation defaults",
|
|
141
153
|
generationHint: "Native Ollama defaults. Empty fields are not sent; request options still win.",
|
|
142
154
|
temperature: "Temperature",
|
|
@@ -362,6 +374,18 @@ window.__ModuleLoader__.load({
|
|
|
362
374
|
manualEffortsHint: "逗号分隔,例如 off, low, medium, high。",
|
|
363
375
|
defaultReasoning: "默认档位",
|
|
364
376
|
enabled: "启用",
|
|
377
|
+
edit: "编辑",
|
|
378
|
+
overrideEditor: "模型覆盖",
|
|
379
|
+
resetToLive: "恢复实时值",
|
|
380
|
+
priceInput: "输入 $/1M",
|
|
381
|
+
priceOutput: "输出 $/1M",
|
|
382
|
+
priceCacheRead: "缓存读取 $/1M",
|
|
383
|
+
visibility: "可见性",
|
|
384
|
+
inherit: "继承",
|
|
385
|
+
show: "显示",
|
|
386
|
+
hide: "隐藏",
|
|
387
|
+
yes: "是",
|
|
388
|
+
no: "否",
|
|
365
389
|
generation: "生成默认值",
|
|
366
390
|
generationHint: "Ollama 原生默认值;空字段不发送,请求参数优先。",
|
|
367
391
|
temperature: "Temperature",
|
|
@@ -1715,6 +1739,20 @@ window.__ModuleLoader__.load({
|
|
|
1715
1739
|
tools: model.tools === true
|
|
1716
1740
|
})),
|
|
1717
1741
|
modelOrder: [...state.config.modelOrder ?? []],
|
|
1742
|
+
contextWindowOverrides: Object.fromEntries(Object.entries(state.config.contextWindowOverrides).map(([id, value]) => [id, String(value)])),
|
|
1743
|
+
priceOverrides: Object.fromEntries(Object.entries(state.config.priceOverrides).map(([id, price]) => [id, {
|
|
1744
|
+
input: price.input === void 0 ? "" : String(price.input),
|
|
1745
|
+
output: price.output === void 0 ? "" : String(price.output),
|
|
1746
|
+
cacheRead: price.cacheRead === void 0 ? "" : String(price.cacheRead)
|
|
1747
|
+
}])),
|
|
1748
|
+
modelOverrides: Object.fromEntries(Object.entries(state.config.modelOverrides ?? {}).map(([id, override]) => [id, {
|
|
1749
|
+
contextWindow: override.contextWindow === void 0 ? "" : String(override.contextWindow),
|
|
1750
|
+
image: override.image === void 0 ? "" : override.image ? "yes" : "no",
|
|
1751
|
+
thinking: override.thinking === void 0 ? "" : override.thinking ? "yes" : "no",
|
|
1752
|
+
reasoningEfforts: (override.reasoningEfforts ?? []).join(", "),
|
|
1753
|
+
defaultEffort: override.defaultEffort ?? "",
|
|
1754
|
+
enabled: override.enabled === void 0 ? "" : override.enabled ? "yes" : "no"
|
|
1755
|
+
}])),
|
|
1718
1756
|
showAll: state.config.showAllModels,
|
|
1719
1757
|
modelTransports: { ...state.config.modelTransports }
|
|
1720
1758
|
};
|
|
@@ -1790,6 +1828,27 @@ window.__ModuleLoader__.load({
|
|
|
1790
1828
|
tools: model.tools
|
|
1791
1829
|
})),
|
|
1792
1830
|
modelOrder: draft.modelOrder.filter((id) => id !== ""),
|
|
1831
|
+
contextWindowOverrides: Object.fromEntries(Object.entries(draft.contextWindowOverrides).map(([id, value]) => [id, numberOrNull(value)]).filter((entry) => entry[1] !== null && entry[1] > 0)),
|
|
1832
|
+
priceOverrides: Object.fromEntries(Object.entries(draft.priceOverrides).map(([id, price]) => {
|
|
1833
|
+
const out = {};
|
|
1834
|
+
for (const [field, value] of Object.entries(price)) {
|
|
1835
|
+
const parsed = numberOrNull(value);
|
|
1836
|
+
if (parsed !== null) out[field] = parsed;
|
|
1837
|
+
}
|
|
1838
|
+
return [id, out];
|
|
1839
|
+
}).filter((entry) => Object.keys(entry[1]).length > 0)),
|
|
1840
|
+
modelOverrides: Object.fromEntries(Object.entries(draft.modelOverrides).map(([id, override]) => {
|
|
1841
|
+
const contextWindow = numberOrNull(override.contextWindow);
|
|
1842
|
+
const efforts = stopList(override.reasoningEfforts);
|
|
1843
|
+
return [id, {
|
|
1844
|
+
...contextWindow === null || contextWindow <= 0 ? {} : { contextWindow },
|
|
1845
|
+
...override.image === "" ? {} : { image: override.image === "yes" },
|
|
1846
|
+
...override.thinking === "" ? {} : { thinking: override.thinking === "yes" },
|
|
1847
|
+
...efforts.length === 0 ? {} : { reasoningEfforts: efforts },
|
|
1848
|
+
...override.defaultEffort.trim() === "" ? {} : { defaultEffort: override.defaultEffort.trim() },
|
|
1849
|
+
...override.enabled === "" ? {} : { enabled: override.enabled === "yes" }
|
|
1850
|
+
}];
|
|
1851
|
+
}).filter((entry) => Object.keys(entry[1]).length > 0)),
|
|
1793
1852
|
modelTransports: Object.fromEntries(Object.entries(draft.modelTransports).filter(([, value]) => value !== ""))
|
|
1794
1853
|
};
|
|
1795
1854
|
}
|
|
@@ -2081,6 +2140,219 @@ window.__ModuleLoader__.load({
|
|
|
2081
2140
|
base.splice(insertAt, 0, moved);
|
|
2082
2141
|
return base;
|
|
2083
2142
|
}
|
|
2143
|
+
// src/client/model-override-editor.tsx
|
|
2144
|
+
const blankOverride = {
|
|
2145
|
+
contextWindow: "",
|
|
2146
|
+
image: "",
|
|
2147
|
+
thinking: "",
|
|
2148
|
+
reasoningEfforts: "",
|
|
2149
|
+
defaultEffort: "",
|
|
2150
|
+
enabled: ""
|
|
2151
|
+
};
|
|
2152
|
+
function ModelOverrideEditor(props) {
|
|
2153
|
+
const { model, draft, t, update, close } = props;
|
|
2154
|
+
const override = draft.modelOverrides[model.id] ?? blankOverride;
|
|
2155
|
+
const price = draft.priceOverrides[model.id] ?? {
|
|
2156
|
+
input: "",
|
|
2157
|
+
output: "",
|
|
2158
|
+
cacheRead: ""
|
|
2159
|
+
};
|
|
2160
|
+
const context = draft.contextWindowOverrides[model.id] ?? "";
|
|
2161
|
+
const visibility = draft.modelVisibility[model.id];
|
|
2162
|
+
const updateOverride = (patch) => {
|
|
2163
|
+
update({ modelOverrides: {
|
|
2164
|
+
...draft.modelOverrides,
|
|
2165
|
+
[model.id]: {
|
|
2166
|
+
...override,
|
|
2167
|
+
...patch
|
|
2168
|
+
}
|
|
2169
|
+
} });
|
|
2170
|
+
};
|
|
2171
|
+
const updatePrice = (patch) => {
|
|
2172
|
+
update({ priceOverrides: {
|
|
2173
|
+
...draft.priceOverrides,
|
|
2174
|
+
[model.id]: {
|
|
2175
|
+
...price,
|
|
2176
|
+
...patch
|
|
2177
|
+
}
|
|
2178
|
+
} });
|
|
2179
|
+
};
|
|
2180
|
+
const updateVisibility = (value) => {
|
|
2181
|
+
const next = { ...draft.modelVisibility };
|
|
2182
|
+
if (value === "inherit") delete next[model.id];
|
|
2183
|
+
else next[model.id] = value === "show";
|
|
2184
|
+
update({ modelVisibility: next });
|
|
2185
|
+
};
|
|
2186
|
+
const reset = () => {
|
|
2187
|
+
const nextContext = { ...draft.contextWindowOverrides };
|
|
2188
|
+
const nextPrice = { ...draft.priceOverrides };
|
|
2189
|
+
const nextVisibility = { ...draft.modelVisibility };
|
|
2190
|
+
const nextOverrides = { ...draft.modelOverrides };
|
|
2191
|
+
delete nextContext[model.id];
|
|
2192
|
+
delete nextPrice[model.id];
|
|
2193
|
+
delete nextVisibility[model.id];
|
|
2194
|
+
delete nextOverrides[model.id];
|
|
2195
|
+
update({
|
|
2196
|
+
contextWindowOverrides: nextContext,
|
|
2197
|
+
priceOverrides: nextPrice,
|
|
2198
|
+
modelVisibility: nextVisibility,
|
|
2199
|
+
modelOverrides: nextOverrides
|
|
2200
|
+
});
|
|
2201
|
+
};
|
|
2202
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
2203
|
+
className: "ocl-model-section",
|
|
2204
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2205
|
+
className: "ocl-model-section-head",
|
|
2206
|
+
children: [
|
|
2207
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
|
|
2208
|
+
t("overrideEditor"),
|
|
2209
|
+
": ",
|
|
2210
|
+
model.id
|
|
2211
|
+
] }),
|
|
2212
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2213
|
+
type: "button",
|
|
2214
|
+
className: "ocl-button",
|
|
2215
|
+
onClick: reset,
|
|
2216
|
+
children: t("resetToLive")
|
|
2217
|
+
}),
|
|
2218
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2219
|
+
type: "button",
|
|
2220
|
+
className: "ocl-button",
|
|
2221
|
+
onClick: close,
|
|
2222
|
+
children: t("close")
|
|
2223
|
+
})
|
|
2224
|
+
]
|
|
2225
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2226
|
+
className: "ocl-grid",
|
|
2227
|
+
children: [
|
|
2228
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2229
|
+
label: t("contextWindow"),
|
|
2230
|
+
value: context,
|
|
2231
|
+
onChange: (value) => update({ contextWindowOverrides: {
|
|
2232
|
+
...draft.contextWindowOverrides,
|
|
2233
|
+
[model.id]: value
|
|
2234
|
+
} })
|
|
2235
|
+
}),
|
|
2236
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2237
|
+
label: t("priceInput"),
|
|
2238
|
+
type: "number",
|
|
2239
|
+
value: price.input,
|
|
2240
|
+
onChange: (value) => updatePrice({ input: value })
|
|
2241
|
+
}),
|
|
2242
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2243
|
+
label: t("priceOutput"),
|
|
2244
|
+
type: "number",
|
|
2245
|
+
value: price.output,
|
|
2246
|
+
onChange: (value) => updatePrice({ output: value })
|
|
2247
|
+
}),
|
|
2248
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2249
|
+
label: t("priceCacheRead"),
|
|
2250
|
+
type: "number",
|
|
2251
|
+
value: price.cacheRead,
|
|
2252
|
+
onChange: (value) => updatePrice({ cacheRead: value })
|
|
2253
|
+
}),
|
|
2254
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
2255
|
+
className: "ocl-field",
|
|
2256
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("visibility") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
2257
|
+
className: "ocl-select",
|
|
2258
|
+
value: visibility === void 0 ? "inherit" : visibility ? "show" : "hide",
|
|
2259
|
+
onChange: (event) => updateVisibility(event.target.value),
|
|
2260
|
+
children: [
|
|
2261
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2262
|
+
value: "inherit",
|
|
2263
|
+
children: t("inherit")
|
|
2264
|
+
}),
|
|
2265
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2266
|
+
value: "show",
|
|
2267
|
+
children: t("show")
|
|
2268
|
+
}),
|
|
2269
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2270
|
+
value: "hide",
|
|
2271
|
+
children: t("hide")
|
|
2272
|
+
})
|
|
2273
|
+
]
|
|
2274
|
+
})]
|
|
2275
|
+
}),
|
|
2276
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
2277
|
+
className: "ocl-field",
|
|
2278
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("vision") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
2279
|
+
className: "ocl-select",
|
|
2280
|
+
value: override.image,
|
|
2281
|
+
onChange: (event) => updateOverride({ image: event.target.value }),
|
|
2282
|
+
children: [
|
|
2283
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2284
|
+
value: "",
|
|
2285
|
+
children: t("inherit")
|
|
2286
|
+
}),
|
|
2287
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2288
|
+
value: "yes",
|
|
2289
|
+
children: t("yes")
|
|
2290
|
+
}),
|
|
2291
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2292
|
+
value: "no",
|
|
2293
|
+
children: t("no")
|
|
2294
|
+
})
|
|
2295
|
+
]
|
|
2296
|
+
})]
|
|
2297
|
+
}),
|
|
2298
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
2299
|
+
className: "ocl-field",
|
|
2300
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("reasoning") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
2301
|
+
className: "ocl-select",
|
|
2302
|
+
value: override.thinking,
|
|
2303
|
+
onChange: (event) => updateOverride({ thinking: event.target.value }),
|
|
2304
|
+
children: [
|
|
2305
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2306
|
+
value: "",
|
|
2307
|
+
children: t("inherit")
|
|
2308
|
+
}),
|
|
2309
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2310
|
+
value: "yes",
|
|
2311
|
+
children: t("yes")
|
|
2312
|
+
}),
|
|
2313
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2314
|
+
value: "no",
|
|
2315
|
+
children: t("no")
|
|
2316
|
+
})
|
|
2317
|
+
]
|
|
2318
|
+
})]
|
|
2319
|
+
}),
|
|
2320
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
2321
|
+
className: "ocl-field",
|
|
2322
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("enabled") }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
2323
|
+
className: "ocl-select",
|
|
2324
|
+
value: override.enabled,
|
|
2325
|
+
onChange: (event) => updateOverride({ enabled: event.target.value }),
|
|
2326
|
+
children: [
|
|
2327
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2328
|
+
value: "",
|
|
2329
|
+
children: t("inherit")
|
|
2330
|
+
}),
|
|
2331
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2332
|
+
value: "yes",
|
|
2333
|
+
children: t("yes")
|
|
2334
|
+
}),
|
|
2335
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2336
|
+
value: "no",
|
|
2337
|
+
children: t("no")
|
|
2338
|
+
})
|
|
2339
|
+
]
|
|
2340
|
+
})]
|
|
2341
|
+
}),
|
|
2342
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2343
|
+
label: t("reasoningEfforts"),
|
|
2344
|
+
value: override.reasoningEfforts,
|
|
2345
|
+
onChange: (value) => updateOverride({ reasoningEfforts: value })
|
|
2346
|
+
}),
|
|
2347
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
|
|
2348
|
+
label: t("defaultReasoning"),
|
|
2349
|
+
value: override.defaultEffort,
|
|
2350
|
+
onChange: (value) => updateOverride({ defaultEffort: value })
|
|
2351
|
+
})
|
|
2352
|
+
]
|
|
2353
|
+
})]
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2084
2356
|
// src/client/update-state.ts
|
|
2085
2357
|
function updateBadge(status) {
|
|
2086
2358
|
if (status.latestCheckFailed) return "failed";
|
|
@@ -2201,7 +2473,7 @@ window.__ModuleLoader__.load({
|
|
|
2201
2473
|
}
|
|
2202
2474
|
// src/client/settings-page.tsx
|
|
2203
2475
|
function ModelEntry(props) {
|
|
2204
|
-
const { model, visible, transport, onVisible, onTransport, onDragStart, onDrop, dragging, t } = props;
|
|
2476
|
+
const { model, visible, transport, onVisible, onTransport, onDragStart, onDrop, onEdit, dragging, t } = props;
|
|
2205
2477
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2206
2478
|
className: `ocl-model${dragging === true ? " ocl-dragging" : ""}`,
|
|
2207
2479
|
draggable: onDragStart !== void 0,
|
|
@@ -2276,6 +2548,12 @@ window.__ModuleLoader__.load({
|
|
|
2276
2548
|
})
|
|
2277
2549
|
]
|
|
2278
2550
|
}),
|
|
2551
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2552
|
+
type: "button",
|
|
2553
|
+
className: "ocl-button",
|
|
2554
|
+
onClick: onEdit,
|
|
2555
|
+
children: t("edit")
|
|
2556
|
+
}),
|
|
2279
2557
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
2280
2558
|
className: "ocl-select",
|
|
2281
2559
|
value: transport === "" ? model.transport : transport,
|
|
@@ -2303,6 +2581,7 @@ window.__ModuleLoader__.load({
|
|
|
2303
2581
|
const [saving, setSaving] = (0, react.useState)(false);
|
|
2304
2582
|
const [search, setSearch] = (0, react.useState)("");
|
|
2305
2583
|
const [dragId, setDragId] = (0, react.useState)(null);
|
|
2584
|
+
const [editingModel, setEditingModel] = (0, react.useState)(null);
|
|
2306
2585
|
const [collapsedGroups, setCollapsedGroups] = (0, react.useState)({});
|
|
2307
2586
|
const [keyDraft, setKeyDraft] = (0, react.useState)("");
|
|
2308
2587
|
const [accountKeys, setAccountKeys] = (0, react.useState)({});
|
|
@@ -3084,6 +3363,7 @@ window.__ModuleLoader__.load({
|
|
|
3084
3363
|
if (dragId !== null) moveModel(dragId, model.id);
|
|
3085
3364
|
setDragId(null);
|
|
3086
3365
|
},
|
|
3366
|
+
onEdit: () => setEditingModel(model.id),
|
|
3087
3367
|
onVisible: (visible) => toggleModel(model.id, visible),
|
|
3088
3368
|
onTransport: (transport) => {
|
|
3089
3369
|
const next = { ...draft.modelTransports };
|
|
@@ -3097,6 +3377,16 @@ window.__ModuleLoader__.load({
|
|
|
3097
3377
|
})
|
|
3098
3378
|
]
|
|
3099
3379
|
}),
|
|
3380
|
+
editingModel !== null && state.models.some((model) => model.id === editingModel) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
3381
|
+
className: "ocl-card",
|
|
3382
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelOverrideEditor, {
|
|
3383
|
+
model: state.models.find((model) => model.id === editingModel),
|
|
3384
|
+
draft,
|
|
3385
|
+
t,
|
|
3386
|
+
update,
|
|
3387
|
+
close: () => setEditingModel(null)
|
|
3388
|
+
})
|
|
3389
|
+
}),
|
|
3100
3390
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3101
3391
|
className: "ocl-card",
|
|
3102
3392
|
children: [
|
|
@@ -3534,7 +3824,7 @@ window.__ModuleLoader__.load({
|
|
|
3534
3824
|
.ocl-bar-fill-warn { background: var(--ocl-warning); opacity: 1; }
|
|
3535
3825
|
.ocl-bar-fill-bad { background: var(--ocl-danger); opacity: 1; }
|
|
3536
3826
|
.ocl-models { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow: auto; padding-right: 4px; }
|
|
3537
|
-
.ocl-model { display: grid; grid-template-columns: 16px 22px minmax(0,1fr) 120px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
|
|
3827
|
+
.ocl-model { display: grid; grid-template-columns: 16px 22px minmax(0,1fr) auto 120px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
|
|
3538
3828
|
.ocl-drag-handle { cursor: grab; color: var(--ocl-text-secondary); user-select: none; }
|
|
3539
3829
|
.ocl-dragging { opacity: 0.5; }
|
|
3540
3830
|
.ocl-model-group { display: flex; flex-direction: column; gap: 2px; }
|
package/lib/index.d.ts
CHANGED
|
@@ -23,6 +23,14 @@ interface ModelPriceOverride {
|
|
|
23
23
|
* Plugin configuration. Every field except the literal `apiKey` is volatile:
|
|
24
24
|
* the harness projects settings forms from schema fields carrying that marker.
|
|
25
25
|
*/
|
|
26
|
+
interface ModelOverride {
|
|
27
|
+
contextWindow?: number;
|
|
28
|
+
image?: boolean;
|
|
29
|
+
thinking?: boolean;
|
|
30
|
+
reasoningEfforts?: string[];
|
|
31
|
+
defaultEffort?: string;
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
}
|
|
26
34
|
interface ManualModel {
|
|
27
35
|
id: string;
|
|
28
36
|
enabled?: boolean;
|
|
@@ -66,6 +74,8 @@ interface Config {
|
|
|
66
74
|
modelVisibility?: Record<string, boolean>;
|
|
67
75
|
/** Manual catalog entries and overrides; merged over live discovery. */
|
|
68
76
|
manualModels?: ManualModel[];
|
|
77
|
+
/** Per-model capability/thinking overrides; wins over manual entries. */
|
|
78
|
+
modelOverrides?: Record<string, ModelOverride>;
|
|
69
79
|
/** Stable picker order; ids not listed follow by name. */
|
|
70
80
|
modelOrder?: string[];
|
|
71
81
|
/** Hide models the cloud marks unsupported in the API; defaults to true. */
|
|
@@ -125,6 +135,7 @@ interface ResolvedConfig {
|
|
|
125
135
|
showAllModels: boolean;
|
|
126
136
|
modelVisibility: Readonly<Record<string, boolean>>;
|
|
127
137
|
manualModels: readonly ManualModel[];
|
|
138
|
+
modelOverrides: Readonly<Record<string, ModelOverride>>;
|
|
128
139
|
modelOrder: readonly string[];
|
|
129
140
|
filterModelsByPlan: boolean;
|
|
130
141
|
contextWindow?: number;
|
package/lib/index.js
CHANGED
|
@@ -77,7 +77,7 @@ const DEFAULT_API_BASE = "https://ollama.com";
|
|
|
77
77
|
const DEFAULT_OPENAI_BASE = "https://ollama.com/v1";
|
|
78
78
|
const DEFAULT_USAGE_URL = "https://ollama.com/api/usage";
|
|
79
79
|
const DEFAULT_BALANCE_URL = "https://ollama.com/api/balance";
|
|
80
|
-
const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.
|
|
80
|
+
const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.24";
|
|
81
81
|
const DEFAULT_CONTEXT_WINDOW = 131072;
|
|
82
82
|
const DEFAULT_MAX_TOKENS = 32768;
|
|
83
83
|
const DEFAULT_GENERATE_MAX_TOKENS = 131072;
|
|
@@ -112,6 +112,14 @@ const Config = z.object({
|
|
|
112
112
|
defaultReasoning: z.string(),
|
|
113
113
|
tools: z.boolean()
|
|
114
114
|
})).default([])),
|
|
115
|
+
modelOverrides: markVolatile(z.dict(z.object({
|
|
116
|
+
contextWindow: z.number().min(1).max(1e7).step(1),
|
|
117
|
+
image: z.boolean(),
|
|
118
|
+
thinking: z.boolean(),
|
|
119
|
+
reasoningEfforts: z.array(z.string()),
|
|
120
|
+
defaultEffort: z.string(),
|
|
121
|
+
enabled: z.boolean()
|
|
122
|
+
})).default({})),
|
|
115
123
|
modelOrder: markVolatile(z.array(z.string()).default([])),
|
|
116
124
|
filterModelsByPlan: markVolatile(z.boolean().default(true)),
|
|
117
125
|
contextWindow: markVolatile(z.number().min(1).max(1e7).step(1)),
|
|
@@ -174,6 +182,29 @@ function nonEmptyStrings(value) {
|
|
|
174
182
|
const out = value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
|
|
175
183
|
return out.length === 0 ? void 0 : out;
|
|
176
184
|
}
|
|
185
|
+
function modelOverrideRecord(value) {
|
|
186
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
187
|
+
const out = {};
|
|
188
|
+
for (const [id, entry] of Object.entries(value)) {
|
|
189
|
+
if (id === "" || id.includes("..") || typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
|
|
190
|
+
const record = entry;
|
|
191
|
+
const contextWindow = integerInRange(record.contextWindow, 1, 1e7);
|
|
192
|
+
const efforts = Array.isArray(record.reasoningEfforts) ? record.reasoningEfforts.filter((item) => typeof item === "string" && item.trim() !== "") : void 0;
|
|
193
|
+
const thinking = typeof record.thinking === "boolean" ? record.thinking : void 0;
|
|
194
|
+
const normalizedEfforts = thinking === true && (efforts === void 0 || efforts.length === 0) ? ["off", "high"] : thinking === false ? [] : efforts;
|
|
195
|
+
const defaultEffort = typeof record.defaultEffort === "string" && record.defaultEffort.trim() !== "" ? record.defaultEffort.trim() : void 0;
|
|
196
|
+
if (contextWindow === void 0 && typeof record.image !== "boolean" && thinking === void 0 && efforts === void 0 && defaultEffort === void 0 && typeof record.enabled !== "boolean") continue;
|
|
197
|
+
out[id] = {
|
|
198
|
+
...contextWindow === void 0 ? {} : { contextWindow },
|
|
199
|
+
...typeof record.image === "boolean" ? { image: record.image } : {},
|
|
200
|
+
...thinking === void 0 ? {} : { thinking },
|
|
201
|
+
...normalizedEfforts === void 0 ? {} : { reasoningEfforts: normalizedEfforts },
|
|
202
|
+
...defaultEffort === void 0 ? {} : { defaultEffort },
|
|
203
|
+
...typeof record.enabled === "boolean" ? { enabled: record.enabled } : {}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
177
208
|
function manualModelList(value) {
|
|
178
209
|
if (!Array.isArray(value)) return [];
|
|
179
210
|
const out = [];
|
|
@@ -278,6 +309,7 @@ function resolveConfig(config) {
|
|
|
278
309
|
showAllModels: config.showAllModels === true ? true : config.showAllModels === false ? false : visibleModels.length === 0,
|
|
279
310
|
modelVisibility: booleanRecord(config.modelVisibility),
|
|
280
311
|
manualModels: manualModelList(config.manualModels),
|
|
312
|
+
modelOverrides: modelOverrideRecord(config.modelOverrides),
|
|
281
313
|
modelOrder: Array.isArray(config.modelOrder) ? config.modelOrder.filter((id) => typeof id === "string" && id !== "") : [],
|
|
282
314
|
filterModelsByPlan: config.filterModelsByPlan !== false,
|
|
283
315
|
...typeof config.contextWindow === "number" && Number.isInteger(config.contextWindow) && config.contextWindow > 0 ? { contextWindow: config.contextWindow } : {},
|
|
@@ -1399,18 +1431,19 @@ function manualModelFor(id, config) {
|
|
|
1399
1431
|
function effectiveModel(id, config) {
|
|
1400
1432
|
const meta = baseMeta(id, config.apiBase);
|
|
1401
1433
|
const manual = manualModelFor(id, config);
|
|
1434
|
+
const override = config.modelOverrides[id];
|
|
1402
1435
|
return {
|
|
1403
1436
|
...meta,
|
|
1404
1437
|
name: manual?.name ?? meta.name,
|
|
1405
1438
|
transport: config.modelTransports[id] ?? config.transport,
|
|
1406
|
-
contextWindow: config.contextWindowOverrides[id] ?? manual?.contextWindow ?? config.contextWindow ?? meta.contextWindow,
|
|
1439
|
+
contextWindow: config.contextWindowOverrides[id] ?? override?.contextWindow ?? manual?.contextWindow ?? config.contextWindow ?? meta.contextWindow,
|
|
1407
1440
|
maxTokens: manual?.maxTokens ?? meta.maxTokens,
|
|
1408
|
-
input: manual?.image === true ? ["text", "image"] : manual?.image === false ? ["text"] : meta.input,
|
|
1409
|
-
reasoning: manual?.reasoningEfforts ?? meta.reasoning,
|
|
1410
|
-
reasoningToggle: manual?.thinking ?? meta.reasoningToggle,
|
|
1411
|
-
...(manual?.defaultReasoning ?? meta.defaultReasoning) === void 0 ? {} : { defaultReasoning: manual?.defaultReasoning ?? meta.defaultReasoning },
|
|
1441
|
+
input: (override?.image ?? manual?.image) === true ? ["text", "image"] : (override?.image ?? manual?.image) === false ? ["text"] : meta.input,
|
|
1442
|
+
reasoning: override?.reasoningEfforts ?? manual?.reasoningEfforts ?? meta.reasoning,
|
|
1443
|
+
reasoningToggle: override?.thinking ?? manual?.thinking ?? meta.reasoningToggle,
|
|
1444
|
+
...(override?.defaultEffort ?? manual?.defaultReasoning ?? meta.defaultReasoning) === void 0 ? {} : { defaultReasoning: override?.defaultEffort ?? manual?.defaultReasoning ?? meta.defaultReasoning },
|
|
1412
1445
|
tools: manual?.tools ?? meta.tools,
|
|
1413
|
-
available: manual?.enabled === false ? false : meta.available
|
|
1446
|
+
available: override?.enabled === false || manual?.enabled === false ? false : meta.available
|
|
1414
1447
|
};
|
|
1415
1448
|
}
|
|
1416
1449
|
/** Effective per-request output default; `0` means "omit the field". */
|
|
@@ -1427,7 +1460,8 @@ function modelVisible(id, config) {
|
|
|
1427
1460
|
return config.visibleModels.includes(id);
|
|
1428
1461
|
}
|
|
1429
1462
|
function modelAvailable(id, config) {
|
|
1430
|
-
|
|
1463
|
+
const manual = manualModelFor(id, config);
|
|
1464
|
+
if (config.modelOverrides[id]?.enabled === false || manual?.enabled === false) return false;
|
|
1431
1465
|
if (!config.filterModelsByPlan) return true;
|
|
1432
1466
|
return effectiveModel(id, config).available !== false;
|
|
1433
1467
|
}
|
|
@@ -2822,7 +2856,11 @@ var OllamaCloudAdapter = class extends LlmAdapter {
|
|
|
2822
2856
|
async listModels(provider, opts) {
|
|
2823
2857
|
const config = this.deps.config();
|
|
2824
2858
|
const discovered = await refreshCatalog(config, this.fetchImpl);
|
|
2825
|
-
return sortForPicker([.../* @__PURE__ */ new Set([
|
|
2859
|
+
return sortForPicker([.../* @__PURE__ */ new Set([
|
|
2860
|
+
...discovered,
|
|
2861
|
+
...config.manualModels.map((model) => model.id),
|
|
2862
|
+
...Object.keys(config.modelOverrides)
|
|
2863
|
+
])], config, opts?.unfiltered === true).map((id) => {
|
|
2826
2864
|
const model = effectiveModel(id, config);
|
|
2827
2865
|
return {
|
|
2828
2866
|
provider,
|
|
@@ -4525,6 +4563,7 @@ function publicConfig(config) {
|
|
|
4525
4563
|
showAllModels: config.showAllModels,
|
|
4526
4564
|
modelVisibility: config.modelVisibility,
|
|
4527
4565
|
manualModels: config.manualModels,
|
|
4566
|
+
modelOverrides: config.modelOverrides,
|
|
4528
4567
|
modelOrder: config.modelOrder,
|
|
4529
4568
|
filterModelsByPlan: config.filterModelsByPlan,
|
|
4530
4569
|
contextWindow: config.contextWindow ?? null,
|
|
@@ -4668,6 +4707,27 @@ function cleanManualModels(value) {
|
|
|
4668
4707
|
}
|
|
4669
4708
|
return out;
|
|
4670
4709
|
}
|
|
4710
|
+
function cleanModelOverrides(value) {
|
|
4711
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
4712
|
+
const out = {};
|
|
4713
|
+
for (const [id, entry] of Object.entries(value)) {
|
|
4714
|
+
if (id === "" || id.includes("..") || typeof entry !== "object" || entry === null || Array.isArray(entry)) continue;
|
|
4715
|
+
const record = entry;
|
|
4716
|
+
const efforts = Array.isArray(record.reasoningEfforts) ? record.reasoningEfforts.filter((item) => typeof item === "string" && item.trim() !== "") : void 0;
|
|
4717
|
+
const thinking = typeof record.thinking === "boolean" ? record.thinking : void 0;
|
|
4718
|
+
const normalizedEfforts = thinking === true && (efforts === void 0 || efforts.length === 0) ? ["off", "high"] : thinking === false ? [] : efforts;
|
|
4719
|
+
const outEntry = {
|
|
4720
|
+
...typeof record.contextWindow === "number" && Number.isInteger(record.contextWindow) && record.contextWindow > 0 ? { contextWindow: record.contextWindow } : {},
|
|
4721
|
+
...typeof record.image === "boolean" ? { image: record.image } : {},
|
|
4722
|
+
...thinking === void 0 ? {} : { thinking },
|
|
4723
|
+
...normalizedEfforts === void 0 ? {} : { reasoningEfforts: normalizedEfforts },
|
|
4724
|
+
...typeof record.defaultEffort === "string" && record.defaultEffort.trim() !== "" ? { defaultEffort: record.defaultEffort.trim() } : {},
|
|
4725
|
+
...typeof record.enabled === "boolean" ? { enabled: record.enabled } : {}
|
|
4726
|
+
};
|
|
4727
|
+
if (Object.keys(outEntry).length > 0) out[id] = outEntry;
|
|
4728
|
+
}
|
|
4729
|
+
return out;
|
|
4730
|
+
}
|
|
4671
4731
|
function cleanBooleanRecord(value) {
|
|
4672
4732
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return {};
|
|
4673
4733
|
const out = {};
|
|
@@ -4895,6 +4955,7 @@ function configOps(patch) {
|
|
|
4895
4955
|
if ("modelVisibility" in patch) set("modelVisibility", cleanBooleanRecord(patch.modelVisibility));
|
|
4896
4956
|
if ("manualModels" in patch) set("manualModels", cleanManualModels(patch.manualModels));
|
|
4897
4957
|
if ("modelOrder" in patch) set("modelOrder", cleanStringArray(patch.modelOrder));
|
|
4958
|
+
if ("modelOverrides" in patch) set("modelOverrides", cleanModelOverrides(patch.modelOverrides));
|
|
4898
4959
|
if ("filterModelsByPlan" in patch) set("filterModelsByPlan", patch.filterModelsByPlan === true);
|
|
4899
4960
|
if ("contextWindow" in patch) set("contextWindow", patch.contextWindow);
|
|
4900
4961
|
if ("contextWindowOverrides" in patch) set("contextWindowOverrides", cleanNumberRecord(patch.contextWindowOverrides));
|
|
@@ -5290,8 +5351,10 @@ function applyRoutes(ctx, web, deps) {
|
|
|
5290
5351
|
res.write(`${JSON.stringify(value)}\n`);
|
|
5291
5352
|
};
|
|
5292
5353
|
try {
|
|
5354
|
+
const last = await pullLocalModel(config, model, write, deps.localFetch);
|
|
5355
|
+
clearModelProbeCache(config.apiBase);
|
|
5293
5356
|
write({
|
|
5294
|
-
status:
|
|
5357
|
+
status: last.status,
|
|
5295
5358
|
done: true
|
|
5296
5359
|
});
|
|
5297
5360
|
} catch (error) {
|
|
@@ -5320,6 +5383,7 @@ function applyRoutes(ctx, web, deps) {
|
|
|
5320
5383
|
const model = typeof body.model === "string" ? body.model : "";
|
|
5321
5384
|
try {
|
|
5322
5385
|
await removeLocalModel(config, model, deps.localFetch);
|
|
5386
|
+
clearModelProbeCache(config.apiBase);
|
|
5323
5387
|
json(res, 200, {
|
|
5324
5388
|
ok: true,
|
|
5325
5389
|
model
|