dsh-opencode-go 0.1.14 → 0.1.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/README.en.md +39 -7
- package/README.md +39 -7
- package/docs/development.md +64 -0
- package/docs/fork-review-2026-09-25.md +191 -0
- package/docs/independent-package.md +2 -0
- package/docs/verification.md +84 -0
- package/lib/client.js +343 -241
- package/lib/index.js +176 -48
- package/lib/types/adapter.d.ts +2 -0
- package/lib/types/catalog.d.ts +12 -1
- package/lib/types/client/Section.d.ts +6 -5
- package/lib/types/client/locales.d.ts +13 -1
- package/lib/types/client/section-controller.d.ts +4 -0
- package/lib/types/client/staged-form.d.ts +4 -3
- package/lib/types/config.d.ts +2 -0
- package/lib/types/conversion/context.d.ts +3 -1
- package/lib/types/conversion/image-offload.d.ts +1 -0
- package/lib/types/metadata-cache.d.ts +12 -0
- package/lib/types/model-metadata.d.ts +3 -1
- package/lib/types/models-contract.d.ts +15 -0
- package/package.json +26 -17
package/lib/client.js
CHANGED
|
@@ -47,6 +47,13 @@ var import_react = require("react");
|
|
|
47
47
|
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
48
48
|
|
|
49
49
|
// src/models-contract.ts
|
|
50
|
+
var INPUT_MODALITIES = ["text", "image", "audio", "video", "pdf"];
|
|
51
|
+
function normalizeInputModalities(value) {
|
|
52
|
+
if (!Array.isArray(value)) return void 0;
|
|
53
|
+
const declared = new Set(value.filter((item) => typeof item === "string").map((item) => item.toLowerCase()));
|
|
54
|
+
const ordered = INPUT_MODALITIES.filter((modality) => declared.has(modality));
|
|
55
|
+
return ordered.length === 0 ? void 0 : ordered;
|
|
56
|
+
}
|
|
50
57
|
function isModelEnabled(model, modelVisibility) {
|
|
51
58
|
if (model.configurationMissing) return false;
|
|
52
59
|
const enabled = modelVisibility && Object.hasOwn(modelVisibility, model.id) ? modelVisibility[model.id] : void 0;
|
|
@@ -78,6 +85,8 @@ function parseGoModels(value) {
|
|
|
78
85
|
if (typeof row.deprecated === "boolean") model.deprecated = row.deprecated;
|
|
79
86
|
if (typeof row.configurationMissing === "boolean") model.configurationMissing = row.configurationMissing;
|
|
80
87
|
if (validReleaseDate(row.releaseDate)) model.releaseDate = row.releaseDate;
|
|
88
|
+
const modalities = normalizeInputModalities(row.inputModalities);
|
|
89
|
+
if (modalities !== void 0) model.inputModalities = modalities;
|
|
81
90
|
return model;
|
|
82
91
|
});
|
|
83
92
|
}
|
|
@@ -130,19 +139,26 @@ var modelsRemote = {
|
|
|
130
139
|
}]
|
|
131
140
|
};
|
|
132
141
|
|
|
133
|
-
// plugin-css
|
|
142
|
+
// plugin-css:src/client/Section.module.css
|
|
134
143
|
var id = "dsh-opencode-go/Section.module.css";
|
|
135
144
|
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")) {
|
|
136
145
|
const style = document.createElement("style");
|
|
137
146
|
style.dataset.plugin = "dsh-opencode-go";
|
|
138
147
|
style.dataset.pluginCss = id;
|
|
139
|
-
style.textContent =
|
|
148
|
+
style.textContent = ".N807zW_page{flex-direction:column;min-width:0;height:100%;min-height:0;display:flex;container-type:size}.N807zW_pageBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;padding-right:4px;display:flex;overflow-y:auto}.N807zW_pageBody,.N807zW_modelList,.N807zW_modelDetails{scrollbar-width:thin;scrollbar-color:var(--dsw-alias-border-l3) transparent}.N807zW_pageBody::-webkit-scrollbar,.N807zW_modelList::-webkit-scrollbar,.N807zW_modelDetails::-webkit-scrollbar{width:8px;height:8px}.N807zW_pageBody::-webkit-scrollbar-track,.N807zW_modelList::-webkit-scrollbar-track,.N807zW_modelDetails::-webkit-scrollbar-track{background:0 0}.N807zW_pageBody::-webkit-scrollbar-thumb,.N807zW_modelList::-webkit-scrollbar-thumb,.N807zW_modelDetails::-webkit-scrollbar-thumb{background:var(--dsw-alias-border-l3);background-clip:content-box;border:2px solid #0000;border-radius:999px}.N807zW_pageBody:hover::-webkit-scrollbar-thumb,.N807zW_modelList:hover::-webkit-scrollbar-thumb,.N807zW_modelDetails:hover::-webkit-scrollbar-thumb{background:var(--dsw-alias-label-tertiary);background-clip:content-box}.N807zW_field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.N807zW_field+.N807zW_field{border-top:.5px solid var(--dsw-alias-border-l2)}.N807zW_head{align-items:center;gap:8px;display:flex}.N807zW_label{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.N807zW_badges{align-items:center;gap:8px;display:inline-flex}.N807zW_trailing{flex:none;align-items:center;gap:8px;display:inline-flex}.N807zW_reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.N807zW_reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.N807zW_reset:disabled{cursor:default}.N807zW_reset:focus-visible,.N807zW_cardTrigger:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.N807zW_input{border:.5px solid var(--dsw-alias-border-l4);background:var(--dsw-alias-bg-layer-3);height:34px;font:inherit;color:var(--dsw-alias-label-primary);border-radius:8px;padding:0 12px;font-size:13px;line-height:1.5}.N807zW_input:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px;border-color:var(--dsw-alias-brand-primary)}.N807zW_input:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}.N807zW_inputInvalid{border-color:var(--dsw-alias-label-error);}.N807zW_invalid{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.N807zW_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:1.5}.N807zW_pageTop{flex-direction:column;gap:3px;padding:2px 0 12px;display:flex}.N807zW_title{color:var(--dsw-alias-label-primary);margin:0;font-size:15px;font-weight:600;line-height:1.4}.N807zW_intro{color:var(--dsw-alias-label-secondary);margin:0;font-size:13px;line-height:1.5}.N807zW_card,.N807zW_cardModels{border:.5px solid var(--dsw-alias-border-l2);background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 40%, transparent);border-radius:12px;padding:8px 0 10px}.N807zW_card{flex:none}.N807zW_card+.N807zW_card,.N807zW_card+.N807zW_cardModels,.N807zW_cardModels+.N807zW_card{margin-top:8px}.N807zW_cardModels{flex-direction:column;flex:auto;max-height:720px;display:flex}.N807zW_cardHead{align-items:center;gap:8px;min-height:24px;padding:0 14px;display:flex}.N807zW_cardTitle{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13.5px;font-weight:600;line-height:1.5}.N807zW_cardSub{color:var(--dsw-alias-label-tertiary);flex:none;font-size:11.5px;line-height:1.5}.N807zW_cardBody{flex-direction:column;gap:8px;padding:4px 14px 0;display:flex}.N807zW_cardBody>.N807zW_input{box-sizing:border-box;width:100%}.N807zW_cardModels>.N807zW_cardBody{flex:auto}.N807zW_cardDivider{border-top:.5px solid var(--dsw-alias-border-l2);margin:10px 14px}.N807zW_cardTrigger{width:100%;min-height:24px;font:inherit;text-align:left;color:inherit;cursor:pointer;background:0 0;border:none;align-items:center;gap:8px;margin:0;padding:0 14px;display:flex}.N807zW_cardTrigger:hover .N807zW_cardTitle{color:var(--dsw-alias-brand-primary)}.N807zW_advancedGrid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px 18px;display:grid}.N807zW_advancedGrid .N807zW_field{padding:0}.N807zW_advancedGrid .N807zW_field+.N807zW_field{border-top:none}.N807zW_limitsEditor{flex-direction:column;flex:auto;gap:10px;padding-top:4px;display:flex}.N807zW_limitsSummary{color:var(--dsw-alias-label-tertiary);white-space:nowrap;padding-bottom:8px;font-size:12px;line-height:1.5}.N807zW_modelMeta{align-items:baseline;gap:10px;display:flex}.N807zW_modelMeta .N807zW_limitsModelId{flex:1;min-width:0}.N807zW_releaseDate{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;flex:none;font-size:11px;line-height:1.4}.N807zW_limitsModelId{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.4;display:block;overflow:hidden}.N807zW_visuallyHidden{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.N807zW_actions{border-top:.5px solid var(--dsw-alias-border-l2);flex-wrap:wrap;flex:none;align-items:center;gap:8px;padding:12px 0;display:flex}.N807zW_starLink{max-width:100%;color:var(--dsw-alias-label-secondary);border-radius:4px;align-items:center;gap:7px;margin-left:auto;padding:6px 0;font-size:12px;line-height:1.5;text-decoration:none;display:inline-flex}.N807zW_starLink svg{flex:none}.N807zW_starLink:hover{color:var(--dsw-alias-brand-primary)}.N807zW_starLink:hover span{text-underline-offset:3px;text-decoration:underline}.N807zW_starLink:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}.N807zW_failedNote{color:var(--dsw-alias-label-error);margin:0;font-size:12px;line-height:1.5}.N807zW_slot{width:16px;height:16px;color:var(--dsw-alias-label-tertiary);flex:none;justify-content:center;align-items:center;display:inline-flex}.N807zW_slot svg{width:15px;height:15px}.N807zW_chevron,.N807zW_chevronOpen{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .15s}.N807zW_chevron{transform:rotate(-90deg)}.N807zW_filters{flex-wrap:wrap;gap:6px;display:flex}.N807zW_filter{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:0;border-radius:6px;padding:6px 9px;font-size:12px}.N807zW_filter[aria-pressed=true]{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3)}.N807zW_filter span{color:var(--dsw-alias-label-tertiary);margin-left:4px}.N807zW_modelLayout{border:.5px solid var(--dsw-alias-border-l4);border-radius:10px;flex:auto;grid-template-columns:minmax(0,45fr) minmax(0,55fr);min-height:260px;max-height:560px;display:grid;overflow:hidden}.N807zW_modelList{border-right:.5px solid var(--dsw-alias-border-l2);min-height:0;padding:4px 6px;overflow-y:auto}.N807zW_modelRow{align-items:center;gap:8px;padding-right:6px;display:flex}.N807zW_modelRow+.N807zW_modelRow{border-top:.5px solid var(--dsw-alias-border-l2)}.N807zW_modelRowSelected{background:var(--dsw-alias-bg-layer-3);border-top-color:#0000;border-radius:6px}.N807zW_modelRow>[role=switch]{flex-shrink:0}.N807zW_modelChoice{text-align:left;min-width:0;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:0;border-radius:6px;flex:1;align-items:baseline;padding:9px 3px 9px 6px;display:flex}.N807zW_modelRow:hover:not(.N807zW_modelRowSelected){background:color-mix(in srgb, var(--dsw-alias-bg-layer-3) 92%, var(--dsw-alias-label-primary));border-top-color:#0000;border-radius:6px}.N807zW_modelName{overflow-wrap:anywhere;flex-wrap:wrap;flex:0 auto;align-items:center;gap:5px;min-width:0;font-size:13px;display:flex}.N807zW_overrideDot{background:var(--dsw-alias-brand-primary);border-radius:50%;flex:none;width:6px;height:6px}.N807zW_modelDetails{flex-direction:column;gap:10px;min-height:0;padding:14px;display:flex;overflow-y:auto}.N807zW_modelDetails h3{overflow-wrap:anywhere;margin:0;font-size:14px}.N807zW_modelHeading{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.N807zW_stats{flex-direction:column;gap:10px;display:flex}.N807zW_stat{flex-direction:column;gap:4px;display:flex}.N807zW_statLabel{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:1.5}.N807zW_modelDetails .N807zW_input{box-sizing:border-box;width:100%;min-width:0;height:30px;padding:0 9px;font-size:12px}.N807zW_modalities{flex-wrap:wrap;gap:4px;display:flex}.N807zW_modality,.N807zW_modalityOff{border-radius:6px;padding:2px 7px;font-size:11px;line-height:1.5}.N807zW_modality{background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}.N807zW_modalityOff{border:.5px dashed var(--dsw-alias-border-l4);color:var(--dsw-alias-label-tertiary)}.N807zW_modelDetails .N807zW_reset{align-self:flex-start}.N807zW_paneFoot{color:var(--dsw-alias-label-tertiary);margin:auto 0 0;font-size:11px;line-height:1.5}.N807zW_newBadge{color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3);border:.5px solid var(--dsw-alias-border-l4);border-radius:4px;padding:2px 4px;font-size:9px}.N807zW_modelChoice:focus-visible,.N807zW_filter:focus-visible,.N807zW_cardTrigger:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}@container (width<=440px){.N807zW_advancedGrid{grid-template-columns:minmax(0,1fr)}.N807zW_cardModels{max-height:none}.N807zW_modelLayout{flex:none;grid-template-columns:minmax(0,1fr);max-height:none}.N807zW_modelList{border-right:0;border-bottom:.5px solid var(--dsw-alias-border-l2);max-height:240px}.N807zW_modelDetails{max-height:460px}}@media (prefers-reduced-motion:reduce){.N807zW_chevron,.N807zW_chevronOpen{transition:none}}";
|
|
140
149
|
document.head.appendChild(style);
|
|
141
150
|
}
|
|
142
|
-
var Section_default = { "
|
|
151
|
+
var Section_default = { "actions": "N807zW_actions", "advancedGrid": "N807zW_advancedGrid", "badges": "N807zW_badges", "card": "N807zW_card", "cardBody": "N807zW_cardBody", "cardDivider": "N807zW_cardDivider", "cardHead": "N807zW_cardHead", "cardModels": "N807zW_cardModels", "cardSub": "N807zW_cardSub", "cardTitle": "N807zW_cardTitle", "cardTrigger": "N807zW_cardTrigger", "chevron": "N807zW_chevron", "chevronOpen": "N807zW_chevronOpen", "failedNote": "N807zW_failedNote", "field": "N807zW_field", "filter": "N807zW_filter", "filters": "N807zW_filters", "head": "N807zW_head", "hint": "N807zW_hint", "input": "N807zW_input", "inputInvalid": "N807zW_inputInvalid N807zW_input", "intro": "N807zW_intro", "invalid": "N807zW_invalid", "label": "N807zW_label", "limitsEditor": "N807zW_limitsEditor", "limitsModelId": "N807zW_limitsModelId", "limitsSummary": "N807zW_limitsSummary", "modalities": "N807zW_modalities", "modality": "N807zW_modality", "modalityOff": "N807zW_modalityOff", "modelChoice": "N807zW_modelChoice", "modelDetails": "N807zW_modelDetails", "modelHeading": "N807zW_modelHeading", "modelLayout": "N807zW_modelLayout", "modelList": "N807zW_modelList", "modelMeta": "N807zW_modelMeta", "modelName": "N807zW_modelName", "modelRow": "N807zW_modelRow", "modelRowSelected": "N807zW_modelRowSelected", "newBadge": "N807zW_newBadge", "overrideDot": "N807zW_overrideDot", "page": "N807zW_page", "pageBody": "N807zW_pageBody", "pageTop": "N807zW_pageTop", "paneFoot": "N807zW_paneFoot", "releaseDate": "N807zW_releaseDate", "reset": "N807zW_reset", "slot": "N807zW_slot", "starLink": "N807zW_starLink", "stat": "N807zW_stat", "statLabel": "N807zW_statLabel", "stats": "N807zW_stats", "title": "N807zW_title", "trailing": "N807zW_trailing", "visuallyHidden": "N807zW_visuallyHidden" };
|
|
143
152
|
|
|
144
153
|
// src/client/ModelEditor.tsx
|
|
145
154
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
155
|
+
var MODALITY_COPY = {
|
|
156
|
+
text: "modalityText",
|
|
157
|
+
image: "modalityImage",
|
|
158
|
+
audio: "modalityAudio",
|
|
159
|
+
video: "modalityVideo",
|
|
160
|
+
pdf: "modalityPdf"
|
|
161
|
+
};
|
|
146
162
|
function hasCapacityOverride(limit) {
|
|
147
163
|
return limit?.contextWindow != null || limit?.maxTokens != null;
|
|
148
164
|
}
|
|
@@ -216,49 +232,62 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
216
232
|
key
|
|
217
233
|
)) }),
|
|
218
234
|
model ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: Section_default.modelLayout, children: [
|
|
219
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: Section_default.modelList, "aria-label": t("modelsLabel"), children: entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
{
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
235
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: Section_default.modelList, "aria-label": t("modelsLabel"), children: entries.map((entry) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
236
|
+
"div",
|
|
237
|
+
{
|
|
238
|
+
className: entry.id === model.id ? `${Section_default.modelRow} ${Section_default.modelRowSelected}` : Section_default.modelRow,
|
|
239
|
+
children: [
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
type: "button",
|
|
244
|
+
className: Section_default.modelChoice,
|
|
245
|
+
"aria-pressed": entry.id === model.id,
|
|
246
|
+
onClick: () => {
|
|
247
|
+
setSelected(entry.id);
|
|
248
|
+
},
|
|
249
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: Section_default.modelName, children: [
|
|
250
|
+
entry.name ?? entry.id,
|
|
251
|
+
" ",
|
|
252
|
+
badges(entry)
|
|
253
|
+
] })
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
hasCapacityOverride(draft[entry.id]) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Section_default.overrideDot, title: t("overridden"), "aria-hidden": "true" }) : null,
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
|
+
import_dsh_client_ui_primitives.Switch,
|
|
259
|
+
{
|
|
260
|
+
label: t("modelVisibleLabel", { name: entry.name ?? entry.id }),
|
|
261
|
+
checked: isModelEnabled(entry, modelVisibility),
|
|
262
|
+
disabled: visibilityDisabled || entry.configurationMissing,
|
|
263
|
+
onChange: (enabled) => {
|
|
264
|
+
onModelEnabled(entry.id, enabled);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
entry.id
|
|
271
|
+
)) }),
|
|
252
272
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: Section_default.modelDetails, "aria-label": t("modelDetails"), children: [
|
|
253
273
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: Section_default.modelHeading, children: [
|
|
254
274
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { children: model.name ?? model.id }),
|
|
255
275
|
badges(model)
|
|
256
276
|
] }),
|
|
257
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: Section_default.modelMeta, children: [
|
|
278
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { className: Section_default.limitsModelId, translate: "no", children: model.id }),
|
|
279
|
+
model.releaseDate ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Section_default.releaseDate, title: t("releaseSource", { date: model.releaseDate }), children: model.releaseDate }) : null
|
|
280
|
+
] }),
|
|
258
281
|
model.configurationMissing ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: Section_default.hint, children: t(metadataUnavailable ? "configurationUnavailableHint" : "configurationMissingHint") }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
259
282
|
model.deprecated ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: Section_default.hint, children: t("deprecatedHint") }) : null,
|
|
260
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
261
|
-
|
|
283
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: Section_default.stats, children: [
|
|
284
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Capacity, { model, field: "contextWindow", limit: draft[model.id], t, locale, disabled, onChange: write }),
|
|
285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Capacity, { model, field: "maxTokens", limit: draft[model.id], t, locale, disabled, onChange: write }),
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: Section_default.stat, children: [
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Section_default.statLabel, children: t("modalityLabel") }),
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modalities, { model, t })
|
|
289
|
+
] })
|
|
290
|
+
] }),
|
|
262
291
|
hasCapacityOverride(draft[model.id]) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
263
292
|
"button",
|
|
264
293
|
{
|
|
@@ -271,8 +300,12 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
271
300
|
children: t("limitsResetModel")
|
|
272
301
|
}
|
|
273
302
|
) : null,
|
|
274
|
-
|
|
275
|
-
|
|
303
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: Section_default.paneFoot, children: [
|
|
304
|
+
t("limitsHint"),
|
|
305
|
+
" ",
|
|
306
|
+
t("modalitiesSource"),
|
|
307
|
+
model.inputModalities?.some((modality) => modality !== "text" && modality !== "image") === true ? ` ${t("modalitiesForwarding")}` : ""
|
|
308
|
+
] })
|
|
276
309
|
] })
|
|
277
310
|
] })
|
|
278
311
|
] }) : models.status === "ready" && all.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: Section_default.hint, children: t("limitsNoMatches", { query }) }) : null,
|
|
@@ -293,11 +326,23 @@ function ModelEditor({ models, draft, modelVisibility, t, locale, disabled, visi
|
|
|
293
326
|
] })
|
|
294
327
|
] });
|
|
295
328
|
}
|
|
329
|
+
function Modalities({ model, t }) {
|
|
330
|
+
const declared = model.inputModalities;
|
|
331
|
+
if (declared === void 0 || declared.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Section_default.hint, children: t("modalityUnknown") });
|
|
332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Section_default.modalities, children: INPUT_MODALITIES.map((modality) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
333
|
+
"span",
|
|
334
|
+
{
|
|
335
|
+
className: declared.includes(modality) ? Section_default.modality : Section_default.modalityOff,
|
|
336
|
+
children: t(MODALITY_COPY[modality])
|
|
337
|
+
},
|
|
338
|
+
modality
|
|
339
|
+
)) });
|
|
340
|
+
}
|
|
296
341
|
function Capacity({ model, field, limit, disabled, t, locale, onChange }) {
|
|
297
342
|
const id3 = `opencode-go-${field}-${encodeURIComponent(model.id)}`;
|
|
298
343
|
const defaultValue = model[field];
|
|
299
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: Section_default.
|
|
300
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: Section_default.
|
|
344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: Section_default.stat, children: [
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { className: Section_default.statLabel, htmlFor: id3, children: t(field === "contextWindow" ? "limitsContext" : "limitsOutput") }),
|
|
301
346
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
302
347
|
"input",
|
|
303
348
|
{
|
|
@@ -331,7 +376,7 @@ function Capacity({ model, field, limit, disabled, t, locale, onChange }) {
|
|
|
331
376
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
332
377
|
var ChevronDown = primitives.IconChevronDownOutlineRegular ?? primitives.IconChevronDownOutline14;
|
|
333
378
|
function ValueField(props) {
|
|
334
|
-
const hintId =
|
|
379
|
+
const hintId = props.id + "-hint";
|
|
335
380
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.field, children: [
|
|
336
381
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.head, children: [
|
|
337
382
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: Section_default.label, htmlFor: props.id, children: props.label }),
|
|
@@ -439,152 +484,16 @@ function Loaded(props) {
|
|
|
439
484
|
resetLabel: t("reset"),
|
|
440
485
|
disabled
|
|
441
486
|
};
|
|
442
|
-
const advancedOverridden = state.apiKeyEnv.overridden || state.baseURL.overridden || state.refreshMinutes.overridden || state.streamIdleTimeoutMs.overridden || state.maxRequestImageBytes.overridden || state.requestImagePixelBudget.overridden || state.requestImageMaxBytes.overridden;
|
|
487
|
+
const advancedOverridden = state.apiKeyEnv.overridden || state.baseURL.overridden || state.refreshMinutes.overridden || state.streamIdleTimeoutMs.overridden || state.maxImages.overridden || state.maxRequestImageBytes.overridden || state.requestImagePixelBudget.overridden || state.requestImageMaxBytes.overridden;
|
|
443
488
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.page, children: [
|
|
444
489
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.pageBody, children: [
|
|
445
490
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.pageTop, children: [
|
|
446
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("
|
|
447
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
448
|
-
"button",
|
|
449
|
-
{
|
|
450
|
-
type: "button",
|
|
451
|
-
className: Section_default.advancedTrigger,
|
|
452
|
-
"aria-expanded": advanced,
|
|
453
|
-
"aria-controls": "opencode-go-advanced",
|
|
454
|
-
onClick: () => {
|
|
455
|
-
setAdvanced(!advanced);
|
|
456
|
-
},
|
|
457
|
-
children: [
|
|
458
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChevronDown, { className: advanced ? Section_default.chevronOpen : Section_default.chevron }),
|
|
459
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.label, children: t("advancedLabel") }),
|
|
460
|
-
advancedOverridden ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Tag, { tone: "neutral", children: t("overridden") }) : null
|
|
461
|
-
]
|
|
462
|
-
}
|
|
463
|
-
)
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: Section_default.title, children: t("titleLabel") }),
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.intro, children: t("intro") })
|
|
464
493
|
] }),
|
|
465
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
466
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
467
|
-
|
|
468
|
-
ValueField,
|
|
469
|
-
{
|
|
470
|
-
id: "opencode-go-api-key-env",
|
|
471
|
-
label: t("apiKeyEnvLabel"),
|
|
472
|
-
hint: t("apiKeyEnvHint"),
|
|
473
|
-
field: state.apiKeyEnv,
|
|
474
|
-
...fieldProps,
|
|
475
|
-
onEdit: (text) => {
|
|
476
|
-
props.edit("apiKeyEnv", text);
|
|
477
|
-
},
|
|
478
|
-
onReset: () => {
|
|
479
|
-
props.resetField("apiKeyEnv");
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
),
|
|
483
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
484
|
-
ValueField,
|
|
485
|
-
{
|
|
486
|
-
id: "opencode-go-base-url",
|
|
487
|
-
label: t("baseURLLabel"),
|
|
488
|
-
hint: t("baseURLHint"),
|
|
489
|
-
field: state.baseURL,
|
|
490
|
-
...fieldProps,
|
|
491
|
-
onEdit: (text) => {
|
|
492
|
-
props.edit("baseURL", text);
|
|
493
|
-
},
|
|
494
|
-
onReset: () => {
|
|
495
|
-
props.resetField("baseURL");
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
),
|
|
499
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
500
|
-
ValueField,
|
|
501
|
-
{
|
|
502
|
-
id: "opencode-go-refresh-minutes",
|
|
503
|
-
label: t("refreshMinutesLabel"),
|
|
504
|
-
hint: t("refreshMinutesHint"),
|
|
505
|
-
field: state.refreshMinutes,
|
|
506
|
-
numeric: true,
|
|
507
|
-
...fieldProps,
|
|
508
|
-
onEdit: (text) => {
|
|
509
|
-
props.edit("refreshMinutes", text);
|
|
510
|
-
},
|
|
511
|
-
onReset: () => {
|
|
512
|
-
props.resetField("refreshMinutes");
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
),
|
|
516
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
517
|
-
ValueField,
|
|
518
|
-
{
|
|
519
|
-
id: "opencode-go-stream-idle",
|
|
520
|
-
label: t("streamIdleTimeoutMsLabel"),
|
|
521
|
-
hint: t("streamIdleTimeoutMsHint"),
|
|
522
|
-
field: state.streamIdleTimeoutMs,
|
|
523
|
-
numeric: true,
|
|
524
|
-
...fieldProps,
|
|
525
|
-
onEdit: (text) => {
|
|
526
|
-
props.edit("streamIdleTimeoutMs", text);
|
|
527
|
-
},
|
|
528
|
-
onReset: () => {
|
|
529
|
-
props.resetField("streamIdleTimeoutMs");
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
),
|
|
533
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
534
|
-
ValueField,
|
|
535
|
-
{
|
|
536
|
-
id: "opencode-go-max-request-image-bytes",
|
|
537
|
-
label: t("maxRequestImageBytesLabel"),
|
|
538
|
-
hint: t("maxRequestImageBytesHint"),
|
|
539
|
-
field: state.maxRequestImageBytes,
|
|
540
|
-
numeric: true,
|
|
541
|
-
...fieldProps,
|
|
542
|
-
onEdit: (text) => {
|
|
543
|
-
props.edit("maxRequestImageBytes", text);
|
|
544
|
-
},
|
|
545
|
-
onReset: () => {
|
|
546
|
-
props.resetField("maxRequestImageBytes");
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
),
|
|
550
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
551
|
-
ValueField,
|
|
552
|
-
{
|
|
553
|
-
id: "opencode-go-image-pixel-budget",
|
|
554
|
-
label: t("requestImagePixelBudgetLabel"),
|
|
555
|
-
hint: t("requestImagePixelBudgetHint"),
|
|
556
|
-
field: state.requestImagePixelBudget,
|
|
557
|
-
numeric: true,
|
|
558
|
-
...fieldProps,
|
|
559
|
-
onEdit: (text) => {
|
|
560
|
-
props.edit("requestImagePixelBudget", text);
|
|
561
|
-
},
|
|
562
|
-
onReset: () => {
|
|
563
|
-
props.resetField("requestImagePixelBudget");
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
),
|
|
567
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
568
|
-
ValueField,
|
|
569
|
-
{
|
|
570
|
-
id: "opencode-go-image-max-bytes",
|
|
571
|
-
label: t("requestImageMaxBytesLabel"),
|
|
572
|
-
hint: t("requestImageMaxBytesHint"),
|
|
573
|
-
field: state.requestImageMaxBytes,
|
|
574
|
-
numeric: true,
|
|
575
|
-
...fieldProps,
|
|
576
|
-
onEdit: (text) => {
|
|
577
|
-
props.edit("requestImageMaxBytes", text);
|
|
578
|
-
},
|
|
579
|
-
onReset: () => {
|
|
580
|
-
props.resetField("requestImageMaxBytes");
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
)
|
|
584
|
-
] }) : null }),
|
|
585
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.field, children: [
|
|
586
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.head, children: [
|
|
587
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.label, children: t("enabledLabel") }),
|
|
494
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: Section_default.card, children: [
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.cardHead, children: [
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { className: Section_default.cardTitle, children: t("enabledLabel") }),
|
|
588
497
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
589
498
|
import_dsh_client_ui_primitives2.Switch,
|
|
590
499
|
{
|
|
@@ -595,36 +504,40 @@ function Loaded(props) {
|
|
|
595
504
|
}
|
|
596
505
|
)
|
|
597
506
|
] }),
|
|
598
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: state.enabled ? t("enabledHint") : t("enabledOff") })
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: Section_default.cardBody, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: state.enabled ? t("enabledHint") : t("enabledOff") }) }),
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: Section_default.cardDivider }),
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.cardHead, children: [
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.slot, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", focusable: "false", children: [
|
|
511
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "5.4", cy: "8", r: "3.1" }),
|
|
512
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8.5 8h5.3M11.9 8v2.2M10.2 8v1.6" })
|
|
513
|
+
] }) }),
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: Section_default.label, htmlFor: "opencode-go-key", children: t("keyLabel") }),
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.trailing, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Tag, { tone: state.apiKeyConfigured ? "success" : "warning", children: state.apiKeyConfigured ? t("keyConfigured") : t("keyMissing") }) })
|
|
604
516
|
] }),
|
|
605
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
517
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.cardBody, children: [
|
|
518
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
519
|
+
"input",
|
|
520
|
+
{
|
|
521
|
+
id: "opencode-go-key",
|
|
522
|
+
name: "api-key",
|
|
523
|
+
className: Section_default.input,
|
|
524
|
+
type: "password",
|
|
525
|
+
autoComplete: "off",
|
|
526
|
+
"aria-describedby": "opencode-go-key-hint",
|
|
527
|
+
value: state.apiKey.text,
|
|
528
|
+
disabled: !state.apiKeyWritable,
|
|
529
|
+
onChange: (event) => {
|
|
530
|
+
props.edit("apiKey", event.target.value);
|
|
531
|
+
}
|
|
619
532
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { id: "opencode-go-key-hint", className: Section_default.hint, children: state.apiKeyWritable ? t("keyHint") : t("keyNotWritable") })
|
|
535
|
+
] })
|
|
623
536
|
] }),
|
|
624
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("
|
|
625
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.
|
|
626
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("
|
|
627
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: Section_default.
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: Section_default.cardModels, children: [
|
|
538
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.cardHead, children: [
|
|
539
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { className: Section_default.cardTitle, children: t("modelsLabel") }),
|
|
540
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: Section_default.trailing, children: [
|
|
628
541
|
state.models.status === "ready" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Tag, { tone: "neutral", children: t("modelsCount", { count: state.models.count }) }) : null,
|
|
629
542
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
630
543
|
"button",
|
|
@@ -638,26 +551,185 @@ function Loaded(props) {
|
|
|
638
551
|
)
|
|
639
552
|
] })
|
|
640
553
|
] }),
|
|
641
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
554
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.cardBody, children: [
|
|
555
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ModelsBody, { models: state.models, t, locale: props.locale }),
|
|
556
|
+
state.pickerFailed ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.failedNote, role: "alert", children: t("pickerFailed") }) : null,
|
|
557
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
558
|
+
ModelEditor,
|
|
559
|
+
{
|
|
560
|
+
models: state.models,
|
|
561
|
+
draft: state.modelLimitDraft,
|
|
562
|
+
t,
|
|
563
|
+
locale: props.locale,
|
|
564
|
+
disabled: disabled || state.saving,
|
|
565
|
+
modelVisibility: state.modelVisibility,
|
|
566
|
+
visibilitySaving: state.pickerSaving,
|
|
567
|
+
onModelEnabled: props.setModelEnabled,
|
|
568
|
+
onEdit: (next) => {
|
|
569
|
+
props.edit("modelLimits", JSON.stringify(next));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
)
|
|
573
|
+
] })
|
|
642
574
|
] }),
|
|
643
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
ModelEditor,
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: Section_default.card, children: [
|
|
576
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
577
|
+
"button",
|
|
647
578
|
{
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
579
|
+
type: "button",
|
|
580
|
+
className: Section_default.cardTrigger,
|
|
581
|
+
"aria-expanded": advanced,
|
|
582
|
+
"aria-controls": "opencode-go-advanced",
|
|
583
|
+
onClick: () => {
|
|
584
|
+
setAdvanced(!advanced);
|
|
585
|
+
},
|
|
586
|
+
children: [
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.cardTitle, children: t("advancedLabel") }),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: Section_default.cardSub, children: t("advancedSummary") }),
|
|
589
|
+
advancedOverridden ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dsh_client_ui_primitives2.Tag, { tone: "neutral", children: t("overridden") }) : null,
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChevronDown, { className: advanced ? Section_default.chevronOpen : Section_default.chevron })
|
|
591
|
+
]
|
|
659
592
|
}
|
|
660
|
-
)
|
|
593
|
+
),
|
|
594
|
+
advanced ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { id: "opencode-go-advanced", className: Section_default.cardBody, children: [
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: t("advancedHint") }),
|
|
596
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: Section_default.advancedGrid, children: [
|
|
597
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
598
|
+
ValueField,
|
|
599
|
+
{
|
|
600
|
+
id: "opencode-go-api-key-env",
|
|
601
|
+
label: t("apiKeyEnvLabel"),
|
|
602
|
+
hint: t("apiKeyEnvHint"),
|
|
603
|
+
field: state.apiKeyEnv,
|
|
604
|
+
...fieldProps,
|
|
605
|
+
onEdit: (text) => {
|
|
606
|
+
props.edit("apiKeyEnv", text);
|
|
607
|
+
},
|
|
608
|
+
onReset: () => {
|
|
609
|
+
props.resetField("apiKeyEnv");
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
614
|
+
ValueField,
|
|
615
|
+
{
|
|
616
|
+
id: "opencode-go-base-url",
|
|
617
|
+
label: t("baseURLLabel"),
|
|
618
|
+
hint: t("baseURLHint"),
|
|
619
|
+
field: state.baseURL,
|
|
620
|
+
...fieldProps,
|
|
621
|
+
onEdit: (text) => {
|
|
622
|
+
props.edit("baseURL", text);
|
|
623
|
+
},
|
|
624
|
+
onReset: () => {
|
|
625
|
+
props.resetField("baseURL");
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
),
|
|
629
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
630
|
+
ValueField,
|
|
631
|
+
{
|
|
632
|
+
id: "opencode-go-refresh-minutes",
|
|
633
|
+
label: t("refreshMinutesLabel"),
|
|
634
|
+
hint: t("refreshMinutesHint"),
|
|
635
|
+
field: state.refreshMinutes,
|
|
636
|
+
numeric: true,
|
|
637
|
+
...fieldProps,
|
|
638
|
+
onEdit: (text) => {
|
|
639
|
+
props.edit("refreshMinutes", text);
|
|
640
|
+
},
|
|
641
|
+
onReset: () => {
|
|
642
|
+
props.resetField("refreshMinutes");
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
),
|
|
646
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
647
|
+
ValueField,
|
|
648
|
+
{
|
|
649
|
+
id: "opencode-go-stream-idle",
|
|
650
|
+
label: t("streamIdleTimeoutMsLabel"),
|
|
651
|
+
hint: t("streamIdleTimeoutMsHint"),
|
|
652
|
+
field: state.streamIdleTimeoutMs,
|
|
653
|
+
numeric: true,
|
|
654
|
+
...fieldProps,
|
|
655
|
+
onEdit: (text) => {
|
|
656
|
+
props.edit("streamIdleTimeoutMs", text);
|
|
657
|
+
},
|
|
658
|
+
onReset: () => {
|
|
659
|
+
props.resetField("streamIdleTimeoutMs");
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
664
|
+
ValueField,
|
|
665
|
+
{
|
|
666
|
+
id: "opencode-go-max-images",
|
|
667
|
+
label: t("maxImagesLabel"),
|
|
668
|
+
hint: t("maxImagesHint"),
|
|
669
|
+
field: state.maxImages,
|
|
670
|
+
numeric: true,
|
|
671
|
+
...fieldProps,
|
|
672
|
+
onEdit: (text) => {
|
|
673
|
+
props.edit("maxImages", text);
|
|
674
|
+
},
|
|
675
|
+
onReset: () => {
|
|
676
|
+
props.resetField("maxImages");
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
),
|
|
680
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
681
|
+
ValueField,
|
|
682
|
+
{
|
|
683
|
+
id: "opencode-go-max-request-image-bytes",
|
|
684
|
+
label: t("maxRequestImageBytesLabel"),
|
|
685
|
+
hint: t("maxRequestImageBytesHint"),
|
|
686
|
+
field: state.maxRequestImageBytes,
|
|
687
|
+
numeric: true,
|
|
688
|
+
...fieldProps,
|
|
689
|
+
onEdit: (text) => {
|
|
690
|
+
props.edit("maxRequestImageBytes", text);
|
|
691
|
+
},
|
|
692
|
+
onReset: () => {
|
|
693
|
+
props.resetField("maxRequestImageBytes");
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
698
|
+
ValueField,
|
|
699
|
+
{
|
|
700
|
+
id: "opencode-go-image-pixel-budget",
|
|
701
|
+
label: t("requestImagePixelBudgetLabel"),
|
|
702
|
+
hint: t("requestImagePixelBudgetHint"),
|
|
703
|
+
field: state.requestImagePixelBudget,
|
|
704
|
+
numeric: true,
|
|
705
|
+
...fieldProps,
|
|
706
|
+
onEdit: (text) => {
|
|
707
|
+
props.edit("requestImagePixelBudget", text);
|
|
708
|
+
},
|
|
709
|
+
onReset: () => {
|
|
710
|
+
props.resetField("requestImagePixelBudget");
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
),
|
|
714
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
715
|
+
ValueField,
|
|
716
|
+
{
|
|
717
|
+
id: "opencode-go-image-max-bytes",
|
|
718
|
+
label: t("requestImageMaxBytesLabel"),
|
|
719
|
+
hint: t("requestImageMaxBytesHint"),
|
|
720
|
+
field: state.requestImageMaxBytes,
|
|
721
|
+
numeric: true,
|
|
722
|
+
...fieldProps,
|
|
723
|
+
onEdit: (text) => {
|
|
724
|
+
props.edit("requestImageMaxBytes", text);
|
|
725
|
+
},
|
|
726
|
+
onReset: () => {
|
|
727
|
+
props.resetField("requestImageMaxBytes");
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
] })
|
|
732
|
+
] }) : null
|
|
661
733
|
] }),
|
|
662
734
|
disabled ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: Section_default.hint, children: t("readOnly") }) : null
|
|
663
735
|
] }),
|
|
@@ -685,7 +757,7 @@ function Loaded(props) {
|
|
|
685
757
|
|
|
686
758
|
// src/client/staged-form.ts
|
|
687
759
|
var import_dsh_client_store = require("@deepseek-ai/dsh-client-store");
|
|
688
|
-
function numberField(field) {
|
|
760
|
+
function numberField(field, validate = () => true) {
|
|
689
761
|
return {
|
|
690
762
|
field,
|
|
691
763
|
format: (value) => typeof value === "number" ? String(value) : "",
|
|
@@ -693,7 +765,7 @@ function numberField(field) {
|
|
|
693
765
|
const trimmed = text.trim();
|
|
694
766
|
if (trimmed === "") return { kind: "clear" };
|
|
695
767
|
const parsed = Number(trimmed);
|
|
696
|
-
return Number.isFinite(parsed) ? { kind: "set", value: parsed } : void 0;
|
|
768
|
+
return Number.isFinite(parsed) && validate(parsed) ? { kind: "set", value: parsed } : void 0;
|
|
697
769
|
}
|
|
698
770
|
};
|
|
699
771
|
}
|
|
@@ -963,6 +1035,7 @@ var OpencodeGoSectionController = class {
|
|
|
963
1035
|
textField("baseURL"),
|
|
964
1036
|
numberField("refreshMinutes"),
|
|
965
1037
|
numberField("streamIdleTimeoutMs"),
|
|
1038
|
+
numberField("maxImages", (value) => Number.isSafeInteger(value) && value > 0),
|
|
966
1039
|
numberField("maxRequestImageBytes"),
|
|
967
1040
|
numberField("requestImagePixelBudget"),
|
|
968
1041
|
numberField("requestImageMaxBytes"),
|
|
@@ -1010,6 +1083,7 @@ var OpencodeGoSectionController = class {
|
|
|
1010
1083
|
baseURL: this.form.field("baseURL"),
|
|
1011
1084
|
refreshMinutes: this.form.field("refreshMinutes"),
|
|
1012
1085
|
streamIdleTimeoutMs: this.form.field("streamIdleTimeoutMs"),
|
|
1086
|
+
maxImages: this.form.field("maxImages"),
|
|
1013
1087
|
maxRequestImageBytes: this.form.field("maxRequestImageBytes"),
|
|
1014
1088
|
requestImagePixelBudget: this.form.field("requestImagePixelBudget"),
|
|
1015
1089
|
requestImageMaxBytes: this.form.field("requestImageMaxBytes"),
|
|
@@ -1248,6 +1322,7 @@ var en = {
|
|
|
1248
1322
|
usageRefreshing: "Refreshing\u2026",
|
|
1249
1323
|
nav: "OpenCode Go",
|
|
1250
1324
|
title: "OpenCode Go",
|
|
1325
|
+
titleLabel: "OpenCode Go",
|
|
1251
1326
|
intro: "Choose the OpenCode Go models shown in conversations and adjust their capacities.",
|
|
1252
1327
|
starProject: "Enjoying the plugin? Star it on GitHub",
|
|
1253
1328
|
starProjectTitle: "Open the GitHub project in a new tab",
|
|
@@ -1276,7 +1351,7 @@ var en = {
|
|
|
1276
1351
|
modelsEmpty: "The gateway currently serves no model this adapter can route.",
|
|
1277
1352
|
modelsCount: "{count} models",
|
|
1278
1353
|
limitsLabel: "Model capacities",
|
|
1279
|
-
limitsHint: "Capacities come from the
|
|
1354
|
+
limitsHint: "Capacities come from the online configuration; blank keeps the default and Save applies your overrides.",
|
|
1280
1355
|
limitsFilterLabel: "Find a model",
|
|
1281
1356
|
limitsFilterPlaceholder: "Search by model name or id\u2026",
|
|
1282
1357
|
limitsSummary: "{count} customized",
|
|
@@ -1285,6 +1360,15 @@ var en = {
|
|
|
1285
1360
|
limitsOutput: "Max output",
|
|
1286
1361
|
capacityDefault: "Default: {value} tokens",
|
|
1287
1362
|
capacityMissing: "API did not provide a value",
|
|
1363
|
+
modalityLabel: "Input modalities",
|
|
1364
|
+
modalityText: "Text",
|
|
1365
|
+
modalityImage: "Image",
|
|
1366
|
+
modalityAudio: "Audio",
|
|
1367
|
+
modalityVideo: "Video",
|
|
1368
|
+
modalityPdf: "PDF",
|
|
1369
|
+
modalityUnknown: "Not declared",
|
|
1370
|
+
modalitiesSource: "Input modalities come from the online models.dev configuration.",
|
|
1371
|
+
modalitiesForwarding: "This plugin converts and forwards image attachments only.",
|
|
1288
1372
|
visibilityHint: "Only enabled models appear in conversation pickers. Changes apply immediately. Deprecated models are off by default and can be enabled individually.",
|
|
1289
1373
|
modelVisibleLabel: "Show {name} in conversations",
|
|
1290
1374
|
configurationMissing: "Configuration missing",
|
|
@@ -1296,7 +1380,6 @@ var en = {
|
|
|
1296
1380
|
deprecatedHint: "Marked deprecated by models.dev, but still provided by this gateway.",
|
|
1297
1381
|
newHint: "Released within the last seven UTC calendar days, according to models.dev.",
|
|
1298
1382
|
newBadge: "NEW",
|
|
1299
|
-
releasedOn: "Released {date}",
|
|
1300
1383
|
releaseSource: "Release date: {date} \xB7 models.dev",
|
|
1301
1384
|
modelDetails: "Model configuration",
|
|
1302
1385
|
filterLabel: "Filter models",
|
|
@@ -1310,6 +1393,7 @@ var en = {
|
|
|
1310
1393
|
limitsEmpty: "Read the model list first; capacities are edited per model the gateway serves.",
|
|
1311
1394
|
limitsContextLabel: "Context window for {name}",
|
|
1312
1395
|
limitsOutputLabel: "Max output for {name}",
|
|
1396
|
+
advancedSummary: "Credential name \xB7 Gateway URL \xB7 Refresh \xB7 Idle timeout \xB7 Image limits",
|
|
1313
1397
|
advancedLabel: "Advanced settings",
|
|
1314
1398
|
advancedHint: "Credential name, gateway URL, and adapter tuning. The inherited values work as they are; change them only if you know you need to.",
|
|
1315
1399
|
apiKeyEnvLabel: "Credential reference",
|
|
@@ -1320,6 +1404,8 @@ var en = {
|
|
|
1320
1404
|
refreshMinutesHint: "Catalog cache lifetime for conversations and model pickers. Opening this settings page or clicking Refresh checks the gateway and online model metadata immediately.",
|
|
1321
1405
|
streamIdleTimeoutMsLabel: "Stream idle timeout (ms)",
|
|
1322
1406
|
streamIdleTimeoutMsHint: "Largest quiet gap between stream events before the request fails.",
|
|
1407
|
+
maxImagesLabel: "Request image count cap (maxImages)",
|
|
1408
|
+
maxImagesHint: "Optional positive integer; no count cap by default. Excess oldest images become text placeholders so the conversation can continue. Original attachments are kept. On DSH 0.1.6+, raising or clearing the cap does not restore images already offloaded. Clearing inherits the base configuration.",
|
|
1323
1409
|
maxRequestImageBytesLabel: "Request image payload cap (bytes)",
|
|
1324
1410
|
maxRequestImageBytesHint: "Accumulated base64 image payload bound for one request.",
|
|
1325
1411
|
requestImagePixelBudgetLabel: "Image pixel budget",
|
|
@@ -1356,6 +1442,7 @@ var zh = {
|
|
|
1356
1442
|
usageRefreshing: "\u6B63\u5728\u5237\u65B0\u2026",
|
|
1357
1443
|
nav: "OpenCode Go",
|
|
1358
1444
|
title: "OpenCode Go",
|
|
1445
|
+
titleLabel: "OpenCode Go",
|
|
1359
1446
|
intro: "\u9009\u62E9\u4F1A\u8BDD\u4E2D\u663E\u793A\u7684 OpenCode Go \u6A21\u578B\uFF0C\u5E76\u8C03\u6574\u5176\u5BB9\u91CF\u3002",
|
|
1360
1447
|
starProject: "\u559C\u6B22\u8FD9\u4E2A\u63D2\u4EF6\uFF1F\u53BB GitHub \u70B9\u4E2A Star",
|
|
1361
1448
|
starProjectTitle: "\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00 GitHub \u9879\u76EE",
|
|
@@ -1384,7 +1471,7 @@ var zh = {
|
|
|
1384
1471
|
modelsEmpty: "\u7F51\u5173\u5F53\u524D\u6CA1\u6709\u672C\u9002\u914D\u5668\u53EF\u8DEF\u7531\u7684\u6A21\u578B\u3002",
|
|
1385
1472
|
modelsCount: "{count} \u4E2A\u6A21\u578B",
|
|
1386
1473
|
limitsLabel: "\u6A21\u578B\u5BB9\u91CF",
|
|
1387
|
-
limitsHint: "\u5BB9\u91CF\u6765\u81EA\u6A21\u578B
|
|
1474
|
+
limitsHint: "\u5BB9\u91CF\u6765\u81EA\u5728\u7EBF\u6A21\u578B\u914D\u7F6E\uFF1B\u7559\u7A7A\u7528\u9ED8\u8BA4\u503C\uFF0C\u4FDD\u5B58\u540E\u751F\u6548\u3002",
|
|
1388
1475
|
limitsFilterLabel: "\u67E5\u627E\u6A21\u578B",
|
|
1389
1476
|
limitsFilterPlaceholder: "\u6309\u6A21\u578B\u540D\u79F0\u6216 ID \u641C\u7D22\u2026",
|
|
1390
1477
|
limitsSummary: "{count} \u4E2A\u5DF2\u81EA\u5B9A\u4E49",
|
|
@@ -1393,6 +1480,15 @@ var zh = {
|
|
|
1393
1480
|
limitsOutput: "\u6700\u5927\u8F93\u51FA",
|
|
1394
1481
|
capacityDefault: "\u9ED8\u8BA4\uFF1A{value} tokens",
|
|
1395
1482
|
capacityMissing: "API \u672A\u63D0\u4F9B",
|
|
1483
|
+
modalityLabel: "\u8F93\u5165\u6A21\u6001",
|
|
1484
|
+
modalityText: "\u6587\u672C",
|
|
1485
|
+
modalityImage: "\u56FE\u50CF",
|
|
1486
|
+
modalityAudio: "\u97F3\u9891",
|
|
1487
|
+
modalityVideo: "\u89C6\u9891",
|
|
1488
|
+
modalityPdf: "PDF",
|
|
1489
|
+
modalityUnknown: "\u672A\u58F0\u660E",
|
|
1490
|
+
modalitiesSource: "\u8F93\u5165\u6A21\u6001\u6765\u81EA models.dev \u7684\u5728\u7EBF\u914D\u7F6E\u3002",
|
|
1491
|
+
modalitiesForwarding: "\u672C\u63D2\u4EF6\u76EE\u524D\u4EC5\u8F6C\u6362\u5E76\u8F6C\u53D1\u56FE\u50CF\u9644\u4EF6\u3002",
|
|
1396
1492
|
visibilityHint: "\u5F00\u542F\u7684\u6A21\u578B\u624D\u4F1A\u663E\u793A\u5728\u4F1A\u8BDD\u9009\u62E9\u5668\u4E2D\uFF0C\u4FEE\u6539\u7ACB\u5373\u751F\u6548\u3002\u8FC7\u65F6\u6A21\u578B\u9ED8\u8BA4\u5173\u95ED\uFF0C\u53EF\u5355\u72EC\u5F00\u542F\u3002",
|
|
1397
1493
|
modelVisibleLabel: "\u5728\u4F1A\u8BDD\u4E2D\u663E\u793A {name}",
|
|
1398
1494
|
configurationMissing: "\u914D\u7F6E\u7F3A\u5931",
|
|
@@ -1404,7 +1500,6 @@ var zh = {
|
|
|
1404
1500
|
deprecatedHint: "models.dev \u6807\u8BB0\u4E3A\u5DF2\u5F03\u7528\uFF0C\u5F53\u524D\u7F51\u5173\u4ECD\u63D0\u4F9B\u6B64\u6A21\u578B\u3002",
|
|
1405
1501
|
newHint: "\u4F9D\u636E models.dev \u53D1\u5E03\u65E5\u671F\uFF0C\u8FD1\u4E03\u4E2A UTC \u65E5\u5386\u65E5\u5185\u53D1\u5E03\u3002",
|
|
1406
1502
|
newBadge: "\u65B0",
|
|
1407
|
-
releasedOn: "{date} \u53D1\u5E03",
|
|
1408
1503
|
releaseSource: "\u53D1\u5E03\u65E5\u671F\uFF1A{date} \xB7 models.dev",
|
|
1409
1504
|
modelDetails: "\u6A21\u578B\u914D\u7F6E",
|
|
1410
1505
|
filterLabel: "\u7B5B\u9009\u6A21\u578B",
|
|
@@ -1418,6 +1513,7 @@ var zh = {
|
|
|
1418
1513
|
limitsEmpty: "\u8BF7\u5148\u8BFB\u53D6\u6A21\u578B\u5217\u8868\uFF1B\u5BB9\u91CF\u6309\u7F51\u5173\u63D0\u4F9B\u7684\u6A21\u578B\u9010\u4E2A\u7F16\u8F91\u3002",
|
|
1419
1514
|
limitsContextLabel: "{name} \u7684\u4E0A\u4E0B\u6587\u7A97\u53E3",
|
|
1420
1515
|
limitsOutputLabel: "{name} \u7684\u6700\u5927\u8F93\u51FA",
|
|
1516
|
+
advancedSummary: "\u51ED\u8BC1\u5F15\u7528\u540D \xB7 \u7F51\u5173\u5730\u5740 \xB7 \u76EE\u5F55\u5237\u65B0 \xB7 \u6D41\u7A7A\u95F2\u8D85\u65F6 \xB7 \u56FE\u7247 4 \u9879",
|
|
1421
1517
|
advancedLabel: "\u9AD8\u7EA7\u8BBE\u7F6E",
|
|
1422
1518
|
advancedHint: "\u51ED\u8BC1\u540D\u79F0\u3001\u7F51\u5173\u5730\u5740\u4E0E\u9002\u914D\u5668\u8C03\u4F18\u53C2\u6570\u3002\u7EE7\u627F\u6765\u7684\u53D6\u503C\u5373\u53EF\u6B63\u5E38\u4F7F\u7528\uFF0C\u9664\u975E\u4F60\u660E\u786E\u77E5\u9053\u9700\u8981\u4FEE\u6539\uFF0C\u5426\u5219\u4E0D\u5FC5\u52A8\u8FD9\u91CC\u3002",
|
|
1423
1519
|
apiKeyEnvLabel: "\u51ED\u8BC1\u5F15\u7528\u540D",
|
|
@@ -1428,6 +1524,8 @@ var zh = {
|
|
|
1428
1524
|
refreshMinutesHint: "\u4F1A\u8BDD\u8BF7\u6C42\u548C\u6A21\u578B\u9009\u62E9\u5668\u7684\u76EE\u5F55\u7F13\u5B58\u65F6\u957F\u3002\u6253\u5F00\u672C\u8BBE\u7F6E\u9875\u6216\u70B9\u51FB\u5237\u65B0\u65F6\uFF0C\u4F1A\u7ACB\u5373\u6838\u5BF9\u7F51\u5173\u4E0E\u5728\u7EBF\u6A21\u578B\u914D\u7F6E\u3002",
|
|
1429
1525
|
streamIdleTimeoutMsLabel: "\u6D41\u7A7A\u95F2\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
|
|
1430
1526
|
streamIdleTimeoutMsHint: "\u6D41\u4E8B\u4EF6\u95F4\u5141\u8BB8\u7684\u6700\u5927\u9759\u9ED8\u95F4\u9694\uFF0C\u8D85\u51FA\u540E\u8BF7\u6C42\u5931\u8D25\u3002",
|
|
1527
|
+
maxImagesLabel: "\u8BF7\u6C42\u56FE\u7247\u6570\u91CF\u4E0A\u9650\uFF08maxImages\uFF09",
|
|
1528
|
+
maxImagesHint: "\u53EF\u9009\u6B63\u6574\u6570\uFF0C\u9ED8\u8BA4\u4E0D\u9650\u5236\u5F20\u6570\u3002\u8D85\u9650\u65F6\u5C06\u6700\u65E7\u56FE\u7247\u66FF\u6362\u4E3A\u6587\u5B57\u5360\u4F4D\u5E76\u7EE7\u7EED\u4F1A\u8BDD\uFF0C\u539F\u59CB\u9644\u4EF6\u4FDD\u7559\u3002DSH 0.1.6 \u53CA\u4EE5\u4E0A\u7248\u672C\u5DF2\u5378\u8F7D\u7684\u56FE\u7247\u4E0D\u4F1A\u56E0\u8C03\u9AD8\u6216\u6E05\u7A7A\u4E0A\u9650\u81EA\u52A8\u6062\u590D\u3002\u6E05\u7A7A\u540E\u7EE7\u627F\u57FA\u7840\u914D\u7F6E\u3002",
|
|
1431
1529
|
maxRequestImageBytesLabel: "\u8BF7\u6C42\u56FE\u7247\u8F7D\u8377\u4E0A\u9650\uFF08\u5B57\u8282\uFF09",
|
|
1432
1530
|
maxRequestImageBytesHint: "\u5355\u4E2A\u8BF7\u6C42\u7D2F\u8BA1 base64 \u56FE\u7247\u8F7D\u8377\u7684\u4E0A\u9650\u3002",
|
|
1433
1531
|
requestImagePixelBudgetLabel: "\u56FE\u7247\u50CF\u7D20\u9884\u7B97",
|
|
@@ -1493,16 +1591,16 @@ var goRemote = {
|
|
|
1493
1591
|
// src/client/UsagePill.tsx
|
|
1494
1592
|
var import_react3 = require("react");
|
|
1495
1593
|
|
|
1496
|
-
// plugin-css
|
|
1594
|
+
// plugin-css:src/client/UsagePill.module.css
|
|
1497
1595
|
var id2 = "dsh-opencode-go/UsagePill.module.css";
|
|
1498
1596
|
if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]")) {
|
|
1499
1597
|
const style = document.createElement("style");
|
|
1500
1598
|
style.dataset.plugin = "dsh-opencode-go";
|
|
1501
1599
|
style.dataset.pluginCss = id2;
|
|
1502
|
-
style.textContent = ".
|
|
1600
|
+
style.textContent = ".mAjYhq_root{min-width:0;display:inline-flex;position:relative}.mAjYhq_trigger{color:inherit;opacity:.75;font:inherit;cursor:pointer;white-space:nowrap;background:0 0;border:0;border-radius:6px;padding:4px 6px;font-size:12px}.mAjYhq_trigger:hover,.mAjYhq_trigger:focus-visible{opacity:1;background:color-mix(in srgb, currentColor 8%, transparent)}.mAjYhq_panel{z-index:100;box-sizing:border-box;border:1px solid color-mix(in srgb, currentColor 18%, transparent);width:280px;max-width:calc(100vw - 32px);max-height:70vh;color:var(--dsw-alias-label-primary,CanvasText);isolation:isolate;background-color:canvas;background-image:linear-gradient(var(--dsw-specific-menu,transparent), var(--dsw-specific-menu,transparent)), linear-gradient(var(--dsw-alias-bg-layer-2,Canvas), var(--dsw-alias-bg-layer-2,Canvas));border-radius:12px;padding:16px;font-size:12px;position:absolute;bottom:calc(100% + 12px);right:0;overflow-y:auto;box-shadow:0 8px 30px #0003}.mAjYhq_hint{opacity:.65;font-size:11px;line-height:1.6}.mAjYhq_warning{background:color-mix(in srgb, currentColor 6%, transparent);overflow-wrap:anywhere;border-radius:6px;margin:10px 0;padding:10px;line-height:1.5}.mAjYhq_warning p{margin:5px 0 0}.mAjYhq_retry{border:1px solid color-mix(in srgb, currentColor 25%, transparent);color:inherit;font:inherit;cursor:pointer;background:0 0;border-radius:6px;padding:5px 9px}.mAjYhq_retry:disabled{opacity:.6;cursor:default}.mAjYhq_retry:focus-visible{outline-offset:2px;outline:2px solid}.mAjYhq_window{margin-top:14px}.mAjYhq_row{justify-content:space-between;margin-bottom:5px;display:flex}.mAjYhq_window progress{appearance:none;background:color-mix(in srgb, currentColor 15%, transparent);border:0;border-radius:4px;width:100%;height:5px;margin-bottom:5px;display:block}.mAjYhq_window progress::-webkit-progress-bar{background:0 0;border-radius:4px}.mAjYhq_window progress::-webkit-progress-value{background:#39a878;border-radius:4px}.mAjYhq_window progress::-moz-progress-bar{background:#39a878;border-radius:4px}.mAjYhq_window progress.mAjYhq_high::-webkit-progress-value{background:#e0a100}.mAjYhq_window progress.mAjYhq_high::-moz-progress-bar{background:#e0a100}.mAjYhq_window progress.mAjYhq_limited::-webkit-progress-value{background:#e5484d}.mAjYhq_window progress.mAjYhq_limited::-moz-progress-bar{background:#e5484d}.mAjYhq_limitedText{color:#e5484d;margin-top:2px;font-weight:600}";
|
|
1503
1601
|
document.head.appendChild(style);
|
|
1504
1602
|
}
|
|
1505
|
-
var UsagePill_default = { "
|
|
1603
|
+
var UsagePill_default = { "high": "mAjYhq_high", "hint": "mAjYhq_hint", "limited": "mAjYhq_limited", "limitedText": "mAjYhq_limitedText", "panel": "mAjYhq_panel", "retry": "mAjYhq_retry", "root": "mAjYhq_root", "row": "mAjYhq_row", "trigger": "mAjYhq_trigger", "warning": "mAjYhq_warning", "window": "mAjYhq_window" };
|
|
1506
1604
|
|
|
1507
1605
|
// src/client/UsagePill.tsx
|
|
1508
1606
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -1517,6 +1615,10 @@ function usageFailure(error) {
|
|
|
1517
1615
|
}
|
|
1518
1616
|
return { retainPrevious: false };
|
|
1519
1617
|
}
|
|
1618
|
+
function usageLevel(window) {
|
|
1619
|
+
if (window.status === "rate-limited" || window.percent >= 100) return UsagePill_default.limited;
|
|
1620
|
+
return window.percent >= 80 ? UsagePill_default.high : void 0;
|
|
1621
|
+
}
|
|
1520
1622
|
function UsagePill({ directory, ...props }) {
|
|
1521
1623
|
const state = (0, import_react3.useSyncExternalStore)(directory.subscribe, directory.getSnapshot, directory.getSnapshot);
|
|
1522
1624
|
return state.current?.provider === "opencode-go" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ActiveUsage, { ...props }) : null;
|
|
@@ -1642,13 +1744,13 @@ function ActiveUsage({ readUsage, t, getLocale }) {
|
|
|
1642
1744
|
"%"
|
|
1643
1745
|
] })
|
|
1644
1746
|
] }),
|
|
1645
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("progress", { "aria-label": t(`usage_${key}`), max: 100, value: Math.min(100, usage[key].percent) }),
|
|
1747
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("progress", { className: usageLevel(usage[key]), "aria-label": t(`usage_${key}`), max: 100, value: Math.min(100, usage[key].percent) }),
|
|
1646
1748
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: UsagePill_default.hint, children: [
|
|
1647
1749
|
t("usageResets"),
|
|
1648
1750
|
" ",
|
|
1649
1751
|
new Date(usage[key].resetsAt).toLocaleString(getLocale?.())
|
|
1650
1752
|
] }),
|
|
1651
|
-
usage[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: t("usageLimited") })
|
|
1753
|
+
usage[key].status === "rate-limited" && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: UsagePill_default.limitedText, children: t("usageLimited") })
|
|
1652
1754
|
] }, key)) : failure ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("usageLoading") })
|
|
1653
1755
|
] })
|
|
1654
1756
|
] });
|