@surfishs/dsh-prompt-enhance 0.1.3 → 0.1.4
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/NOTICE +2 -0
- package/README.en.md +71 -36
- package/README.md +70 -35
- package/docs/images/panel-en.png +0 -0
- package/docs/images/panel.png +0 -0
- package/lib/client.js +216 -100
- package/lib/index.js +65 -19
- package/lib/index.js.map +2 -2
- package/package.json +2 -1
- package/src/client/EnhanceButton.tsx +30 -4
- package/src/client/ResultDock.tsx +7 -0
- package/src/client/ResultPanel.tsx +18 -8
- package/src/client/locales.ts +86 -68
- package/src/client/settings-page-copy.ts +18 -2
- package/src/client/settings-page-spec.ts +34 -8
- package/src/client/settings-page.tsx +33 -2
- package/src/client/styles.ts +17 -0
- package/src/client/ui-state.ts +12 -1
- package/src/config.ts +11 -4
- package/src/enhance-routes.ts +30 -2
- package/src/enhancer.ts +3 -1
- package/src/orchestrate.ts +15 -4
- package/src/prompts.ts +76 -5
- package/src/shared/protocol.ts +6 -0
- package/src/shared/validate.ts +7 -5
- package/docs/images/panel-en-915.png +0 -0
package/lib/client.js
CHANGED
|
@@ -396,7 +396,13 @@ function openLoading(state) {
|
|
|
396
396
|
}
|
|
397
397
|
function settleResult(sessionId, result) {
|
|
398
398
|
if (panelState?.sessionId !== sessionId || panelState.phase !== "loading") return;
|
|
399
|
-
panelState = {
|
|
399
|
+
panelState = {
|
|
400
|
+
sessionId,
|
|
401
|
+
phase: "result",
|
|
402
|
+
original: panelState.original,
|
|
403
|
+
result,
|
|
404
|
+
...panelState.attachments === void 0 ? {} : { attachments: panelState.attachments }
|
|
405
|
+
};
|
|
400
406
|
notify();
|
|
401
407
|
}
|
|
402
408
|
function settleError(sessionId, error) {
|
|
@@ -1001,6 +1007,9 @@ var OCCURRENCES_UNKNOWN = -1;
|
|
|
1001
1007
|
function occurrenceCountOf(value) {
|
|
1002
1008
|
return Array.isArray(value) ? value.length : OCCURRENCES_UNKNOWN;
|
|
1003
1009
|
}
|
|
1010
|
+
function attachmentCountOf(value) {
|
|
1011
|
+
return Array.isArray(value) ? value.length : 0;
|
|
1012
|
+
}
|
|
1004
1013
|
function stringOf(value) {
|
|
1005
1014
|
return typeof value === "string" ? value : "";
|
|
1006
1015
|
}
|
|
@@ -1011,6 +1020,7 @@ function EnhanceButton(props) {
|
|
|
1011
1020
|
const draft = useInput((state) => stringOf(state.draft));
|
|
1012
1021
|
const phase = useInput((state) => state.phase);
|
|
1013
1022
|
const occurrenceCount = useInput((state) => occurrenceCountOf(state.occurrences));
|
|
1023
|
+
const attachmentCount = useInput((state) => attachmentCountOf(state.attachmentIds));
|
|
1014
1024
|
const settings = (0, import_react4.useSyncExternalStore)(subscribeClientSettings, getClientSettings);
|
|
1015
1025
|
const panel = (0, import_react4.useSyncExternalStore)(subscribe, getPanel);
|
|
1016
1026
|
const rootRef = (0, import_react4.useRef)(null);
|
|
@@ -1196,13 +1206,19 @@ function EnhanceButton(props) {
|
|
|
1196
1206
|
openError(uiKey, source, { code: "rejected", localized: occurrences });
|
|
1197
1207
|
return;
|
|
1198
1208
|
}
|
|
1209
|
+
if (phase === "claimed") {
|
|
1210
|
+
const command = t("error.command");
|
|
1211
|
+
openError(uiKey, source, { code: "rejected", localized: command });
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1199
1214
|
if (phase !== "plain") {
|
|
1200
1215
|
const busyPhase = t("error.phase");
|
|
1201
1216
|
openError(uiKey, source, { code: "rejected", localized: busyPhase });
|
|
1202
1217
|
return;
|
|
1203
1218
|
}
|
|
1204
1219
|
const controller = new AbortController();
|
|
1205
|
-
|
|
1220
|
+
const attachments = attachmentCount > 0 ? { attachments: { count: attachmentCount } } : {};
|
|
1221
|
+
openLoading({ sessionId: uiKey, original: source, abort: () => controller.abort(), ...attachments });
|
|
1206
1222
|
const settle = (result) => settleResult(uiKey, result);
|
|
1207
1223
|
const fail = (error) => {
|
|
1208
1224
|
const detail = error instanceof EnhanceClientError ? error.detail : { code: "internal", message: error instanceof Error ? error.message : String(error) };
|
|
@@ -1210,7 +1226,7 @@ function EnhanceButton(props) {
|
|
|
1210
1226
|
};
|
|
1211
1227
|
if (settings.streaming) {
|
|
1212
1228
|
requestEnhanceStream(
|
|
1213
|
-
{ sessionId: wireId, text: source },
|
|
1229
|
+
{ sessionId: wireId, text: source, ...attachments },
|
|
1214
1230
|
{
|
|
1215
1231
|
signal: controller.signal,
|
|
1216
1232
|
onDelta: (delta) => appendDelta(uiKey, delta)
|
|
@@ -1218,9 +1234,9 @@ function EnhanceButton(props) {
|
|
|
1218
1234
|
).then(settle, fail);
|
|
1219
1235
|
return;
|
|
1220
1236
|
}
|
|
1221
|
-
requestEnhance({ sessionId: wireId, text: source }, controller.signal).then(settle, fail);
|
|
1237
|
+
requestEnhance({ sessionId: wireId, text: source, ...attachments }, controller.signal).then(settle, fail);
|
|
1222
1238
|
},
|
|
1223
|
-
[anyBusy, draft, occurrenceCount, phase, settings, uiKey, wireId, t]
|
|
1239
|
+
[anyBusy, draft, occurrenceCount, attachmentCount, phase, settings, uiKey, wireId, t]
|
|
1224
1240
|
);
|
|
1225
1241
|
const runRef = (0, import_react4.useRef)(start);
|
|
1226
1242
|
(0, import_react4.useEffect)(() => {
|
|
@@ -1492,7 +1508,7 @@ function totalTokensOf(usage) {
|
|
|
1492
1508
|
return usage.totalTokens ?? usage.inputTokens + usage.outputTokens + (usage.cacheReadTokens ?? 0) + (usage.cacheWriteTokens ?? 0);
|
|
1493
1509
|
}
|
|
1494
1510
|
function ContextUsageInfo(props) {
|
|
1495
|
-
const { usage, t } = props;
|
|
1511
|
+
const { usage, attachments, t } = props;
|
|
1496
1512
|
const [open, setOpen] = (0, import_react5.useState)(false);
|
|
1497
1513
|
const limited = usage !== void 0 && (usage.cutTurn || usage.limitedBy === "chars");
|
|
1498
1514
|
const percent = usage !== void 0 && usage.maxChars > 0 ? Math.round(usage.usedChars / usage.maxChars * 100) : 0;
|
|
@@ -1528,12 +1544,13 @@ function ContextUsageInfo(props) {
|
|
|
1528
1544
|
),
|
|
1529
1545
|
open && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { role: "tooltip", className: "dsh-pe-context-tip", children: [
|
|
1530
1546
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-context-stats", children: stats }),
|
|
1531
|
-
reason !== "" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-context-reason", children: reason })
|
|
1547
|
+
reason !== "" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-context-reason", children: reason }),
|
|
1548
|
+
attachments !== void 0 && attachments.count > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-context-attachments", children: t("panel.attachmentsCount", { count: attachments.count }) })
|
|
1532
1549
|
] })
|
|
1533
1550
|
] });
|
|
1534
1551
|
}
|
|
1535
1552
|
function ResultPanel(props) {
|
|
1536
|
-
const { state, t, onApply, onCancel, onRetry, applied = false, onUndo, onRegenerate, regenerated = false, collapsed = false, onToggleCollapsed, foldAnimation = true } = props;
|
|
1553
|
+
const { state, t, onApply, onCancel, onRetry, applied = false, onUndo, onRegenerate, draftEmpty = false, regenerated = false, collapsed = false, onToggleCollapsed, foldAnimation = true } = props;
|
|
1537
1554
|
const [copied, setCopied] = (0, import_react5.useState)("idle");
|
|
1538
1555
|
const copyTimer = (0, import_react5.useRef)(void 0);
|
|
1539
1556
|
const copy = (0, import_react5.useCallback)(() => {
|
|
@@ -1585,7 +1602,7 @@ function ResultPanel(props) {
|
|
|
1585
1602
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: tokenDetail(state.result.usage), children: t("panel.tokens", { total: formatTokens(totalTokensOf(state.result.usage)) }) })
|
|
1586
1603
|
] })
|
|
1587
1604
|
] }),
|
|
1588
|
-
collapsed && (state.stale === true || state.result?.truncated === true) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className:
|
|
1605
|
+
collapsed && (state.stale === true || state.result?.truncated === true) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: `dsh-pe-warn-dot${state.stale === true ? "" : " is-danger"}`, title: state.stale === true ? t("panel.stale.dot") : t("panel.truncated.dot"), "aria-hidden": "true", children: "\u26A0" }) : null,
|
|
1589
1606
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-collapse", "aria-label": collapsed ? t("panel.expand") : t("panel.collapse"), "aria-expanded": !collapsed, onClick: onToggleCollapsed, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChevronIcon, { open: !collapsed }) }),
|
|
1590
1607
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-close", "aria-label": t("panel.close"), onClick: onCancel, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(XIcon, {}) })
|
|
1591
1608
|
] })
|
|
@@ -1607,25 +1624,36 @@ function ResultPanel(props) {
|
|
|
1607
1624
|
state.error.message !== void 0 && state.error.message !== "" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsh-pe-error-detail", children: state.error.message })
|
|
1608
1625
|
] }) }),
|
|
1609
1626
|
state.phase === "result" && state.result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dsh-pe-result", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("pre", { className: "dsh-pe-result-text", children: state.result.text }) }),
|
|
1610
|
-
state.phase === "result" && state.result?.truncated === true && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsh-pe-stale", children: [
|
|
1627
|
+
state.phase === "result" && state.result?.truncated === true && !state.stale && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsh-pe-stale dsh-pe-truncated", children: [
|
|
1611
1628
|
"\u26A0 ",
|
|
1612
1629
|
t("panel.truncated")
|
|
1613
1630
|
] }),
|
|
1614
1631
|
state.phase === "result" && state.stale && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dsh-pe-stale", children: [
|
|
1615
1632
|
"\u26A0 ",
|
|
1616
|
-
t("panel.stale.warn")
|
|
1633
|
+
t(draftEmpty ? "panel.stale.empty" : "panel.stale.warn")
|
|
1617
1634
|
] })
|
|
1618
1635
|
] }) }),
|
|
1619
1636
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("footer", { className: "dsh-pe-foot", children: [
|
|
1620
|
-
state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ContextUsageInfo, { usage: state.result?.context, t }),
|
|
1637
|
+
state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ContextUsageInfo, { usage: state.result?.context, attachments: state.attachments, t }),
|
|
1621
1638
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "dsh-pe-grow" }),
|
|
1622
|
-
state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1639
|
+
state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1640
|
+
"button",
|
|
1641
|
+
{
|
|
1642
|
+
type: "button",
|
|
1643
|
+
className: "dsh-pe-btn-action plain dsh-pe-btn-floor",
|
|
1644
|
+
onClick: onRegenerate,
|
|
1645
|
+
disabled: onRegenerate === void 0,
|
|
1646
|
+
"aria-disabled": draftEmpty || void 0,
|
|
1647
|
+
title: draftEmpty ? t("panel.regenerate.empty") : void 0,
|
|
1648
|
+
children: [
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RegenerateIcon, {}),
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "dsh-pe-swap", children: [
|
|
1651
|
+
swapLabel(!regenerated, t("panel.regenerate")),
|
|
1652
|
+
swapLabel(regenerated, t("panel.regenerated"))
|
|
1653
|
+
] })
|
|
1654
|
+
]
|
|
1655
|
+
}
|
|
1656
|
+
),
|
|
1629
1657
|
state.phase === "error" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: retryable(state.error) && onRetry !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-btn-action plain dsh-pe-btn-floor", onClick: onRetry, children: t("panel.retry") }) }),
|
|
1630
1658
|
state.phase === "loading" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "dsh-pe-btn-action plain dsh-pe-btn-floor", onClick: onCancel, children: t("panel.cancel") }),
|
|
1631
1659
|
state.phase === "result" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
@@ -1774,6 +1802,7 @@ function ResultDock(props) {
|
|
|
1774
1802
|
const value = state.draft;
|
|
1775
1803
|
return typeof value === "string" ? value : "";
|
|
1776
1804
|
});
|
|
1805
|
+
const draftEmpty = draft.trim() === "";
|
|
1777
1806
|
const phase = useInput((state) => {
|
|
1778
1807
|
const value = state.phase;
|
|
1779
1808
|
return typeof value === "string" ? value : "";
|
|
@@ -1842,6 +1871,7 @@ function ResultDock(props) {
|
|
|
1842
1871
|
};
|
|
1843
1872
|
const regenerate = () => {
|
|
1844
1873
|
if (panel.phase !== "result") return;
|
|
1874
|
+
if (draftEmpty) return;
|
|
1845
1875
|
setRegeneratedNotice(false);
|
|
1846
1876
|
previousResultRef.current = panel.result;
|
|
1847
1877
|
pendingRegenerate.current = true;
|
|
@@ -1854,6 +1884,7 @@ function ResultDock(props) {
|
|
|
1854
1884
|
t,
|
|
1855
1885
|
applied,
|
|
1856
1886
|
regenerated: regeneratedNotice,
|
|
1887
|
+
draftEmpty,
|
|
1857
1888
|
collapsed: panel.collapsed === true,
|
|
1858
1889
|
onToggleCollapsed: () => setCollapsed(uiKey, panel.collapsed !== true),
|
|
1859
1890
|
foldAnimation: settings.foldAnimation,
|
|
@@ -1931,6 +1962,7 @@ var zh = {
|
|
|
1931
1962
|
"panel.enhanced": "\u589E\u5F3A\u7ED3\u679C",
|
|
1932
1963
|
"panel.apply": "\u56DE\u586B\u5230\u8F93\u5165\u6846",
|
|
1933
1964
|
"panel.regenerate": "\u91CD\u65B0\u751F\u6210",
|
|
1965
|
+
"panel.regenerate.empty": "\u8BF7\u5148\u8F93\u5165\u6587\u5B57\u540E\u518D\u91CD\u65B0\u751F\u6210",
|
|
1934
1966
|
"panel.regenerated": "\u5DF2\u91CD\u65B0\u751F\u6210",
|
|
1935
1967
|
"panel.copy": "\u590D\u5236\u7ED3\u679C",
|
|
1936
1968
|
"panel.copied": "\u5DF2\u590D\u5236",
|
|
@@ -1939,13 +1971,17 @@ var zh = {
|
|
|
1939
1971
|
"panel.collapse": "\u6298\u53E0",
|
|
1940
1972
|
"panel.expand": "\u5C55\u5F00",
|
|
1941
1973
|
"panel.retry": "\u91CD\u8BD5",
|
|
1942
|
-
"panel.stale.warn": "\u8349\u7A3F\u5DF2\u6539\u52A8\
|
|
1943
|
-
"panel.
|
|
1974
|
+
"panel.stale.warn": "\u8349\u7A3F\u5DF2\u6539\u52A8\uFF1A\u5F53\u524D\u7ED3\u679C\u57FA\u4E8E\u65E7\u6587\u672C\u3002\u300C\u91CD\u65B0\u751F\u6210\u300D\u4F1A\u6309\u5F53\u524D\u6587\u672C\u91CD\u8DD1\uFF1B\u56DE\u586B\u4F1A\u8986\u76D6\u4F60\u540E\u6765\u7684\u4FEE\u6539\uFF08\u53EF\u64A4\u9500\uFF09\u3002",
|
|
1975
|
+
"panel.stale.empty": "\u8349\u7A3F\u5DF2\u6539\u52A8\uFF1A\u5F53\u524D\u4E3A\u7A7A\u3002\u300C\u91CD\u65B0\u751F\u6210\u300D\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5148\u8F93\u5165\u6587\u5B57\uFF1B\u56DE\u586B\u4F1A\u8986\u76D6\u4F60\u540E\u6765\u7684\u4FEE\u6539\uFF08\u53EF\u64A4\u9500\uFF09\u3002",
|
|
1976
|
+
"panel.stale.dot": "\u8349\u7A3F\u5DF2\u6539\u52A8",
|
|
1977
|
+
"panel.truncated": "\u8F93\u51FA\u5DF2\u8FBE\u5230\u300C\u8F93\u51FA token \u4E0A\u9650\u300D\uFF0C\u7ED3\u679C\u53EF\u80FD\u4E0D\u5B8C\u6574\u3002\u8BF7\u5728\u8BBE\u7F6E\u91CC\u8C03\u9AD8\u8BE5\u4E0A\u9650\u540E\u518D\u91CD\u65B0\u751F\u6210\u3002",
|
|
1978
|
+
"panel.truncated.dot": "\u8F93\u51FA\u88AB\u622A\u65AD",
|
|
1944
1979
|
"panel.contextUsage": "\u4E0A\u4E0B\u6587\u7528\u91CF",
|
|
1945
1980
|
"panel.contextStats": "\u4E0A\u4E0B\u6587 {turns}/{maxTurns} \u6761 \xB7 {chars}/{maxChars} \u5B57\uFF08{percent}%\uFF09",
|
|
1946
1981
|
"panel.contextCharsLimited": "\u5DF2\u8FBE\u5B57\u6570\u4E0A\u9650\uFF0C\u8F83\u65E9\u5185\u5BB9\u672A\u53D1\u9001",
|
|
1947
1982
|
"panel.contextCut": "\u5DF2\u8FBE\u5B57\u6570\u4E0A\u9650\uFF0C\u6700\u65B0\u4E00\u6761\u4EC5\u53D1\u9001\u4E86\u5F00\u5934",
|
|
1948
1983
|
"panel.contextUnused": "\u672C\u6B21\u672A\u4F7F\u7528\u4E0A\u4E0B\u6587",
|
|
1984
|
+
"panel.attachmentsCount": "\u9644\u4EF6\uFF1A{count} \u4E2A",
|
|
1949
1985
|
"panel.model": "\u6A21\u578B\uFF1A{provider} / {model}",
|
|
1950
1986
|
"panel.elapsed": "\u8017\u65F6 {ms}",
|
|
1951
1987
|
"panel.tokens": "{total} tokens",
|
|
@@ -1957,34 +1993,35 @@ var zh = {
|
|
|
1957
1993
|
"undo.applied": "\u5DF2\u66FF\u6362\u539F\u63D0\u793A\u8BCD",
|
|
1958
1994
|
"undo.undo": "\u64A4\u9500",
|
|
1959
1995
|
"undo.dismiss": "\u5173\u95ED\u63D0\u793A",
|
|
1960
|
-
"error.empty": "\u8F93\u5165\u6846\
|
|
1961
|
-
"error.tooLong": "\
|
|
1962
|
-
"error.occurrences": "\
|
|
1963
|
-
"error.chipsUnknown": "\
|
|
1964
|
-
"error.phase": "\
|
|
1965
|
-
"error.
|
|
1966
|
-
"error.
|
|
1967
|
-
"error.
|
|
1968
|
-
"error.
|
|
1969
|
-
"error.
|
|
1970
|
-
"error.
|
|
1971
|
-
"error.
|
|
1972
|
-
"error.
|
|
1973
|
-
"error.client.
|
|
1974
|
-
"error.client.
|
|
1975
|
-
"error.client.
|
|
1976
|
-
"error.client.
|
|
1977
|
-
"error.
|
|
1978
|
-
"error.
|
|
1979
|
-
"error.
|
|
1980
|
-
"error.
|
|
1981
|
-
"error.upstream.
|
|
1982
|
-
"error.upstream.
|
|
1983
|
-
"error.upstream.
|
|
1984
|
-
"error.upstream.
|
|
1985
|
-
"error.upstream.
|
|
1986
|
-
"error.upstream.
|
|
1987
|
-
"error.upstream.
|
|
1996
|
+
"error.empty": "\u8F93\u5165\u6846\u662F\u7A7A\u7684\uFF0C\u8BF7\u5148\u8F93\u5165\u8981\u589E\u5F3A\u7684\u6587\u5B57\u3002",
|
|
1997
|
+
"error.tooLong": "\u8349\u7A3F\u5171 {count} \u5B57\uFF0C\u8D85\u8FC7 {max} \u5B57\u4E0A\u9650\uFF08\u6309\u5B57\u7B26\u8BA1\uFF0C\u4E0D\u662F token\uFF09\u3002\u4E0D\u4F1A\u81EA\u52A8\u622A\u65AD\uFF0C\u8BF7\u7CBE\u7B80\u540E\u518D\u8BD5\u3002",
|
|
1998
|
+
"error.occurrences": "\u8349\u7A3F\u91CC\u6709\u6587\u4EF6\u6216\u4F1A\u8BDD\u5F15\u7528\uFF0C\u6682\u4E0D\u652F\u6301\u589E\u5F3A\uFF1B\u8BF7\u5148\u79FB\u9664\u5F15\u7528\uFF0C\u589E\u5F3A\u540E\u518D\u624B\u52A8\u63D2\u56DE\u3002",
|
|
1999
|
+
"error.chipsUnknown": "\u8BFB\u4E0D\u5230\u8F93\u5165\u6846\u91CC\u7684\u5F15\u7528\u72B6\u6001\u3002\u4E3A\u907F\u514D\u56DE\u586B\u65F6\u8986\u76D6\u4F60\u7684\u547D\u4EE4\u6216\u6587\u4EF6\u5F15\u7528\uFF0C\u672C\u6B21\u6CA1\u6709\u6267\u884C\uFF1B\u8BF7\u6539\u6210\u7EAF\u6587\u672C\u540E\u518D\u8BD5\u3002",
|
|
2000
|
+
"error.phase": "\u8F93\u5165\u6846\u6B63\u5728\u63D0\u4EA4\u6216\u6821\u9A8C\u4E2D\uFF0C\u8BF7\u7B49\u5B83\u7ED3\u675F\u540E\u518D\u8BD5\u3002",
|
|
2001
|
+
"error.command": "\u8349\u7A3F\u4EE5\u547D\u4EE4\u5757\u5F00\u5934\uFF08\u5982 /\u8BA1\u5212\uFF09\uFF0C\u6682\u4E0D\u652F\u6301\u589E\u5F3A\uFF1B\u8BF7\u5148\u79FB\u9664\u547D\u4EE4\u5757\uFF0C\u518D\u5355\u72EC\u589E\u5F3A\u6B63\u6587\u3002",
|
|
2002
|
+
"error.disabled": "\u63D0\u793A\u8BCD\u589E\u5F3A\u5DF2\u5728\u63D2\u4EF6\u8BBE\u7F6E\u4E2D\u5173\u95ED\uFF1B\u8BF7\u5728\u8BBE\u7F6E\u91CC\u91CD\u65B0\u5F00\u542F\u540E\u518D\u8BD5\u3002",
|
|
2003
|
+
"error.rejected": "\u8FD9\u6B21\u589E\u5F3A\u88AB\u62D2\u7EDD\u4E86\u3002\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B\u5982\u679C\u4E00\u76F4\u5982\u6B64\uFF0C\u8BF7\u68C0\u67E5\u63D2\u4EF6\u8BBE\u7F6E\u3002",
|
|
2004
|
+
"error.timeout": "\u7B49\u4E86 {seconds} \u79D2\u4ECD\u6CA1\u6709\u7ED3\u679C\uFF0C\u672C\u6B21\u5DF2\u53D6\u6D88\u3002\u53EF\u4EE5\u91CD\u8BD5\uFF0C\u6216\u5230\u8BBE\u7F6E\u91CC\u8C03\u5927\u300C\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\u300D\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
|
|
2005
|
+
"error.unconfigured": "\u8FD8\u6CA1\u786E\u5B9A\u7528\u54EA\u4E2A\u6A21\u578B\uFF1A\u8BF7\u5728\u63D2\u4EF6\u8BBE\u7F6E\u91CC\u586B\u597D provider \u548C model\uFF08\u4E24\u9879\u90FD\u8981\u586B\uFF09\uFF0C\u6216\u5148\u5728\u5F53\u524D\u4F1A\u8BDD\u53D1\u4E00\u6761\u6D88\u606F\uFF0C\u8BA9\u589E\u5F3A\u8DDF\u968F\u4F1A\u8BDD\u6A21\u578B\u3002",
|
|
2006
|
+
"error.effortUnsupported": "\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u6240\u9009\u63A8\u7406\u6863\u4F4D\u300C{effort}\u300D\uFF1B\u8BF7\u6362\u4E00\u4E2A\u6863\u4F4D\uFF0C\u6216\u6539\u7528\u300C\u6A21\u578B\u9ED8\u8BA4\u300D\u3002",
|
|
2007
|
+
"error.upstream": "\u6A21\u578B\u670D\u52A1\u8FD4\u56DE\u4E86\u9519\u8BEF\u3002\u4E0B\u65B9\u6709\u8BE6\u60C5\u65F6\u6309\u8BE6\u60C5\u5904\u7406\uFF0C\u5426\u5219\u53EF\u4EE5\u76F4\u63A5\u91CD\u8BD5\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
|
|
2008
|
+
"error.internal": "\u589E\u5F3A\u5931\u8D25\u3002\u8BF7\u91CD\u8BD5\uFF1B\u5982\u679C\u53CD\u590D\u5931\u8D25\uFF0C\u8BF7\u67E5\u770B DSH \u8FD0\u884C\u65E5\u5FD7\u3002\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
|
|
2009
|
+
"error.client.unreachable": "\u8FDE\u4E0D\u4E0A DSH \u670D\u52A1\uFF1A\u8BF7\u786E\u8BA4 DSH \u6B63\u5728\u8FD0\u884C\uFF0C\u7136\u540E\u91CD\u8BD5\u3002",
|
|
2010
|
+
"error.client.malformed": "DSH \u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u6570\u636E\u3002\u8BF7\u91CD\u8BD5\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
|
|
2011
|
+
"error.client.refused": "DSH \u62D2\u7EDD\u4E86\u8FD9\u6B21\u8BF7\u6C42\uFF08HTTP {status}\uFF09\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
2012
|
+
"error.client.streamClosed": "\u7ED3\u679C\u8FD4\u56DE\u524D\u8FDE\u63A5\u65AD\u5F00\u4E86\u3002\u8BF7\u91CD\u8BD5\uFF1B\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
|
|
2013
|
+
"error.client.cancelled": "\u5DF2\u53D6\u6D88\u589E\u5F3A\uFF0C\u4F60\u7684\u8F93\u5165\u6CA1\u6709\u88AB\u6539\u52A8\u3002",
|
|
2014
|
+
"error.rateLimit": "\u64CD\u4F5C\u592A\u9891\u7E41\uFF1A\u6BCF\u5206\u949F\u6700\u591A {limit} \u6B21\u589E\u5F3A\u3002\u8BF7\u7B49 {retryAfterSeconds} \u79D2\u518D\u8BD5\u3002",
|
|
2015
|
+
"error.concurrencyLimit": "\u540C\u65F6\u6700\u591A {max} \u4E2A\u589E\u5F3A\u5728\u8FDB\u884C\u4E2D\uFF0C\u8BF7\u7B49\u5176\u4E2D\u4E00\u4E2A\u5B8C\u6210\u540E\u518D\u8BD5\u3002",
|
|
2016
|
+
"error.cooldown": "\u8FDE\u7EED {failures} \u6B21\u589E\u5F3A\u5931\u8D25\uFF0C\u5DF2\u6682\u505C {retryAfterSeconds} \u79D2\uFF0C\u907F\u514D\u7EE7\u7EED\u8BF7\u6C42\u6A21\u578B\u670D\u52A1\u3002\u53EF\u4EE5\u5148\u68C0\u67E5\u6A21\u578B\u914D\u7F6E\uFF0C\u7A0D\u540E\u518D\u8BD5\u3002",
|
|
2017
|
+
"error.upstream.auth": "\u6A21\u578B\u670D\u52A1\u9274\u6743\u5931\u8D25\uFF1A\u8BF7\u68C0\u67E5\u8BE5 provider \u7684 API Key\u3002",
|
|
2018
|
+
"error.upstream.invalidCredential": "\u6A21\u578B\u670D\u52A1\u9274\u6743\u5931\u8D25\uFF1A\u4FDD\u5B58\u7684 API Key \u4E0D\u53EF\u7528\uFF0C\u8BF7\u66F4\u65B0\u540E\u91CD\u8BD5\u3002",
|
|
2019
|
+
"error.upstream.rateLimit": "\u6A21\u578B\u670D\u52A1\u6B63\u5728\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",
|
|
2020
|
+
"error.upstream.quota": "\u6A21\u578B\u670D\u52A1\u4F59\u989D\u6216\u914D\u989D\u4E0D\u8DB3\uFF0C\u8BF7\u68C0\u67E5\u8D26\u6237\u3002",
|
|
2021
|
+
"error.upstream.empty": "\u6A21\u578B\u8FD4\u56DE\u4E86\u7A7A\u7ED3\u679C\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
2022
|
+
"error.upstream.contextWindow": "\u5185\u5BB9\u8D85\u51FA\u6A21\u578B\u7684\u4E0A\u4E0B\u6587\u7A97\u53E3\uFF0C\u8BF7\u7CBE\u7B80\u539F\u6587\u6216\u6362\u4E00\u4E2A\u6A21\u578B\u3002",
|
|
2023
|
+
"error.upstream.toolCall": "\u6A21\u578B\u5C1D\u8BD5\u8C03\u7528\u5DE5\u5177\uFF0C\u800C\u63D0\u793A\u8BCD\u589E\u5F3A\u53EA\u9700\u8981\u7EAF\u6587\u672C\uFF1B\u8BF7\u6362\u4E00\u4E2A\u6A21\u578B\u540E\u91CD\u8BD5\u3002",
|
|
2024
|
+
"error.upstream.maxTokens": "\u7ED3\u679C\u8FBE\u5230\u4E86\u300C\u8F93\u51FA token \u4E0A\u9650\u300D\u3002\u8BF7\u8C03\u9AD8\u8BE5\u8BBE\u7F6E\uFF0C\u6216\u7CBE\u7B80\u539F\u6587\u540E\u91CD\u8BD5\u3002",
|
|
1988
2025
|
"settings.summary": "\u6A21\u578B\u3001\u4E0A\u4E0B\u6587\u4E0E\u8D44\u6E90\u9650\u5236",
|
|
1989
2026
|
"settings.title": "\u63D0\u793A\u8BCD\u589E\u5F3A",
|
|
1990
2027
|
"settings.description": "\u628A\u8F93\u5165\u6846\u8349\u7A3F\u6539\u5199\u4E3A\u7ED3\u6784\u5316\u63D0\u793A\u8BCD\uFF1A\u89D2\u8272\u4E0E\u76EE\u6807\u3001\u53EF\u6267\u884C\u6B65\u9AA4\u3001\u8F93\u51FA\u683C\u5F0F\u3001\u9A8C\u6536\u6807\u51C6\u3001\u8FB9\u754C\u6761\u4EF6\u3002\u539F\u6587\u4FDD\u7559\uFF0C\u5931\u8D25\u4E0D\u6539\u8349\u7A3F\uFF1B\u4FDD\u5B58\u540E\u4E0B\u4E00\u6B21\u8C03\u7528\u5373\u751F\u6548\u3002",
|
|
@@ -2007,7 +2044,7 @@ var zh = {
|
|
|
2007
2044
|
"settings.row.enabled.label": "\u603B\u5F00\u5173",
|
|
2008
2045
|
"settings.row.enabled.hint": "\u5173\u95ED\u540E\u9690\u85CF\u8F93\u5165\u6846\u7684\u589E\u5F3A\u6309\u94AE\uFF0C\u547D\u4EE4\u4E0E\u5FEB\u6377\u952E\u4E00\u5E76\u505C\u7528\u3002",
|
|
2009
2046
|
"settings.row.contextAware.label": "\u4E0A\u4E0B\u6587\u611F\u77E5",
|
|
2010
|
-
"settings.row.contextAware.hint": "\u8BFB\u53D6\u5F53\u524D\u4F1A\u8BDD\u6700\u8FD1\u51E0\
|
|
2047
|
+
"settings.row.contextAware.hint": "\u8BFB\u53D6\u5F53\u524D\u4F1A\u8BDD\u6700\u8FD1\u51E0\u6761\u6D88\u606F\u6765\u6D88\u89E3\u6307\u4EE3\u3001\u8865\u5168\u7701\u7565\uFF1B\u65E0\u5386\u53F2\u65F6\u56DE\u9000\u4E3A\u5355\u6761\u589E\u5F3A\u3002",
|
|
2011
2048
|
"settings.row.streaming.label": "\u589E\u91CF\u5C55\u793A",
|
|
2012
2049
|
"settings.row.streaming.hint": "\u6A21\u578B\u8FB9\u5199\u8FB9\u5728\u9762\u677F\u663E\u793A\uFF1B\u4EC5\u5F71\u54CD\u663E\u793A\u8282\u594F\uFF0C\u6700\u7EC8\u5199\u5165\u7684\u6587\u672C\u4E0D\u53D8\u3002",
|
|
2013
2050
|
"settings.row.foldAnimation.label": "\u5361\u7247\u6298\u53E0\u52A8\u753B",
|
|
@@ -2043,6 +2080,9 @@ var zh = {
|
|
|
2043
2080
|
"settings.row.reasoningEffort.hint": "\u6863\u4F4D\u9009\u9879\u6765\u81EA\u5F53\u524D provider/model \u7684\u58F0\u660E\uFF1B\u81EA\u5B9A\u4E49\u6A21\u578B\u65F6\u6309\u9700\u8BFB\u53D6\u3002\u300C\u6A21\u578B\u9ED8\u8BA4\u300D\u8868\u793A\u4E0D\u53D1\u9001\u8BE5\u5B57\u6BB5\uFF0C\u7531\u63D0\u4F9B\u65B9\u4F7F\u7528\u9ED8\u8BA4\u6863\u3002",
|
|
2044
2081
|
"settings.row.maxOutputTokens.label": "\u8F93\u51FA token \u4E0A\u9650",
|
|
2045
2082
|
"settings.row.maxOutputTokens.hint": "\u5355\u6B21\u589E\u5F3A\u7684\u8F93\u51FA\u9884\u7B97\uFF1B\u9ED8\u8BA4 8192\u3002",
|
|
2083
|
+
"settings.row.invalidInteger": "\u8BF7\u8F93\u5165 {min}\u2013{max} \u4E4B\u95F4\u7684\u6574\u6570",
|
|
2084
|
+
"settings.row.invalidNumber": "\u8BF7\u8F93\u5165 {min}\u2013{max} \u4E4B\u95F4\u7684\u6570\u5B57",
|
|
2085
|
+
"settings.row.blankDefault": "\u7559\u7A7A = \u4F7F\u7528\u9ED8\u8BA4\u503C {value}",
|
|
2046
2086
|
"settings.row.maxInputChars.label": "\u8F93\u5165\u5B57\u7B26\u4E0A\u9650",
|
|
2047
2087
|
"settings.row.maxInputChars.hint": "\u8D85\u51FA\u76F4\u63A5\u62D2\u7EDD\u3001\u4E0D\u622A\u65AD\uFF1B\u9ED8\u8BA4 12000\u3002",
|
|
2048
2088
|
"settings.row.timeoutMs.label": "\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
|
|
@@ -2053,7 +2093,7 @@ var zh = {
|
|
|
2053
2093
|
"settings.row.systemPrompt.hint": "\u7559\u7A7A\u4F7F\u7528\u5185\u7F6E\u589E\u5F3A\u7B56\u7565\u3002",
|
|
2054
2094
|
"settings.row.systemPrompt.placeholder": "\u4F8B\uFF1A\u628A\u7528\u6237\u7684\u4E2D\u6587\u8F93\u5165\u7FFB\u8BD1\u6210\u82F1\u6587\u3002",
|
|
2055
2095
|
"settings.row.contextMaxMessages.label": "\u4E0A\u4E0B\u6587\u6D88\u606F\u6761\u6570",
|
|
2056
|
-
"settings.row.contextMaxMessages.hint": "\u6700\u591A\u53C2\u8003\u6700\u8FD1\u591A\u5C11\
|
|
2096
|
+
"settings.row.contextMaxMessages.hint": "\u6700\u591A\u53C2\u8003\u6700\u8FD1\u591A\u5C11\u6761\u6D88\u606F\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003\uFF1B\u9ED8\u8BA4 8\u3002",
|
|
2057
2097
|
"settings.row.contextMaxChars.label": "\u4E0A\u4E0B\u6587\u5B57\u7B26\u4E0A\u9650",
|
|
2058
2098
|
"settings.row.contextMaxChars.hint": "\u5386\u53F2\u7247\u6BB5\u7684\u5B57\u7B26\u9884\u7B97\uFF1B0 \u8868\u793A\u4E0D\u53C2\u8003\uFF1B\u9ED8\u8BA4 4000\u3002",
|
|
2059
2099
|
"settings.row.maxConcurrent.label": "\u5E76\u53D1\u4E0A\u9650",
|
|
@@ -2104,6 +2144,7 @@ var en = {
|
|
|
2104
2144
|
"panel.enhanced": "Enhanced result",
|
|
2105
2145
|
"panel.apply": "Fill into input box",
|
|
2106
2146
|
"panel.regenerate": "Regenerate",
|
|
2147
|
+
"panel.regenerate.empty": "Type some text before regenerating",
|
|
2107
2148
|
"panel.regenerated": "Regenerated",
|
|
2108
2149
|
"panel.copy": "Copy result",
|
|
2109
2150
|
"panel.copied": "Copied",
|
|
@@ -2112,13 +2153,17 @@ var en = {
|
|
|
2112
2153
|
"panel.collapse": "Collapse",
|
|
2113
2154
|
"panel.expand": "Expand",
|
|
2114
2155
|
"panel.retry": "Retry",
|
|
2115
|
-
"panel.stale.warn": "Draft changed
|
|
2116
|
-
"panel.
|
|
2156
|
+
"panel.stale.warn": "Draft changed: this result uses the earlier text. Regenerate re-runs on the current draft; filling into the input box overwrites your later edits (undoable).",
|
|
2157
|
+
"panel.stale.empty": "Draft changed: it is now empty. Regenerate is unavailable \u2014 type some text first; filling into the input box overwrites your later edits (undoable).",
|
|
2158
|
+
"panel.stale.dot": "Draft changed",
|
|
2159
|
+
"panel.truncated": 'The output hit the "Output token budget" limit, so the result may be incomplete. Raise that limit in the settings, then regenerate.',
|
|
2160
|
+
"panel.truncated.dot": "Output truncated",
|
|
2117
2161
|
"panel.contextUsage": "Context usage",
|
|
2118
|
-
"panel.contextStats": "Context {turns}/{maxTurns}
|
|
2119
|
-
"panel.contextCharsLimited": "Character cap reached; earlier
|
|
2120
|
-
"panel.contextCut": "Character limit reached; only the opening of the latest
|
|
2162
|
+
"panel.contextStats": "Context {turns}/{maxTurns} messages \xB7 {chars}/{maxChars} chars ({percent}%)",
|
|
2163
|
+
"panel.contextCharsLimited": "Character cap reached; earlier messages were not sent",
|
|
2164
|
+
"panel.contextCut": "Character limit reached; only the opening of the latest message was sent",
|
|
2121
2165
|
"panel.contextUnused": "No conversation context was used for this call",
|
|
2166
|
+
"panel.attachmentsCount": "Attachments: {count}",
|
|
2122
2167
|
"panel.model": "Model: {provider} / {model}",
|
|
2123
2168
|
"panel.elapsed": "{ms} elapsed",
|
|
2124
2169
|
"panel.tokens": "{total} tokens",
|
|
@@ -2130,34 +2175,35 @@ var en = {
|
|
|
2130
2175
|
"undo.applied": "Original draft replaced",
|
|
2131
2176
|
"undo.undo": "Undo",
|
|
2132
2177
|
"undo.dismiss": "Dismiss",
|
|
2133
|
-
"error.empty": "The input box is empty \u2014 type
|
|
2134
|
-
"error.tooLong": "The draft is {count} characters, over the {max} limit (characters, not tokens)
|
|
2135
|
-
"error.occurrences": "The draft contains
|
|
2136
|
-
"error.chipsUnknown": "The composer reference state could not be read
|
|
2137
|
-
"error.phase": "The input box is busy
|
|
2138
|
-
"error.
|
|
2139
|
-
"error.
|
|
2140
|
-
"error.
|
|
2141
|
-
"error.
|
|
2142
|
-
"error.
|
|
2143
|
-
"error.
|
|
2144
|
-
"error.
|
|
2145
|
-
"error.
|
|
2146
|
-
"error.client.
|
|
2147
|
-
"error.client.
|
|
2148
|
-
"error.client.
|
|
2149
|
-
"error.client.
|
|
2150
|
-
"error.
|
|
2151
|
-
"error.
|
|
2152
|
-
"error.
|
|
2153
|
-
"error.
|
|
2154
|
-
"error.upstream.
|
|
2155
|
-
"error.upstream.
|
|
2156
|
-
"error.upstream.
|
|
2157
|
-
"error.upstream.
|
|
2158
|
-
"error.upstream.
|
|
2159
|
-
"error.upstream.
|
|
2160
|
-
"error.upstream.
|
|
2178
|
+
"error.empty": "The input box is empty \u2014 type the text you want enhanced first.",
|
|
2179
|
+
"error.tooLong": "The draft is {count} characters, over the {max}-character limit (characters, not tokens). It is never truncated automatically \u2014 shorten it and try again.",
|
|
2180
|
+
"error.occurrences": "The draft contains file or session references, which are not supported yet \u2014 remove them first, then re-insert them after enhancing.",
|
|
2181
|
+
"error.chipsUnknown": "The composer reference state could not be read. To avoid overwriting your command or file reference on fill-back, nothing was run \u2014 use plain text and try again.",
|
|
2182
|
+
"error.phase": "The input box is busy submitting or checking \u2014 wait for it to finish, then try again.",
|
|
2183
|
+
"error.command": "The draft starts with a command chip (for example /plan), which is not supported yet \u2014 remove the command first, then enhance the body on its own.",
|
|
2184
|
+
"error.disabled": "Prompt enhance is turned off in the plugin settings \u2014 re-enable it there and try again.",
|
|
2185
|
+
"error.rejected": "This enhancement was refused. Retry later; if it keeps happening, check the plugin settings.",
|
|
2186
|
+
"error.timeout": 'No result after {seconds}s, so this call was cancelled. Retry, or raise "Timeout (ms)" in the settings; your input was not changed.',
|
|
2187
|
+
"error.unconfigured": "No model is configured yet: fill in both provider and model in the plugin settings, or send a message in the current session first so the enhancement follows the session model.",
|
|
2188
|
+
"error.effortUnsupported": 'The current model does not support the selected reasoning effort "{effort}" \u2014 choose another tier, or use "Model default".',
|
|
2189
|
+
"error.upstream": "The model provider returned an error. If there is detail below, act on it; otherwise retry. Your input was not changed.",
|
|
2190
|
+
"error.internal": "Enhancement failed. Retry; if it keeps failing, check the DSH logs. Your input was not changed.",
|
|
2191
|
+
"error.client.unreachable": "Cannot reach the DSH service \u2014 make sure DSH is running, then retry.",
|
|
2192
|
+
"error.client.malformed": "DSH returned data that could not be parsed. Retry; your input was not changed.",
|
|
2193
|
+
"error.client.refused": "DSH refused the request (HTTP {status}). Retry later.",
|
|
2194
|
+
"error.client.streamClosed": "The connection closed before the result arrived. Retry; your input was not changed.",
|
|
2195
|
+
"error.client.cancelled": "Enhancement cancelled; your input was not changed.",
|
|
2196
|
+
"error.rateLimit": "Too many requests: at most {limit} enhancements per minute. Try again in {retryAfterSeconds}s.",
|
|
2197
|
+
"error.concurrencyLimit": "At most {max} enhancements can run at once \u2014 wait for one to finish, then try again.",
|
|
2198
|
+
"error.cooldown": "{failures} enhancements failed in a row, so calls are paused for {retryAfterSeconds}s to avoid hammering the model service. Check the model settings, then retry.",
|
|
2199
|
+
"error.upstream.auth": "Model service authentication failed: check this provider's API key.",
|
|
2200
|
+
"error.upstream.invalidCredential": "Model service authentication failed: the stored API key is not usable \u2014 update it and retry.",
|
|
2201
|
+
"error.upstream.rateLimit": "The model service is rate-limiting requests. Retry later.",
|
|
2202
|
+
"error.upstream.quota": "The model service is out of quota or balance \u2014 check the account.",
|
|
2203
|
+
"error.upstream.empty": "The model returned an empty result \u2014 retry.",
|
|
2204
|
+
"error.upstream.contextWindow": "The content exceeds the model's context window \u2014 shorten the draft or switch models.",
|
|
2205
|
+
"error.upstream.toolCall": "The model tried to call a tool, but prompt enhancement only sends plain text \u2014 switch models and retry.",
|
|
2206
|
+
"error.upstream.maxTokens": 'The result hit the "Output token budget" limit. Raise that setting, or shorten the draft and retry.',
|
|
2161
2207
|
"settings.summary": "Model, context, and resource limits",
|
|
2162
2208
|
"settings.title": "Prompt enhance",
|
|
2163
2209
|
"settings.description": "Turns a composer draft into a structured prompt: role and goal, executable steps, output format, acceptance criteria, edge cases. The draft is preserved, failures never touch it, and saved values apply to the next call.",
|
|
@@ -2180,7 +2226,7 @@ var en = {
|
|
|
2180
2226
|
"settings.row.enabled.label": "Master switch",
|
|
2181
2227
|
"settings.row.enabled.hint": "Off hides the composer button and disables the command and the shortcut.",
|
|
2182
2228
|
"settings.row.contextAware.label": "Context aware",
|
|
2183
|
-
"settings.row.contextAware.hint": "Reads the recent
|
|
2229
|
+
"settings.row.contextAware.hint": "Reads the recent messages of the current conversation; falls back to a single-prompt rewrite when there is no history.",
|
|
2184
2230
|
"settings.row.streaming.label": "Streaming display",
|
|
2185
2231
|
"settings.row.streaming.hint": "Shows the rewrite while it is being written. Display only: the applied text is unchanged.",
|
|
2186
2232
|
"settings.row.foldAnimation.label": "Card fold animation",
|
|
@@ -2216,6 +2262,9 @@ var en = {
|
|
|
2216
2262
|
"settings.row.reasoningEffort.hint": 'Tier choices come from what the configured provider/model declares; custom models are read on demand. "Model default" means the field is omitted and the provider applies its default.',
|
|
2217
2263
|
"settings.row.maxOutputTokens.label": "Output token budget",
|
|
2218
2264
|
"settings.row.maxOutputTokens.hint": "Output budget for one enhancement call. Default 8192.",
|
|
2265
|
+
"settings.row.invalidInteger": "Enter an integer between {min} and {max}",
|
|
2266
|
+
"settings.row.invalidNumber": "Enter a number between {min} and {max}",
|
|
2267
|
+
"settings.row.blankDefault": "Leave blank to use the default: {value}",
|
|
2219
2268
|
"settings.row.maxInputChars.label": "Input character cap",
|
|
2220
2269
|
"settings.row.maxInputChars.hint": "Over-limit drafts are rejected, never truncated. Default 12000.",
|
|
2221
2270
|
"settings.row.timeoutMs.label": "Timeout (ms)",
|
|
@@ -2225,8 +2274,8 @@ var en = {
|
|
|
2225
2274
|
"settings.row.systemPrompt.label": "Custom system prompt",
|
|
2226
2275
|
"settings.row.systemPrompt.hint": "Leave empty to use the built-in enhancement strategy.",
|
|
2227
2276
|
"settings.row.systemPrompt.placeholder": "e.g. translate the user text from Chinese into English.",
|
|
2228
|
-
"settings.row.contextMaxMessages.label": "Context
|
|
2229
|
-
"settings.row.contextMaxMessages.hint": "How many recent
|
|
2277
|
+
"settings.row.contextMaxMessages.label": "Context messages",
|
|
2278
|
+
"settings.row.contextMaxMessages.hint": "How many recent messages may ground the rewrite; 0 disables context. Default 8.",
|
|
2230
2279
|
"settings.row.contextMaxChars.label": "Context characters",
|
|
2231
2280
|
"settings.row.contextMaxChars.hint": "Character budget for the context snippet; 0 disables it. Default 4000.",
|
|
2232
2281
|
"settings.row.maxConcurrent.label": "Concurrency cap",
|
|
@@ -2280,6 +2329,9 @@ var CSS = `
|
|
|
2280
2329
|
from the other scheme. */
|
|
2281
2330
|
--pe-warn-border: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 35%, transparent);
|
|
2282
2331
|
--pe-warn-bg: color-mix(in srgb, var(--dsw-alias-state-warn-primary, #e8c07d) 12%, transparent);
|
|
2332
|
+
/* Same tint recipe for the truncation banner: red is a state, not a theme. */
|
|
2333
|
+
--pe-danger-border: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ffb4a8) 35%, transparent);
|
|
2334
|
+
--pe-danger-bg: color-mix(in srgb, var(--dsw-alias-state-error-primary, #ffb4a8) 12%, transparent);
|
|
2283
2335
|
}
|
|
2284
2336
|
/* Quick-settings menu, copied from the shell's own menu primitives:
|
|
2285
2337
|
- the card surface is MenuSurface.module.css (radius-lg, elevation stroke,
|
|
@@ -2602,6 +2654,7 @@ html[data-platform='darwin'] .dsh-pe-menu {
|
|
|
2602
2654
|
/* Collapsed, the warning banners live in the hidden body; this marker stands in
|
|
2603
2655
|
for them so a stale or truncated result never folds away silently. */
|
|
2604
2656
|
.dsh-pe-warn-dot { font-size: 15px; line-height: 1; color: var(--pe-warn-fg); }
|
|
2657
|
+
.dsh-pe-warn-dot.is-danger { color: var(--pe-danger); }
|
|
2605
2658
|
.dsh-pe-result { padding: 2px 10px 6px; }
|
|
2606
2659
|
.dsh-pe-result-text {
|
|
2607
2660
|
margin: 0;
|
|
@@ -2764,6 +2817,8 @@ html[data-platform='darwin'] .dsh-pe-menu {
|
|
|
2764
2817
|
as a layout bug. The reason line may wrap freely. */
|
|
2765
2818
|
.dsh-pe-context-tip .dsh-pe-context-stats { white-space: nowrap; }
|
|
2766
2819
|
.dsh-pe-context-tip .dsh-pe-context-reason { color: #f2c185; }
|
|
2820
|
+
/* Attachment count is metadata, not a warning: same tooltip body color. */
|
|
2821
|
+
.dsh-pe-context-tip .dsh-pe-context-attachments { white-space: nowrap; }
|
|
2767
2822
|
/* Narrow viewports: the card itself is close to the viewport width, so the
|
|
2768
2823
|
fixed tooltip width would clip. Give it a viewport-relative cap and let the
|
|
2769
2824
|
stats line wrap instead of overflowing. */
|
|
@@ -2818,6 +2873,10 @@ html[data-platform='darwin'] .dsh-pe-menu {
|
|
|
2818
2873
|
(retry, cancel) the same size as the rest. */
|
|
2819
2874
|
.dsh-pe-btn-floor { min-width: 96px; }
|
|
2820
2875
|
.dsh-pe-btn-action:disabled { opacity: 0.45; cursor: default; }
|
|
2876
|
+
/* aria-disabled, not the native attribute: the button keeps focus and its
|
|
2877
|
+
click handler so the reason stays reachable (the handler refuses to run). */
|
|
2878
|
+
.dsh-pe-btn-action[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; }
|
|
2879
|
+
.dsh-pe-btn-action[aria-disabled='true']:hover { background: transparent; }
|
|
2821
2880
|
|
|
2822
2881
|
/* Both labels of the regenerate button share one cell, so the button is as wide
|
|
2823
2882
|
as the longer label of the active language and a label swap can never move
|
|
@@ -2835,6 +2894,13 @@ html[data-platform='darwin'] .dsh-pe-menu {
|
|
|
2835
2894
|
background: var(--pe-warn-bg);
|
|
2836
2895
|
color: var(--pe-warn-fg);
|
|
2837
2896
|
}
|
|
2897
|
+
/* Truncation is a result-quality problem, not a stale-draft warning: red says
|
|
2898
|
+
the result itself is incomplete, while the stale banner keeps the amber. */
|
|
2899
|
+
.dsh-pe-stale.dsh-pe-truncated {
|
|
2900
|
+
border-top-color: var(--pe-danger-border);
|
|
2901
|
+
background: var(--pe-danger-bg);
|
|
2902
|
+
color: var(--pe-danger);
|
|
2903
|
+
}
|
|
2838
2904
|
|
|
2839
2905
|
.dsh-pe-btn {
|
|
2840
2906
|
display: inline-flex;
|
|
@@ -3283,6 +3349,20 @@ var import_react10 = require("react");
|
|
|
3283
3349
|
|
|
3284
3350
|
// src/client/settings-page-spec.ts
|
|
3285
3351
|
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
3352
|
+
|
|
3353
|
+
// src/shared/limits.ts
|
|
3354
|
+
var TEMPERATURE = { min: 0, max: 1, step: 0.05 };
|
|
3355
|
+
var FIELD_LIMITS = {
|
|
3356
|
+
maxOutputTokens: { min: 256, max: 32768 },
|
|
3357
|
+
maxInputChars: { min: 200, max: 2e5 },
|
|
3358
|
+
timeoutMs: { min: 5e3, max: 6e5 },
|
|
3359
|
+
maxConcurrent: { min: 1, max: 16 },
|
|
3360
|
+
rateLimitPerMinute: { min: 1, max: 600 },
|
|
3361
|
+
contextMaxMessages: { min: 0, max: 50 },
|
|
3362
|
+
contextMaxChars: { min: 0, max: 1e5 }
|
|
3363
|
+
};
|
|
3364
|
+
|
|
3365
|
+
// src/client/settings-page-spec.ts
|
|
3286
3366
|
var SETTINGS_SECTION_SLOT = "settings.section";
|
|
3287
3367
|
var SETTINGS_SECTION_ID = "dsh-prompt-enhance";
|
|
3288
3368
|
var SETTINGS_SECTION_ORDER = 70;
|
|
@@ -3320,12 +3400,30 @@ var STRATEGY_OPTIONS = [
|
|
|
3320
3400
|
{ value: "replace-default", label: "settings.strategy.replace" },
|
|
3321
3401
|
{ value: "extend-default", label: "settings.strategy.extend" }
|
|
3322
3402
|
];
|
|
3403
|
+
function validateNumber(text, range, integer) {
|
|
3404
|
+
const trimmed = text.trim();
|
|
3405
|
+
if (trimmed === "") return true;
|
|
3406
|
+
const value = Number(trimmed);
|
|
3407
|
+
if (!Number.isFinite(value)) return false;
|
|
3408
|
+
if (integer && !Number.isInteger(value)) return false;
|
|
3409
|
+
return value >= range.min && value <= range.max;
|
|
3410
|
+
}
|
|
3411
|
+
function numberRow(key, label, hint, range, integer = true) {
|
|
3412
|
+
return {
|
|
3413
|
+
key,
|
|
3414
|
+
kind: "number",
|
|
3415
|
+
label,
|
|
3416
|
+
hint,
|
|
3417
|
+
range: { ...range, integer },
|
|
3418
|
+
validate: (text) => validateNumber(text, range, integer)
|
|
3419
|
+
};
|
|
3420
|
+
}
|
|
3323
3421
|
var BASIC_ROWS = [
|
|
3324
3422
|
{ key: "enabled", kind: "boolean", label: "settings.row.enabled.label", hint: "settings.row.enabled.hint" },
|
|
3325
3423
|
{ key: "provider", kind: "provider", label: "settings.row.provider.label", hint: "settings.row.provider.hint" },
|
|
3326
3424
|
{ key: "model", kind: "model", label: "settings.row.model.label", hint: "settings.row.model.hint" },
|
|
3327
3425
|
{ key: "reasoningEffort", kind: "reasoning", label: "settings.row.reasoningEffort.label", hint: "settings.row.reasoningEffort.hint" },
|
|
3328
|
-
|
|
3426
|
+
numberRow("temperature", "settings.row.temperature.label", "settings.row.temperature.hint", TEMPERATURE, false),
|
|
3329
3427
|
{ key: "contextAware", kind: "boolean", label: "settings.row.contextAware.label", hint: "settings.row.contextAware.hint" },
|
|
3330
3428
|
{ key: "streaming", kind: "boolean", label: "settings.row.streaming.label", hint: "settings.row.streaming.hint" },
|
|
3331
3429
|
{ key: "systemPrompt", kind: "text", label: "settings.row.systemPrompt.label", hint: "settings.row.systemPrompt.hint", placeholder: "settings.row.systemPrompt.placeholder" },
|
|
@@ -3344,13 +3442,13 @@ var ADVANCED_ROWS = [
|
|
|
3344
3442
|
{ key: "foldAnimation", kind: "boolean", label: "settings.row.foldAnimation.label", hint: "settings.row.foldAnimation.hint" },
|
|
3345
3443
|
{ key: "autoFold", kind: "boolean", label: "settings.row.autoFold.label", hint: "settings.row.autoFold.hint" },
|
|
3346
3444
|
{ key: "strategyMode", kind: "strategy", label: "settings.row.strategyMode.label", hint: "settings.row.strategyMode.hint" },
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3445
|
+
numberRow("maxInputChars", "settings.row.maxInputChars.label", "settings.row.maxInputChars.hint", FIELD_LIMITS.maxInputChars),
|
|
3446
|
+
numberRow("maxOutputTokens", "settings.row.maxOutputTokens.label", "settings.row.maxOutputTokens.hint", FIELD_LIMITS.maxOutputTokens),
|
|
3447
|
+
numberRow("timeoutMs", "settings.row.timeoutMs.label", "settings.row.timeoutMs.hint", FIELD_LIMITS.timeoutMs),
|
|
3448
|
+
numberRow("contextMaxMessages", "settings.row.contextMaxMessages.label", "settings.row.contextMaxMessages.hint", FIELD_LIMITS.contextMaxMessages),
|
|
3449
|
+
numberRow("contextMaxChars", "settings.row.contextMaxChars.label", "settings.row.contextMaxChars.hint", FIELD_LIMITS.contextMaxChars),
|
|
3450
|
+
numberRow("maxConcurrent", "settings.row.maxConcurrent.label", "settings.row.maxConcurrent.hint", FIELD_LIMITS.maxConcurrent),
|
|
3451
|
+
numberRow("rateLimitPerMinute", "settings.row.rateLimitPerMinute.label", "settings.row.rateLimitPerMinute.hint", FIELD_LIMITS.rateLimitPerMinute)
|
|
3354
3452
|
];
|
|
3355
3453
|
var ROWS = [...BASIC_ROWS, ...ADVANCED_ROWS];
|
|
3356
3454
|
function descriptorOf(row) {
|
|
@@ -3407,6 +3505,11 @@ function atDefaultValue(key, text) {
|
|
|
3407
3505
|
|
|
3408
3506
|
// src/client/settings-page-copy.ts
|
|
3409
3507
|
var ZH_COPY = zh;
|
|
3508
|
+
function interpolate(t, key, params) {
|
|
3509
|
+
let text = t(key);
|
|
3510
|
+
for (const [name, value] of Object.entries(params)) text = text.split(`{${name}}`).join(value);
|
|
3511
|
+
return text;
|
|
3512
|
+
}
|
|
3410
3513
|
function translator(t) {
|
|
3411
3514
|
if (typeof t === "function") return t;
|
|
3412
3515
|
return ((key, params) => {
|
|
@@ -3440,7 +3543,7 @@ function sectionCopy(t, chinese) {
|
|
|
3440
3543
|
hint: (row) => t(row.hint),
|
|
3441
3544
|
placeholder: (row) => row.placeholder === void 0 ? void 0 : t(row.placeholder),
|
|
3442
3545
|
choice: (key) => t(key),
|
|
3443
|
-
interpolate: (key, params) => t
|
|
3546
|
+
interpolate: (key, params) => interpolate(t, key, params)
|
|
3444
3547
|
};
|
|
3445
3548
|
}
|
|
3446
3549
|
function pageCopy(t) {
|
|
@@ -3466,7 +3569,7 @@ function pageCopy(t) {
|
|
|
3466
3569
|
hint: (row) => t(row.hint),
|
|
3467
3570
|
placeholder: (row) => row.placeholder === void 0 ? void 0 : t(row.placeholder),
|
|
3468
3571
|
choice: (key) => t(key),
|
|
3469
|
-
interpolate: (key, params) => t
|
|
3572
|
+
interpolate: (key, params) => interpolate(t, key, params)
|
|
3470
3573
|
};
|
|
3471
3574
|
}
|
|
3472
3575
|
|
|
@@ -3580,7 +3683,7 @@ var REPOSITORY_URL = "https://github.com/surfishs/dsh-prompt-enhance";
|
|
|
3580
3683
|
var NPM_URL = "https://www.npmjs.com/package/@surfishs/dsh-prompt-enhance";
|
|
3581
3684
|
var GITHUB_MARK = "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 2-.27c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z";
|
|
3582
3685
|
var NPM_MARK = "M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z";
|
|
3583
|
-
var PLUGIN_VERSION = true ? "0.1.
|
|
3686
|
+
var PLUGIN_VERSION = true ? "0.1.4" : "0.0.0";
|
|
3584
3687
|
var HEADER_STYLE = { display: "flex", flexDirection: "column", gap: 12, padding: "2px 0" };
|
|
3585
3688
|
var HEADER_ROW_STYLE = { display: "flex", alignItems: "center", gap: 10, flexWrap: "wrap" };
|
|
3586
3689
|
var HEADER_TITLE_STYLE = {
|
|
@@ -4024,6 +4127,19 @@ function PageHeader(props) {
|
|
|
4024
4127
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { style: HEADER_DESCRIPTION_STYLE, children: props.description })
|
|
4025
4128
|
] });
|
|
4026
4129
|
}
|
|
4130
|
+
function invalidMessageOf(row, text, copy) {
|
|
4131
|
+
if (row.validate === void 0 || row.validate(text)) return void 0;
|
|
4132
|
+
if (row.range !== void 0) {
|
|
4133
|
+
const key = row.range.integer === false ? "settings.row.invalidNumber" : "settings.row.invalidInteger";
|
|
4134
|
+
return copy.interpolate(key, { min: String(row.range.min), max: String(row.range.max) });
|
|
4135
|
+
}
|
|
4136
|
+
return copy.labels.invalidShortcut;
|
|
4137
|
+
}
|
|
4138
|
+
function placeholderOf(row, view, copy) {
|
|
4139
|
+
if (row.kind !== "number" || view.text.trim() !== "") return copy.placeholder(row);
|
|
4140
|
+
const fallback = defaultTextOf(row.key);
|
|
4141
|
+
return fallback === "" ? copy.placeholder(row) : copy.interpolate("settings.row.blankDefault", { value: fallback });
|
|
4142
|
+
}
|
|
4027
4143
|
function SettingsRow(props) {
|
|
4028
4144
|
const shared = {
|
|
4029
4145
|
id: `dsh-prompt-enhance-${props.row.key}`,
|
|
@@ -4053,8 +4169,8 @@ function SettingsRow(props) {
|
|
|
4053
4169
|
{
|
|
4054
4170
|
...shared,
|
|
4055
4171
|
numeric: props.row.kind === "number",
|
|
4056
|
-
placeholder: props.
|
|
4057
|
-
invalidMessage: props.row
|
|
4172
|
+
placeholder: placeholderOf(props.row, props.view, props.copy),
|
|
4173
|
+
invalidMessage: invalidMessageOf(props.row, props.view.text, props.copy),
|
|
4058
4174
|
recordable: props.row.recordable === true
|
|
4059
4175
|
}
|
|
4060
4176
|
);
|