dsh-convey-assistant 0.2.3 → 0.2.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/README.md CHANGED
@@ -41,7 +41,7 @@ This plugin does not guess for you:
41
41
 
42
42
  ## Install in 30 seconds
43
43
 
44
- Three ways, pick one. The package is **prebuilt**: `lib/index.js` and `lib/client.js` are committed,
44
+ Four ways — **option 0 is the easiest**. The package is **prebuilt**: `lib/index.js` and `lib/client.js` are committed,
45
45
  and installation runs **no build script on your machine**.
46
46
 
47
47
  ### 0. From npm (easiest, mirrored in China)
package/README.zh.md CHANGED
@@ -38,7 +38,7 @@
38
38
 
39
39
  ## 30 秒安装
40
40
 
41
- 三种方式任选一种。**本插件是预构建的**:仓库里已经带上 `lib/index.js` 与 `lib/client.js`,
41
+ 四种方式任选一种,**最省事的是方式 0**。**本插件是预构建的**:仓库里已经带上 `lib/index.js` 与 `lib/client.js`,
42
42
  安装时**不会**在你机器上执行任何构建脚本。
43
43
 
44
44
  ### 方式 0:从 npm 装(国内网络最省事,推荐)
package/lib/client.js CHANGED
@@ -47,13 +47,103 @@ var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primit
47
47
 
48
48
  // src/client/Pet.tsx
49
49
  var React = __toESM(require("react"), 1);
50
- var PET_GREETINGS = [
51
- "\u5657\u565C\u5657\u565C~ \u6211\u5728\u8FD9\u513F\uFF0C\u5148\u628A\u60F3\u8BF4\u7684\u8BDD\u5199\u6210\u8349\u7A3F\uFF0C\u6211\u5E2E\u4F60\u7FFB\u8BD1\u6210 Agent \u542C\u5F97\u61C2\u7684\u6837\u5B50",
52
- "\u5514\uFF0C\u8FD9\u53E5\u6211\u5927\u6982\u61C2\u4E86 (\u0E51\u2022\u0300\u3142\u2022\u0301)\u0648 \u8981\u4E0D\u8981\u6211\u8BFB\u4E00\u904D\u4F60\u7684\u771F\u5B9E\u610F\u56FE",
53
- "\u522B\u6025\u7740\u53D1\u561B\uFF0C\u6211\u5E2E\u4F60\u7785\u4E00\u773C\u6709\u6CA1\u6709\u4F1A\u88AB\u8BEF\u8BFB\u7684\u5730\u65B9~",
54
- "\u8349\u7A3F\u6211\u8BFB\u8FC7\u4E86\uFF0C\u6709\u51E0\u5904\u60F3\u8DDF\u4F60\u786E\u8BA4\u4E00\u4E0B\u5462",
55
- "\u5199\u4E0D\u52A8\u7684\u65F6\u5019\u53EF\u4EE5\u5148\u968F\u4FBF\u5199\uFF0C\u5269\u4E0B\u7684\u4EA4\u7ED9\u6211\u6574\u7406~"
56
- ];
50
+
51
+ // src/client/copy.ts
52
+ var POOLS = {
53
+ hover: {
54
+ zh: [
55
+ "\u4E3B\u4EBA\uFF0C\u4F60\u8981\u914D\u7F6E\u4E00\u4E0B\u6211\u5417\uFF1F (\u0E51\u2022\u0300\u3142\u2022\u0301)\u0648\u2727",
56
+ "\u8BF6\uFF1F\u70B9\u6211\u5440~ \u6211\u8FD9\u513F\u85CF\u4E86\u4E2A\u5C0F\u9762\u677F (\xB4\u30FB\u03C9\u30FB)",
57
+ "\u8981\u8C03\u4EC0\u4E48\u561B\uFF0C\u6211\u4E00\u76F4\u8E72\u5728\u8FD9\u513F\u5462 (\u30FB\u03C9\u30FB)",
58
+ "\u5514\u2026\u662F\u60F3\u7ED9\u6211\u6362\u4E2A\u8111\u5B50\u5417~ (\u0E51\u2022\u0301 \u2083 \u2022\u0300\u0E51)",
59
+ "\u6233\u6233~ \u6211\u6709\u53CD\u5E94\u54E6 \u30FD(\u2022\u203F\u2022)\u30CE",
60
+ "\u6211\u5728\u6211\u5728\uFF01\u60F3\u8BA9\u6211\u600E\u4E48\u5E72\u6D3B\u5440 (\uFF61\uFF65\u03C9\uFF65\uFF61)",
61
+ "\u522B\u5149\u770B\u7740\u6211\u561B\uFF0C\u70B9\u4E00\u4E0B\u8BD5\u8BD5~ (\uFFE3\u25BD\uFFE3)",
62
+ "\u6709\u6084\u6084\u8BDD\u8981\u8DDF\u6211\u8BF4\u5417\uFF1F(\xB4,,\u2022\u03C9\u2022,,)",
63
+ "\u6233\u4E00\u4E0B\u561B\uFF0C\u53C8\u4E0D\u4F1A\u5403\u6389\u4F60~ (\uFF61\u2022\u0300\u1D17-)\u2727",
64
+ "\u55EF\uFF1F\u662F\u6765\u627E\u6211\u73A9\u7684\u5417 (\u25D5\u203F\u25D5)"
65
+ ],
66
+ en: [
67
+ "Master, would you like to configure me? (\u0E51\u2022\u0300\u3142\u2022\u0301)\u0648\u2727",
68
+ "Oh? Click me~ I hid a little panel in here (\xB4\u30FB\u03C9\u30FB)",
69
+ "Anything to tune? I have been sitting right here (\u30FB\u03C9\u30FB)",
70
+ "Hmm\u2026 changing my brain? (\u0E51\u2022\u0301 \u2083 \u2022\u0300\u0E51)",
71
+ "Poke poke~ I do react \u30FD(\u2022\u203F\u2022)\u30CE",
72
+ "I am here! How should I work for you? (\uFF61\uFF65\u03C9\uFF65\uFF61)",
73
+ "Do not just stare, give it a click~ (\uFFE3\u25BD\uFFE3)",
74
+ "Something you want to whisper? (\xB4,,\u2022\u03C9\u2022,,)",
75
+ "Go on, poke me, I do not bite~ (\uFF61\u2022\u0300\u1D17-)\u2727",
76
+ "Hm? Here to play with me? (\u25D5\u203F\u25D5)"
77
+ ]
78
+ },
79
+ greeting: {
80
+ zh: [
81
+ "\u6211\u5728\u5462~ \u5148\u968F\u4FBF\u5199\uFF0C\u6211\u5E2E\u4F60\u7FFB\u8BD1\u6210 Agent \u542C\u5F97\u61C2\u7684\u6837\u5B50 (\u0E51\u2022\u0300\u3142\u2022\u0301)\u0648",
82
+ "\u5514\u2026\u8BA9\u6211\u8BFB\u8BFB\u4F60\u7684\u771F\u5B9E\u610F\u56FE (\u30FB\u03C9\u30FB) \u8BF4\u4E0D\u5B9A\u4F60\u81EA\u5DF1\u90FD\u8FD8\u6CA1\u53D1\u73B0",
83
+ "\u522B\u6025\u7740\u53D1\u561B\uFF0C\u6211\u5148\u5E2E\u4F60\u7785\u4E00\u773C\u6709\u6CA1\u6709\u4F1A\u88AB\u8BEF\u8BFB\u7684\u5730\u65B9~ (\uFFE3\u25BD\uFFE3)",
84
+ "\u8349\u7A3F\u6211\u8BFB\u8FC7\u5566\uFF0C\u6709\u51E0\u5904\u60F3\u8DDF\u4F60\u786E\u8BA4\u4E00\u4E0B\u5462 (\uFF61\uFF65\u03C9\uFF65\uFF61)",
85
+ "\u5199\u4E0D\u52A8\u5C31\u968F\u4FBF\u5199\uFF0C\u53CD\u6B63\u6536\u62E2\u8FD9\u4E9B\u788E\u8BDD\u662F\u6211\u7684\u6D3B\u513F~ \u30FD(\u2022\u203F\u2022)\u30CE",
86
+ "\u8D8A\u968F\u4FBF\u8D8A\u597D\uFF01\u8D8A\u968F\u4FBF\u6211\u8D8A\u6709\u7528\u6B66\u4E4B\u5730 (\uFF61\u2022\u0300\u1D17-)\u2727",
87
+ "\u55EF\u2026\u8FD9\u53E5\u6211\u4F1A\u4E0D\u4F1A\u7406\u89E3\u9519\u5462\uFF0C\u8BA9\u6211\u518D\u770B\u4E00\u773C (\xB4,,\u2022\u03C9\u2022,,)",
88
+ "\u653E\u5FC3\u5199\uFF0C\u6211\u4E0D\u66FF\u4F60\u7F16\u6545\u4E8B\uFF0C\u53EA\u66FF\u4F60\u95EE\u6E05\u695A (\u25D5\u203F\u25D5)",
89
+ "\u4F60\u5C31\u5F53\u6211\u662F\u4E2A\u7279\u522B\u7231\u5228\u6839\u95EE\u5E95\u7684\u79D8\u4E66~ (\u0E51\u2022\u0301 \u2083 \u2022\u0300\u0E51)",
90
+ "\u5618\u2014\u2014\u5148\u8BA9\u6211\u628A\u4F60\u8FD9\u53E5\u8BDD\u56BC\u788E\u4E86\u518D\u8FD8\u7ED9 Agent (\xAC\u203F\xAC)"
91
+ ],
92
+ en: [
93
+ "Right here~ write it however you like, I will turn it into something the agent reads correctly (\u0E51\u2022\u0300\u3142\u2022\u0301)\u0648",
94
+ "Hmm\u2026 let me read what you actually mean (\u30FB\u03C9\u30FB) you might not even know yet",
95
+ "No rush \u2014 let me check for anything that could be misread~ (\uFFE3\u25BD\uFFE3)",
96
+ "Read it. A couple of spots I would like to confirm with you (\uFF61\uFF65\u03C9\uFF65\uFF61)",
97
+ "Stuck? Just write something rough \u2014 tidying it up is my job~ \u30FD(\u2022\u203F\u2022)\u30CE",
98
+ "The messier the better! That is where I shine (\uFF61\u2022\u0300\u1D17-)\u2727",
99
+ "Hmm\u2026 would I misread this one? Let me look again (\xB4,,\u2022\u03C9\u2022,,)",
100
+ "Write freely. I never make things up, I only ask (\u25D5\u203F\u25D5)",
101
+ "Think of me as a secretary who cannot stop asking why~ (\u0E51\u2022\u0301 \u2083 \u2022\u0300\u0E51)",
102
+ "Shh \u2014 let me chew on this sentence before handing it back (\xAC\u203F\xAC)"
103
+ ]
104
+ },
105
+ loading: {
106
+ zh: [
107
+ "\u6B63\u5728\u8BFB\u4F60\u7684\u8349\u7A3F\u2026 (\u30FB\u03C9\u30FB)",
108
+ "\u8BA9\u6211\u5148\u60F3\u60F3\u4F60\u5230\u5E95\u60F3\u8981\u4EC0\u4E48~ (\u0E51\u2022\u0300\u3142\u2022\u0301)\u0648",
109
+ "\u55EF\u2026\u8FD9\u53E5\u6709\u70B9\u7ED5\uFF0C\u6211\u634B\u4E00\u634B (\xB4\u30FB\u03C9\u30FB)",
110
+ "\u7A0D\u7B49\u7A0D\u7B49\uFF0C\u6211\u5728\u62C6\u4F60\u7684\u610F\u601D\u5462 \u30FD(\u2022\u203F\u2022)\u30CE",
111
+ "\u68C0\u67E5\u6709\u6CA1\u6709\u4F1A\u88AB Agent \u7406\u89E3\u9519\u7684\u5730\u65B9\u2026 (\uFFE3\u25BD\uFFE3)",
112
+ "\u5148\u628A\u4F60\u7684\u8BDD\u7FFB\u8BD1\u6210\u4EBA\u8BDD\u518D\u8BF4~ (\uFF61\u2022\u0300\u1D17-)\u2727",
113
+ "\u6211\u5728\u8BFB\u5566\uFF0C\u522B\u50AC\u6211\u561B (\u30FB\u03C9\u30FB)",
114
+ "\u8FD9\u6BB5\u8BDD\u6709\u597D\u51E0\u5C42\u610F\u601D\uFF0C\u6211\u5206\u5F00\u7406\u7406 (\uFF61\uFF65\u03C9\uFF65\uFF61)",
115
+ "\u6B63\u5728\u7FFB\u7BB1\u5012\u67DC\u627E\u4F60\u7684\u771F\u5B9E\u610F\u56FE\u2026 (\xB4,,\u2022\u03C9\u2022,,)",
116
+ "\u7ED9\u6211\u4E09\u79D2\uFF0C\u8FD8\u4F60\u4E00\u53E5 Agent \u80FD\u542C\u61C2\u7684 (\u25D5\u203F\u25D5)"
117
+ ],
118
+ en: [
119
+ "Reading your draft\u2026 (\u30FB\u03C9\u30FB)",
120
+ "Let me think about what you actually want~ (\u0E51\u2022\u0300\u3142\u2022\u0301)\u0648",
121
+ "Hmm\u2026 this one is a bit tangled, give me a moment (\xB4\u30FB\u03C9\u30FB)",
122
+ "Hold on hold on, I am unpacking what you mean \u30FD(\u2022\u203F\u2022)\u30CE",
123
+ "Checking for anything an agent could misread\u2026 (\uFFE3\u25BD\u25BD)",
124
+ "Translating it into plain intent first~ (\uFF61\u2022\u0300\u1D17-)\u2727",
125
+ "I am reading, do not rush me (\u30FB\u03C9\u30FB)",
126
+ "A few layers in this one \u2014 untangling them (\uFF61\uFF65\u03C9\uFF65\uFF61)",
127
+ "Digging around for your actual intent\u2026 (\xB4,,\u2022\u03C9\u2022,,)",
128
+ "Three seconds, and I will hand back something an agent understands (\u25D5\u203F\u25D5)"
129
+ ]
130
+ }
131
+ };
132
+ var readLocale = () => typeof navigator !== "undefined" && navigator.language ? navigator.language : "en";
133
+ function setCopyLocale(reader) {
134
+ readLocale = reader;
135
+ }
136
+ var lastIndex = /* @__PURE__ */ new Map();
137
+ function pickLine(kind) {
138
+ const pool = readLocale().toLowerCase().startsWith("zh") ? POOLS[kind].zh : POOLS[kind].en;
139
+ if (pool.length === 0) return "";
140
+ let index = Math.floor(Math.random() * pool.length);
141
+ if (pool.length > 1 && index === lastIndex.get(kind)) index = (index + 1) % pool.length;
142
+ lastIndex.set(kind, index);
143
+ return pool[index];
144
+ }
145
+
146
+ // src/client/Pet.tsx
57
147
  var PALETTE = {
58
148
  h: "#3b4fa8",
59
149
  // 鱼身深蓝
@@ -210,9 +300,8 @@ function PetQuestionRow({ mood, title, questions, thinkingLabel, bubbleLabel, ch
210
300
  const moodNow = happy ? "happy" : mood;
211
301
  const onPetClick = (event) => {
212
302
  event.preventDefault();
213
- const next = (greetingIndex + 1) % PET_GREETINGS.length;
214
- setGreetingIndex(next);
215
- setGreeting(PET_GREETINGS[next]);
303
+ setGreetingIndex((prev) => prev + 1);
304
+ setGreeting(pickLine("greeting"));
216
305
  setHappy(true);
217
306
  };
218
307
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "dca-pet-row" }, /* @__PURE__ */ React.createElement("div", { className: "dca-pet-left" }, /* @__PURE__ */ React.createElement(
@@ -1345,6 +1434,7 @@ function ConveyCard(props) {
1345
1434
  useRetain(props);
1346
1435
  const [planError, setPlanError] = React2.useState(null);
1347
1436
  const pendingVerify = React2.useRef(null);
1437
+ const loadingLineRef = React2.useRef(null);
1348
1438
  const edited = card.kind === "ready" ? card.editedText : "";
1349
1439
  const refCount = card.kind === "ready" ? card.capture.refs.length : 0;
1350
1440
  const validation = React2.useMemo(() => validateTokens(edited, refCount), [edited, refCount]);
@@ -1401,17 +1491,24 @@ function ConveyCard(props) {
1401
1491
  controller?.markRestored();
1402
1492
  };
1403
1493
  if (controller === void 0 || card.kind === "idle") return null;
1494
+ if (card.kind === "loading") {
1495
+ const cached2 = loadingLineRef.current;
1496
+ if (cached2 === null || cached2.capture !== card.capture) {
1497
+ loadingLineRef.current = { capture: card.capture, line: pickLine("loading") };
1498
+ }
1499
+ }
1500
+ const loadingLine = card.kind === "loading" ? loadingLineRef.current?.line ?? t("card.loading") : t("card.loading");
1404
1501
  const close = () => {
1405
1502
  setPlanError(null);
1406
1503
  controller.discard();
1407
1504
  };
1408
1505
  const header = (title, tone) => /* @__PURE__ */ React2.createElement("div", { style: styles.header }, /* @__PURE__ */ React2.createElement("div", { style: styles.headerLeft }, tone === "ongoing" && /* @__PURE__ */ React2.createElement(import_dsh_client_ui_primitives.StateDot, { state: "ongoing" }), tone === "done" && /* @__PURE__ */ React2.createElement(import_dsh_client_ui_primitives.StateDot, { state: "done" }), tone === "error" && /* @__PURE__ */ React2.createElement(import_dsh_client_ui_primitives.StateDot, { state: "error" }), /* @__PURE__ */ React2.createElement("span", { style: styles.title }, title)), /* @__PURE__ */ React2.createElement(import_dsh_client_ui_primitives.Button, { size: "sm", variant: "ghost", "aria-label": t("card.close"), onMouseDown: keepFocus, onClick: close }, /* @__PURE__ */ React2.createElement("span", { "aria-hidden": "true" }, "\u2715")));
1409
1506
  if (card.kind === "loading") {
1410
- return /* @__PURE__ */ React2.createElement("div", { style: styles.card, "data-dca-card": "loading" }, /* @__PURE__ */ React2.createElement("style", null, PET_CSS), header(/* @__PURE__ */ React2.createElement(import_dsh_client_ui_primitives.TextShimmer, { active: true }, t("card.loading")), "ongoing"), /* @__PURE__ */ React2.createElement(
1507
+ return /* @__PURE__ */ React2.createElement("div", { style: styles.card, "data-dca-card": "loading" }, /* @__PURE__ */ React2.createElement("style", null, PET_CSS), header(/* @__PURE__ */ React2.createElement(import_dsh_client_ui_primitives.TextShimmer, { active: true }, loadingLine), "ongoing"), /* @__PURE__ */ React2.createElement(
1411
1508
  PetQuestionRow,
1412
1509
  {
1413
1510
  mood: "thinking",
1414
- title: t("card.loading"),
1511
+ title: loadingLine,
1415
1512
  questions: [],
1416
1513
  thinkingLabel: t("card.loading.hint"),
1417
1514
  bubbleLabel: t("card.aria")
@@ -1959,6 +2056,7 @@ function PetLayer({ t, forge }) {
1959
2056
  const [entering, setEntering] = React3.useState(true);
1960
2057
  const [action, setAction] = React3.useState(null);
1961
2058
  const [hover, setHover] = React3.useState(false);
2059
+ const [hoverLine, setHoverLine] = React3.useState("");
1962
2060
  const petRef = React3.useRef(null);
1963
2061
  const areaRef = React3.useRef(area);
1964
2062
  areaRef.current = area;
@@ -2083,6 +2181,10 @@ function PetLayer({ t, forge }) {
2083
2181
  }, []);
2084
2182
  const onPointerEnter = () => {
2085
2183
  cancelHide();
2184
+ setHoverLine((prev) => {
2185
+ const next = pickLine("hover");
2186
+ return next === prev ? pickLine("hover") : next;
2187
+ });
2086
2188
  setHover(true);
2087
2189
  };
2088
2190
  const onPointerLeave = () => {
@@ -2131,7 +2233,7 @@ function PetLayer({ t, forge }) {
2131
2233
  onPointerEnter: cancelHide,
2132
2234
  onPointerLeave
2133
2235
  },
2134
- /* @__PURE__ */ React3.createElement("button", { type: "button", className: "dca-pet-bubble-hit", onMouseDown: onPetMouseDown, onClick: onPetClick }, t("pet.hover"))
2236
+ /* @__PURE__ */ React3.createElement("button", { type: "button", className: "dca-pet-bubble-hit", onMouseDown: onPetMouseDown, onClick: onPetClick }, hoverLine !== "" ? hoverLine : t("pet.hover"))
2135
2237
  ), ui.panelOpen && /* @__PURE__ */ React3.createElement(
2136
2238
  PetSettingsPanel,
2137
2239
  {
@@ -2315,6 +2417,7 @@ function apply(ctx) {
2315
2417
  return "en";
2316
2418
  };
2317
2419
  const t = createTranslate(readLocaleTag);
2420
+ setCopyLocale(readLocaleTag);
2318
2421
  const sessions = readService(ctx, "sessions");
2319
2422
  const forge = new ConveyRegistry(
2320
2423
  readLocaleTag,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-convey-assistant",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "把口语草稿翻译成 AI Agent 不会误读的意图:先追问你没说清楚的地方(气泡提示),再改写成结构化工单,你确认后才写回输入框。附带一只常驻的像素大肥鱼,鼠标一停就自己溜达。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -12,6 +12,7 @@
12
12
  */
13
13
 
14
14
  import * as React from 'react'
15
+ import { pickLine } from './copy'
15
16
 
16
17
  /**
17
18
  * 宠物的表情:
@@ -261,9 +262,9 @@ export function PetQuestionRow({ mood, title, questions, thinkingLabel, bubbleLa
261
262
  const onPetClick = (event: React.MouseEvent<HTMLDivElement>): void => {
262
263
  // 不抢输入框焦点:鼠标点插画不该让用户丢失光标
263
264
  event.preventDefault()
264
- const next = (greetingIndex + 1) % PET_GREETINGS.length
265
- setGreetingIndex(next)
266
- setGreeting(PET_GREETINGS[next])
265
+ // 从招呼语池里随机取一句(自动避免与上一句重复)
266
+ setGreetingIndex((prev) => prev + 1)
267
+ setGreeting(pickLine('greeting'))
267
268
  setHappy(true)
268
269
  }
269
270
 
@@ -29,6 +29,7 @@ import {
29
29
  parseModelChoice
30
30
  } from './settings'
31
31
  import { loadModelOptions } from './models'
32
+ import { pickLine } from './copy'
32
33
  import type { ConveyRegistry } from './controller'
33
34
  import type { ConveyModelOption, ConveyMode } from '../shared/protocol'
34
35
  import type { Translate } from './locale'
@@ -163,6 +164,8 @@ function PetLayer({ t, forge }: { readonly t: Translate; readonly forge: ConveyR
163
164
  const [entering, setEntering] = React.useState(true)
164
165
  const [action, setAction] = React.useState<'hop' | 'sway' | null>(null)
165
166
  const [hover, setHover] = React.useState(false)
167
+ /** 每次悬停换一句:进气泡前随机取一条,不重复上一句 */
168
+ const [hoverLine, setHoverLine] = React.useState('')
166
169
 
167
170
  const petRef = React.useRef<HTMLDivElement>(null)
168
171
  const areaRef = React.useRef(area)
@@ -300,6 +303,7 @@ function PetLayer({ t, forge }: { readonly t: Translate; readonly forge: ConveyR
300
303
 
301
304
  const onPointerEnter = (): void => {
302
305
  cancelHide()
306
+ setHoverLine((prev) => { const next = pickLine('hover'); return next === prev ? pickLine('hover') : next })
303
307
  setHover(true)
304
308
  }
305
309
  const onPointerLeave = (): void => {
@@ -365,7 +369,7 @@ function PetLayer({ t, forge }: { readonly t: Translate; readonly forge: ConveyR
365
369
  onPointerLeave={onPointerLeave}
366
370
  >
367
371
  <button type="button" className="dca-pet-bubble-hit" onMouseDown={onPetMouseDown} onClick={onPetClick}>
368
- {t('pet.hover')}
372
+ {hoverLine !== '' ? hoverLine : t('pet.hover')}
369
373
  </button>
370
374
  </div>
371
375
  )}
@@ -18,6 +18,7 @@ import {
18
18
  } from '@deepseek-ai/dsh-client-ui-primitives'
19
19
  import { PetQuestionRow, type PetMood } from './Pet'
20
20
  import { PET_CSS } from './pet-css'
21
+ import { pickLine } from './copy'
21
22
  import { settingsStore } from './settings'
22
23
  import {
23
24
  planRestore,
@@ -133,6 +134,8 @@ export function ConveyCard(props: ConveySlotProps): React.ReactElement | null {
133
134
 
134
135
  const [planError, setPlanError] = React.useState<CardErrorCode | null>(null)
135
136
  const pendingVerify = React.useRef<PendingVerify | null>(null)
137
+ /** 等待话术缓存:同一请求(同一 capture)内不变,新请求换一句 */
138
+ const loadingLineRef = React.useRef<{ readonly capture: DraftCapture; readonly line: string } | null>(null)
136
139
 
137
140
  // 结果可编辑时,占位符完整性实时校验(不合格就禁用"确认写回")
138
141
  const edited = card.kind === 'ready' ? card.editedText : ''
@@ -203,6 +206,15 @@ export function ConveyCard(props: ConveySlotProps): React.ReactElement | null {
203
206
 
204
207
  if (controller === undefined || card.kind === 'idle') return null
205
208
 
209
+ // 等待话术:同一个请求内保持不变(按 capture 身份判断),新请求换一句
210
+ if (card.kind === 'loading') {
211
+ const cached = loadingLineRef.current
212
+ if (cached === null || cached.capture !== card.capture) {
213
+ loadingLineRef.current = { capture: card.capture, line: pickLine('loading') }
214
+ }
215
+ }
216
+ const loadingLine = card.kind === 'loading' ? (loadingLineRef.current?.line ?? t('card.loading')) : t('card.loading')
217
+
206
218
  const close = (): void => {
207
219
  setPlanError(null)
208
220
  controller.discard()
@@ -226,10 +238,10 @@ export function ConveyCard(props: ConveySlotProps): React.ReactElement | null {
226
238
  return (
227
239
  <div style={styles.card} data-dca-card="loading">
228
240
  <style>{PET_CSS}</style>
229
- {header(<TextShimmer active>{t('card.loading')}</TextShimmer>, 'ongoing')}
241
+ {header(<TextShimmer active>{loadingLine}</TextShimmer>, 'ongoing')}
230
242
  <PetQuestionRow
231
243
  mood={'thinking' satisfies PetMood}
232
- title={t('card.loading')}
244
+ title={loadingLine}
233
245
  questions={[]}
234
246
  thinkingLabel={t('card.loading.hint')}
235
247
  bubbleLabel={t('card.aria')}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * 文案池 —— 让用户每次看到的提示都不一样,不要像复读机。
3
+ *
4
+ * 三个场景各一个池子:
5
+ * hover :鼠标停在大肥鱼身上时,气泡里那句话
6
+ * greeting :点她一下时,她自己嘟囔的一句招呼
7
+ * loading :点 ✨ 开始改写、她还在读草稿时显示的等待话术
8
+ *
9
+ * 规则:
10
+ * · 每次调用随机取一条,并且**不会和上一次重复**(池子里只剩两句时才允许重复);
11
+ * · 中文走 zh 池,其它语言走 en 池;
12
+ * · 语气活泼俏皮,多用颜文字;不要感叹号、不要客服腔。
13
+ */
14
+
15
+ /** 三个文案场景 */
16
+ export type CopyKind = 'hover' | 'greeting' | 'loading'
17
+
18
+ const POOLS: Record<CopyKind, { readonly zh: readonly string[]; readonly en: readonly string[] }> = {
19
+ hover: {
20
+ zh: [
21
+ '主人,你要配置一下我吗? (๑•̀ㅂ•́)و✧',
22
+ '诶?点我呀~ 我这儿藏了个小面板 (´・ω・)',
23
+ '要调什么嘛,我一直蹲在这儿呢 (・ω・)',
24
+ '唔…是想给我换个脑子吗~ (๑•́ ₃ •̀๑)',
25
+ '戳戳~ 我有反应哦 ヽ(•‿•)ノ',
26
+ '我在我在!想让我怎么干活呀 (。・ω・。)',
27
+ '别光看着我嘛,点一下试试~ ( ̄▽ ̄)',
28
+ '有悄悄话要跟我说吗?(´,,•ω•,,)',
29
+ '戳一下嘛,又不会吃掉你~ (。•̀ᴗ-)✧',
30
+ '嗯?是来找我玩的吗 (◕‿◕)'
31
+ ],
32
+ en: [
33
+ 'Master, would you like to configure me? (๑•̀ㅂ•́)و✧',
34
+ 'Oh? Click me~ I hid a little panel in here (´・ω・)',
35
+ 'Anything to tune? I have been sitting right here (・ω・)',
36
+ 'Hmm… changing my brain? (๑•́ ₃ •̀๑)',
37
+ 'Poke poke~ I do react ヽ(•‿•)ノ',
38
+ 'I am here! How should I work for you? (。・ω・。)',
39
+ 'Do not just stare, give it a click~ ( ̄▽ ̄)',
40
+ 'Something you want to whisper? (´,,•ω•,,)',
41
+ 'Go on, poke me, I do not bite~ (。•̀ᴗ-)✧',
42
+ 'Hm? Here to play with me? (◕‿◕)'
43
+ ]
44
+ },
45
+ greeting: {
46
+ zh: [
47
+ '我在呢~ 先随便写,我帮你翻译成 Agent 听得懂的样子 (๑•̀ㅂ•́)و',
48
+ '唔…让我读读你的真实意图 (・ω・) 说不定你自己都还没发现',
49
+ '别急着发嘛,我先帮你瞅一眼有没有会被误读的地方~ ( ̄▽ ̄)',
50
+ '草稿我读过啦,有几处想跟你确认一下呢 (。・ω・。)',
51
+ '写不动就随便写,反正收拢这些碎话是我的活儿~ ヽ(•‿•)ノ',
52
+ '越随便越好!越随便我越有用武之地 (。•̀ᴗ-)✧',
53
+ '嗯…这句我会不会理解错呢,让我再看一眼 (´,,•ω•,,)',
54
+ '放心写,我不替你编故事,只替你问清楚 (◕‿◕)',
55
+ '你就当我是个特别爱刨根问底的秘书~ (๑•́ ₃ •̀๑)',
56
+ '嘘——先让我把你这句话嚼碎了再还给 Agent (¬‿¬)'
57
+ ],
58
+ en: [
59
+ 'Right here~ write it however you like, I will turn it into something the agent reads correctly (๑•̀ㅂ•́)و',
60
+ 'Hmm… let me read what you actually mean (・ω・) you might not even know yet',
61
+ 'No rush — let me check for anything that could be misread~ ( ̄▽ ̄)',
62
+ 'Read it. A couple of spots I would like to confirm with you (。・ω・。)',
63
+ 'Stuck? Just write something rough — tidying it up is my job~ ヽ(•‿•)ノ',
64
+ 'The messier the better! That is where I shine (。•̀ᴗ-)✧',
65
+ 'Hmm… would I misread this one? Let me look again (´,,•ω•,,)',
66
+ 'Write freely. I never make things up, I only ask (◕‿◕)',
67
+ 'Think of me as a secretary who cannot stop asking why~ (๑•́ ₃ •̀๑)',
68
+ 'Shh — let me chew on this sentence before handing it back (¬‿¬)'
69
+ ]
70
+ },
71
+ loading: {
72
+ zh: [
73
+ '正在读你的草稿… (・ω・)',
74
+ '让我先想想你到底想要什么~ (๑•̀ㅂ•́)و',
75
+ '嗯…这句有点绕,我捋一捋 (´・ω・)',
76
+ '稍等稍等,我在拆你的意思呢 ヽ(•‿•)ノ',
77
+ '检查有没有会被 Agent 理解错的地方… ( ̄▽ ̄)',
78
+ '先把你的话翻译成人话再说~ (。•̀ᴗ-)✧',
79
+ '我在读啦,别催我嘛 (・ω・)',
80
+ '这段话有好几层意思,我分开理理 (。・ω・。)',
81
+ '正在翻箱倒柜找你的真实意图… (´,,•ω•,,)',
82
+ '给我三秒,还你一句 Agent 能听懂的 (◕‿◕)'
83
+ ],
84
+ en: [
85
+ 'Reading your draft… (・ω・)',
86
+ 'Let me think about what you actually want~ (๑•̀ㅂ•́)و',
87
+ 'Hmm… this one is a bit tangled, give me a moment (´・ω・)',
88
+ 'Hold on hold on, I am unpacking what you mean ヽ(•‿•)ノ',
89
+ 'Checking for anything an agent could misread… ( ̄▽▽)',
90
+ 'Translating it into plain intent first~ (。•̀ᴗ-)✧',
91
+ 'I am reading, do not rush me (・ω・)',
92
+ 'A few layers in this one — untangling them (。・ω・。)',
93
+ 'Digging around for your actual intent… (´,,•ω•,,)',
94
+ 'Three seconds, and I will hand back something an agent understands (◕‿◕)'
95
+ ]
96
+ }
97
+ }
98
+
99
+ /** 当前语言读取器:模块级,由 index.tsx 在装配时注入(跟随用户切换语言) */
100
+ let readLocale: () => string = () => (typeof navigator !== 'undefined' && navigator.language ? navigator.language : 'en')
101
+
102
+ /**
103
+ * 注入语言读取器(插件装配时调用一次)。
104
+ * @param reader 返回当前语言标签的函数
105
+ */
106
+ export function setCopyLocale(reader: () => string): void {
107
+ readLocale = reader
108
+ }
109
+
110
+ /** 上一次取到的下标,用来避免连续重复 */
111
+ const lastIndex = new Map<CopyKind, number>()
112
+
113
+ /**
114
+ * 从池子里随机取一句话,避免与上一次相同。
115
+ * @param kind 场景
116
+ * @returns 一条招呼 / 提示 / 等待话术
117
+ */
118
+ export function pickLine(kind: CopyKind): string {
119
+ const pool = readLocale().toLowerCase().startsWith('zh') ? POOLS[kind].zh : POOLS[kind].en
120
+ if (pool.length === 0) return ''
121
+ let index = Math.floor(Math.random() * pool.length)
122
+ if (pool.length > 1 && index === lastIndex.get(kind)) index = (index + 1) % pool.length
123
+ lastIndex.set(kind, index)
124
+ return pool[index]
125
+ }
126
+
127
+ /** 调试用:取整池话 */
128
+ export function copyPool(kind: CopyKind, locale: string): readonly string[] {
129
+ return locale.toLowerCase().startsWith('zh') ? POOLS[kind].zh : POOLS[kind].en
130
+ }
@@ -18,6 +18,7 @@ import { ConveyButtons, ConveyCard } from './components'
18
18
  import { ConveyRegistry } from './controller'
19
19
  import { readRecentContext } from './context'
20
20
  import { createTranslate, en, NS, zh } from './locale'
21
+ import { setCopyLocale } from './copy'
21
22
  import { ConveyDock } from './ResidentDock'
22
23
  import { currentModelOverride } from './settings'
23
24
  import type { LocaleFace, SessionsFace, SlotsFace } from './types'
@@ -72,6 +73,8 @@ export function apply(ctx: Context): void {
72
73
  return 'en'
73
74
  }
74
75
  const t = createTranslate(readLocaleTag)
76
+ // 文案池跟随同一套语言判定(中英各一池,每次随机且不与上次重复)
77
+ setCopyLocale(readLocaleTag)
75
78
 
76
79
  // 3) per-session 控制器注册表;会话服务是可选的(只用于取"上一轮对话"做 context)
77
80
  const sessions = readService<SessionsFace>(ctx, 'sessions')