@wanji_dsh/dsh-sales 0.10.2 → 0.10.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/dist/client.js CHANGED
@@ -91,13 +91,65 @@ function IntentBadge({ intent, t }) {
91
91
  return /* @__PURE__ */ React.createElement("span", { className: "ws-intent-badge", "data-grade": rank?.grade, title: t("intentLabel") }, rank ? rank.grade + " \xB7 " + rank.score : t("intentUnknown"));
92
92
  }
93
93
  function IntentDetails({ intent, t }) {
94
+ const [mode, setMode] = React.useState("closed");
95
+ const container = React.useRef(null);
96
+ const trigger = React.useRef(null);
97
+ const panelId = React.useId();
98
+ const open = mode !== "closed";
94
99
  const rank = rankedIntent(intent);
95
100
  const status = intent?.retryAt ? t("intentWaitingForQuota") : intent?.status === "pending" ? t("intentPending") : intent?.status === "failed" ? t("intentFailed") : void 0;
96
101
  const product = rank && "product" in rank ? rank.product : void 0;
97
- return /* @__PURE__ */ React.createElement("details", { className: "ws-intent-details" }, /* @__PURE__ */ React.createElement("summary", null, t("intentLabel"), /* @__PURE__ */ React.createElement("span", { className: "ws-intent-badge", "data-grade": rank?.grade }, rank ? rank.grade + " \xB7 " + rank.score + " " + t("intentPoints") : t("intentUnknown"))), /* @__PURE__ */ React.createElement("div", { className: "ws-intent-panel" }, status && /* @__PURE__ */ React.createElement("p", { role: "status" }, status), intent?.updatedAt && /* @__PURE__ */ React.createElement("p", null, t("intentUpdated"), " ", /* @__PURE__ */ React.createElement("time", { dateTime: intent.updatedAt }, new Date(intent.updatedAt).toLocaleString())), intent?.crm && /* @__PURE__ */ React.createElement("p", null, t("intentCrm"), " ", intent.crm.grade, " \xB7 ", intent.crm.score, " ", t("intentPoints")), intent?.crmUnavailable && /* @__PURE__ */ React.createElement("p", null, t("intentCrmUnavailable")), !rank && !status && /* @__PURE__ */ React.createElement("p", null, t("intentUnknownReason")), /* @__PURE__ */ React.createElement("dl", null, intentProducts.map((key) => {
98
- const item = intent?.products[key];
99
- return /* @__PURE__ */ React.createElement(React.Fragment, { key }, /* @__PURE__ */ React.createElement("dt", null, productIntentNames[key], product === key ? " \xB7 " + t("intentTopProduct") : ""), /* @__PURE__ */ React.createElement("dd", null, item?.score == null ? item?.stage === "service" ? t("intentService") : t("intentUnknown") : gradeOf(item.score) + " \xB7 " + item.score + " " + t("intentPoints"), item && /* @__PURE__ */ React.createElement("blockquote", null, t(item.evidence.source === "call" ? "intentCallEvidence" : "intentWechatEvidence"), " \xB7 ", /* @__PURE__ */ React.createElement("q", null, item.evidence.quote))));
100
- }))));
102
+ React.useEffect(() => {
103
+ if (!open) return;
104
+ const closeOutside = (event) => {
105
+ if (event.target instanceof Node && !container.current?.contains(event.target)) setMode("closed");
106
+ };
107
+ const closeOnEscape = (event) => {
108
+ if (event.key !== "Escape") return;
109
+ if (container.current?.contains(document.activeElement)) trigger.current?.focus();
110
+ setMode("closed");
111
+ };
112
+ document.addEventListener("pointerdown", closeOutside);
113
+ document.addEventListener("keydown", closeOnEscape);
114
+ return () => {
115
+ document.removeEventListener("pointerdown", closeOutside);
116
+ document.removeEventListener("keydown", closeOnEscape);
117
+ };
118
+ }, [open]);
119
+ return /* @__PURE__ */ React.createElement(
120
+ "div",
121
+ {
122
+ className: "ws-intent-details",
123
+ ref: container,
124
+ onPointerEnter: (event) => {
125
+ if (event.pointerType === "mouse") setMode((current) => current === "closed" ? "hover" : current);
126
+ },
127
+ onPointerLeave: (event) => {
128
+ if (event.pointerType === "mouse") setMode((current) => current === "hover" ? "closed" : current);
129
+ },
130
+ onBlur: (event) => {
131
+ if (!event.currentTarget.contains(event.relatedTarget)) setMode("closed");
132
+ }
133
+ },
134
+ /* @__PURE__ */ React.createElement(
135
+ "button",
136
+ {
137
+ className: "ws-intent-trigger",
138
+ type: "button",
139
+ ref: trigger,
140
+ "aria-controls": panelId,
141
+ "aria-expanded": open,
142
+ onClick: () => setMode((current) => current === "pinned" ? "closed" : "pinned")
143
+ },
144
+ /* @__PURE__ */ React.createElement("span", null, t("intentLabel")),
145
+ /* @__PURE__ */ React.createElement("span", { "aria-hidden": "true" }, "\xB7"),
146
+ /* @__PURE__ */ React.createElement("span", { className: "ws-intent-value" }, rank ? rank.grade + " \xB7 " + rank.score + " " + t("intentPoints") : t("intentUnknown"))
147
+ ),
148
+ /* @__PURE__ */ React.createElement("div", { className: "ws-intent-popover", hidden: !open }, /* @__PURE__ */ React.createElement("div", { className: "ws-intent-panel", id: panelId, role: "region", "aria-label": t("intentLabel"), tabIndex: 0 }, status && /* @__PURE__ */ React.createElement("p", { role: "status" }, status), intent?.updatedAt && /* @__PURE__ */ React.createElement("p", null, t("intentUpdated"), " ", /* @__PURE__ */ React.createElement("time", { dateTime: intent.updatedAt }, new Date(intent.updatedAt).toLocaleString())), intent?.crm && /* @__PURE__ */ React.createElement("p", null, t("intentCrm"), " ", intent.crm.grade, " \xB7 ", intent.crm.score, " ", t("intentPoints")), intent?.crmUnavailable && /* @__PURE__ */ React.createElement("p", null, t("intentCrmUnavailable")), !rank && !status && /* @__PURE__ */ React.createElement("p", null, t("intentUnknownReason")), /* @__PURE__ */ React.createElement("dl", null, intentProducts.map((key) => {
149
+ const item = intent?.products[key];
150
+ return /* @__PURE__ */ React.createElement(React.Fragment, { key }, /* @__PURE__ */ React.createElement("dt", null, productIntentNames[key], product === key ? " \xB7 " + t("intentTopProduct") : ""), /* @__PURE__ */ React.createElement("dd", null, item?.score == null ? item?.stage === "service" ? t("intentService") : t("intentUnknown") : gradeOf(item.score) + " \xB7 " + item.score + " " + t("intentPoints"), item && /* @__PURE__ */ React.createElement("blockquote", null, t(item.evidence.source === "call" ? "intentCallEvidence" : "intentWechatEvidence"), " \xB7 ", /* @__PURE__ */ React.createElement("q", null, item.evidence.quote))));
151
+ }))))
152
+ );
101
153
  }
102
154
 
103
155
  // src/reply-editor.tsx
@@ -106,7 +158,7 @@ var import_react3 = __toESM(require("react"), 1);
106
158
  // src/reply-content.tsx
107
159
  var import_react2 = __toESM(require("react"), 1);
108
160
 
109
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-to-string/lib/index.js
161
+ // ../../node_modules/mdast-util-to-string/lib/index.js
110
162
  var emptyOptions = {};
111
163
  function toString(value, options) {
112
164
  const settings = options || emptyOptions;
@@ -143,7 +195,7 @@ function node(value) {
143
195
  return Boolean(value && typeof value === "object");
144
196
  }
145
197
 
146
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/decode-named-character-reference/index.dom.js
198
+ // ../../node_modules/decode-named-character-reference/index.dom.js
147
199
  var element = document.createElement("i");
148
200
  function decodeNamedCharacterReference(value) {
149
201
  const characterReference2 = "&" + value + ";";
@@ -155,7 +207,7 @@ function decodeNamedCharacterReference(value) {
155
207
  return character === characterReference2 ? false : character;
156
208
  }
157
209
 
158
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-chunked/index.js
210
+ // ../../node_modules/micromark-util-chunked/index.js
159
211
  function splice(list2, start, remove, items) {
160
212
  const end = list2.length;
161
213
  let chunkStart = 0;
@@ -189,7 +241,7 @@ function push(list2, items) {
189
241
  return items;
190
242
  }
191
243
 
192
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-combine-extensions/index.js
244
+ // ../../node_modules/micromark-util-combine-extensions/index.js
193
245
  var hasOwnProperty = {}.hasOwnProperty;
194
246
  function combineExtensions(extensions) {
195
247
  const all2 = {};
@@ -229,7 +281,7 @@ function constructs(existing, list2) {
229
281
  splice(existing, 0, 0, before);
230
282
  }
231
283
 
232
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-numeric-character-reference/index.js
284
+ // ../../node_modules/micromark-util-decode-numeric-character-reference/index.js
233
285
  function decodeNumericCharacterReference(value, base) {
234
286
  const code2 = Number.parseInt(value, base);
235
287
  if (
@@ -247,12 +299,12 @@ function decodeNumericCharacterReference(value, base) {
247
299
  return String.fromCodePoint(code2);
248
300
  }
249
301
 
250
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-normalize-identifier/index.js
302
+ // ../../node_modules/micromark-util-normalize-identifier/index.js
251
303
  function normalizeIdentifier(value) {
252
304
  return value.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
253
305
  }
254
306
 
255
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-character/index.js
307
+ // ../../node_modules/micromark-util-character/index.js
256
308
  var asciiAlpha = regexCheck(/[A-Za-z]/);
257
309
  var asciiAlphanumeric = regexCheck(/[\dA-Za-z]/);
258
310
  var asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/);
@@ -284,7 +336,7 @@ function regexCheck(regex) {
284
336
  }
285
337
  }
286
338
 
287
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-space/index.js
339
+ // ../../node_modules/micromark-factory-space/index.js
288
340
  function factorySpace(effects, ok3, type, max) {
289
341
  const limit = max ? max - 1 : Infinity;
290
342
  let size = 0;
@@ -329,7 +381,7 @@ function factorySpaceMinMax(effects, ok3, nok, type, min, max) {
329
381
  }
330
382
  }
331
383
 
332
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/content.js
384
+ // ../../node_modules/micromark/lib/initialize/content.js
333
385
  var content = {
334
386
  tokenize: initializeContent
335
387
  };
@@ -379,7 +431,7 @@ function initializeContent(effects) {
379
431
  }
380
432
  }
381
433
 
382
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-edit-map/index.js
434
+ // ../../node_modules/micromark-util-edit-map/index.js
383
435
  var EditMap = class {
384
436
  /**
385
437
  * Create a new edit map.
@@ -477,7 +529,7 @@ function addImplementation(editMap, at, remove, add, before) {
477
529
  editMap.index.set(at, change);
478
530
  }
479
531
 
480
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/document.js
532
+ // ../../node_modules/micromark/lib/initialize/document.js
481
533
  var document2 = {
482
534
  tokenize: initializeDocument
483
535
  };
@@ -671,7 +723,7 @@ function tokenizeContainer(effects, ok3, nok) {
671
723
  return factorySpace(effects, effects.attempt(this.parser.constructs.document, ok3, nok), "linePrefix", this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
672
724
  }
673
725
 
674
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-classify-character/index.js
726
+ // ../../node_modules/micromark-util-classify-character/index.js
675
727
  function classifyCharacter(code2) {
676
728
  if (code2 === null || markdownLineEndingOrSpace(code2) || unicodeWhitespace(code2)) {
677
729
  return 1;
@@ -681,7 +733,7 @@ function classifyCharacter(code2) {
681
733
  }
682
734
  }
683
735
 
684
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-resolve-all/index.js
736
+ // ../../node_modules/micromark-util-resolve-all/index.js
685
737
  function resolveAll(constructs2, events, context) {
686
738
  const called = [];
687
739
  let index2 = -1;
@@ -695,7 +747,7 @@ function resolveAll(constructs2, events, context) {
695
747
  return events;
696
748
  }
697
749
 
698
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/attention.js
750
+ // ../../node_modules/micromark-core-commonmark/lib/attention.js
699
751
  var attention = {
700
752
  name: "attention",
701
753
  resolveAll: resolveAllAttention,
@@ -818,7 +870,7 @@ function movePoint(point3, offset) {
818
870
  point3._bufferIndex += offset;
819
871
  }
820
872
 
821
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/autolink.js
873
+ // ../../node_modules/micromark-core-commonmark/lib/autolink.js
822
874
  var autolink = {
823
875
  name: "autolink",
824
876
  tokenize: tokenizeAutolink
@@ -919,7 +971,7 @@ function tokenizeAutolink(effects, ok3, nok) {
919
971
  }
920
972
  }
921
973
 
922
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/blank-line.js
974
+ // ../../node_modules/micromark-core-commonmark/lib/blank-line.js
923
975
  var blankLine = {
924
976
  partial: true,
925
977
  tokenize: tokenizeBlankLine
@@ -934,7 +986,7 @@ function tokenizeBlankLine(effects, ok3, nok) {
934
986
  }
935
987
  }
936
988
 
937
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/block-quote.js
989
+ // ../../node_modules/micromark-core-commonmark/lib/block-quote.js
938
990
  var blockQuote = {
939
991
  continuation: {
940
992
  tokenize: tokenizeBlockQuoteContinuation
@@ -992,7 +1044,7 @@ function exit(effects) {
992
1044
  effects.exit("blockQuote");
993
1045
  }
994
1046
 
995
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-escape.js
1047
+ // ../../node_modules/micromark-core-commonmark/lib/character-escape.js
996
1048
  var characterEscape = {
997
1049
  name: "characterEscape",
998
1050
  tokenize: tokenizeCharacterEscape
@@ -1018,7 +1070,7 @@ function tokenizeCharacterEscape(effects, ok3, nok) {
1018
1070
  }
1019
1071
  }
1020
1072
 
1021
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/character-reference.js
1073
+ // ../../node_modules/micromark-core-commonmark/lib/character-reference.js
1022
1074
  var characterReference = {
1023
1075
  name: "characterReference",
1024
1076
  tokenize: tokenizeCharacterReference
@@ -1083,7 +1135,7 @@ function tokenizeCharacterReference(effects, ok3, nok) {
1083
1135
  }
1084
1136
  }
1085
1137
 
1086
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
1138
+ // ../../node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js
1087
1139
  var nonLazyContinuation = {
1088
1140
  partial: true,
1089
1141
  tokenize: tokenizeNonLazyContinuation
@@ -1105,7 +1157,7 @@ function tokenizeNonLazyContinuation(effects, ok3, nok) {
1105
1157
  }
1106
1158
  }
1107
1159
 
1108
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-fenced.js
1160
+ // ../../node_modules/micromark-core-commonmark/lib/code-fenced.js
1109
1161
  var codeFenced = {
1110
1162
  concrete: true,
1111
1163
  name: "codeFenced",
@@ -1268,7 +1320,7 @@ function tokenizeCodeFenced(effects, ok3, nok) {
1268
1320
  }
1269
1321
  }
1270
1322
 
1271
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-indented.js
1323
+ // ../../node_modules/micromark-core-commonmark/lib/code-indented.js
1272
1324
  var codeIndented = {
1273
1325
  name: "codeIndented",
1274
1326
  tokenize: tokenizeCodeIndented
@@ -1326,7 +1378,7 @@ function tokenizeFurtherStart(effects, ok3, nok) {
1326
1378
  }
1327
1379
  }
1328
1380
 
1329
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/code-text.js
1381
+ // ../../node_modules/micromark-core-commonmark/lib/code-text.js
1330
1382
  var codeText = {
1331
1383
  name: "codeText",
1332
1384
  previous,
@@ -1441,7 +1493,7 @@ function tokenizeCodeText(effects, ok3, nok) {
1441
1493
  }
1442
1494
  }
1443
1495
 
1444
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/lib/splice-buffer.js
1496
+ // ../../node_modules/micromark-util-subtokenize/lib/splice-buffer.js
1445
1497
  var SpliceBuffer = class {
1446
1498
  /**
1447
1499
  * @param {ReadonlyArray<T> | null | undefined} [initial]
@@ -1634,7 +1686,7 @@ function chunkedPush(list2, right) {
1634
1686
  }
1635
1687
  }
1636
1688
 
1637
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-subtokenize/index.js
1689
+ // ../../node_modules/micromark-util-subtokenize/index.js
1638
1690
  function subtokenize(eventsArray) {
1639
1691
  const jumps = {};
1640
1692
  let index2 = -1;
@@ -1787,7 +1839,7 @@ function subcontent(events, eventIndex) {
1787
1839
  return gaps;
1788
1840
  }
1789
1841
 
1790
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/content.js
1842
+ // ../../node_modules/micromark-core-commonmark/lib/content.js
1791
1843
  var content2 = {
1792
1844
  resolve: resolveContent,
1793
1845
  tokenize: tokenizeContent
@@ -1858,7 +1910,7 @@ function tokenizeContinuation(effects, ok3, nok) {
1858
1910
  }
1859
1911
  }
1860
1912
 
1861
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-destination/index.js
1913
+ // ../../node_modules/micromark-factory-destination/index.js
1862
1914
  function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerType, rawType, stringType, max) {
1863
1915
  const limit = max || Number.POSITIVE_INFINITY;
1864
1916
  let balance = 0;
@@ -1950,7 +2002,7 @@ function factoryDestination(effects, ok3, nok, type, literalType, literalMarkerT
1950
2002
  }
1951
2003
  }
1952
2004
 
1953
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-label/index.js
2005
+ // ../../node_modules/micromark-factory-label/index.js
1954
2006
  function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
1955
2007
  const self = this;
1956
2008
  let size = 0;
@@ -2011,7 +2063,7 @@ function factoryLabel(effects, ok3, nok, type, markerType, stringType) {
2011
2063
  }
2012
2064
  }
2013
2065
 
2014
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-title/index.js
2066
+ // ../../node_modules/micromark-factory-title/index.js
2015
2067
  function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
2016
2068
  let marker;
2017
2069
  return start;
@@ -2073,7 +2125,7 @@ function factoryTitle(effects, ok3, nok, type, markerType, stringType) {
2073
2125
  }
2074
2126
  }
2075
2127
 
2076
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-factory-whitespace/index.js
2128
+ // ../../node_modules/micromark-factory-whitespace/index.js
2077
2129
  function factoryWhitespace(effects, ok3) {
2078
2130
  let seen;
2079
2131
  return start;
@@ -2092,7 +2144,7 @@ function factoryWhitespace(effects, ok3) {
2092
2144
  }
2093
2145
  }
2094
2146
 
2095
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/definition.js
2147
+ // ../../node_modules/micromark-core-commonmark/lib/definition.js
2096
2148
  var definition = {
2097
2149
  name: "definition",
2098
2150
  tokenize: tokenizeDefinition
@@ -2178,7 +2230,7 @@ function tokenizeTitleBefore(effects, ok3, nok) {
2178
2230
  }
2179
2231
  }
2180
2232
 
2181
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/hard-break-escape.js
2233
+ // ../../node_modules/micromark-core-commonmark/lib/hard-break-escape.js
2182
2234
  var hardBreakEscape = {
2183
2235
  name: "hardBreakEscape",
2184
2236
  tokenize: tokenizeHardBreakEscape
@@ -2199,7 +2251,7 @@ function tokenizeHardBreakEscape(effects, ok3, nok) {
2199
2251
  }
2200
2252
  }
2201
2253
 
2202
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/heading-atx.js
2254
+ // ../../node_modules/micromark-core-commonmark/lib/heading-atx.js
2203
2255
  var headingAtx = {
2204
2256
  name: "headingAtx",
2205
2257
  resolve: resolveHeadingAtx,
@@ -2288,7 +2340,7 @@ function tokenizeHeadingAtx(effects, ok3, nok) {
2288
2340
  }
2289
2341
  }
2290
2342
 
2291
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-html-tag-name/index.js
2343
+ // ../../node_modules/micromark-util-html-tag-name/index.js
2292
2344
  var htmlBlockNames = [
2293
2345
  "address",
2294
2346
  "article",
@@ -2355,7 +2407,7 @@ var htmlBlockNames = [
2355
2407
  ];
2356
2408
  var htmlRawNames = ["pre", "script", "style", "textarea"];
2357
2409
 
2358
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-flow.js
2410
+ // ../../node_modules/micromark-core-commonmark/lib/html-flow.js
2359
2411
  var htmlFlow = {
2360
2412
  concrete: true,
2361
2413
  name: "htmlFlow",
@@ -2714,7 +2766,7 @@ function tokenizeBlankLineBefore(effects, ok3, nok) {
2714
2766
  }
2715
2767
  }
2716
2768
 
2717
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/html-text.js
2769
+ // ../../node_modules/micromark-core-commonmark/lib/html-text.js
2718
2770
  var htmlText = {
2719
2771
  name: "htmlText",
2720
2772
  tokenize: tokenizeHtmlText
@@ -3020,7 +3072,7 @@ function tokenizeHtmlText(effects, ok3, nok) {
3020
3072
  }
3021
3073
  }
3022
3074
 
3023
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-end.js
3075
+ // ../../node_modules/micromark-core-commonmark/lib/label-end.js
3024
3076
  var labelEnd = {
3025
3077
  name: "labelEnd",
3026
3078
  resolveAll: resolveAllLabelEnd,
@@ -3246,7 +3298,7 @@ function tokenizeReferenceCollapsed(effects, ok3, nok) {
3246
3298
  }
3247
3299
  }
3248
3300
 
3249
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-image.js
3301
+ // ../../node_modules/micromark-core-commonmark/lib/label-start-image.js
3250
3302
  var labelStartImage = {
3251
3303
  name: "labelStartImage",
3252
3304
  resolveAll: labelEnd.resolveAll,
@@ -3283,7 +3335,7 @@ function tokenizeLabelStartImage(effects, ok3, nok) {
3283
3335
  }
3284
3336
  }
3285
3337
 
3286
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/label-start-link.js
3338
+ // ../../node_modules/micromark-core-commonmark/lib/label-start-link.js
3287
3339
  var labelStartLink = {
3288
3340
  name: "labelStartLink",
3289
3341
  resolveAll: labelEnd.resolveAll,
@@ -3311,7 +3363,7 @@ function tokenizeLabelStartLink(effects, ok3, nok) {
3311
3363
  }
3312
3364
  }
3313
3365
 
3314
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/line-ending.js
3366
+ // ../../node_modules/micromark-core-commonmark/lib/line-ending.js
3315
3367
  var lineEnding = {
3316
3368
  name: "lineEnding",
3317
3369
  tokenize: tokenizeLineEnding
@@ -3326,7 +3378,7 @@ function tokenizeLineEnding(effects, ok3) {
3326
3378
  }
3327
3379
  }
3328
3380
 
3329
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/thematic-break.js
3381
+ // ../../node_modules/micromark-core-commonmark/lib/thematic-break.js
3330
3382
  var thematicBreak = {
3331
3383
  name: "thematicBreak",
3332
3384
  tokenize: tokenizeThematicBreak
@@ -3365,7 +3417,7 @@ function tokenizeThematicBreak(effects, ok3, nok) {
3365
3417
  }
3366
3418
  }
3367
3419
 
3368
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/list.js
3420
+ // ../../node_modules/micromark-core-commonmark/lib/list.js
3369
3421
  var list = {
3370
3422
  continuation: {
3371
3423
  tokenize: tokenizeListContinuation
@@ -3495,7 +3547,7 @@ function tokenizeListItemPrefixWhitespace(effects, ok3, nok) {
3495
3547
  }
3496
3548
  }
3497
3549
 
3498
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-core-commonmark/lib/setext-underline.js
3550
+ // ../../node_modules/micromark-core-commonmark/lib/setext-underline.js
3499
3551
  var setextUnderline = {
3500
3552
  name: "setextUnderline",
3501
3553
  resolveTo: resolveToSetextUnderline,
@@ -3589,7 +3641,7 @@ function tokenizeSetextUnderline(effects, ok3, nok) {
3589
3641
  }
3590
3642
  }
3591
3643
 
3592
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/flow.js
3644
+ // ../../node_modules/micromark/lib/initialize/flow.js
3593
3645
  var flow = {
3594
3646
  tokenize: initializeFlow
3595
3647
  };
@@ -3627,7 +3679,7 @@ function initializeFlow(effects) {
3627
3679
  }
3628
3680
  }
3629
3681
 
3630
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/initialize/text.js
3682
+ // ../../node_modules/micromark/lib/initialize/text.js
3631
3683
  var resolver = {
3632
3684
  resolveAll: createResolver()
3633
3685
  };
@@ -3769,7 +3821,7 @@ function resolveAllLineSuffixes(events, context) {
3769
3821
  return events;
3770
3822
  }
3771
3823
 
3772
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/constructs.js
3824
+ // ../../node_modules/micromark/lib/constructs.js
3773
3825
  var constructs_exports = {};
3774
3826
  __export(constructs_exports, {
3775
3827
  attentionMarkers: () => attentionMarkers,
@@ -3844,7 +3896,7 @@ var disable = {
3844
3896
  null: []
3845
3897
  };
3846
3898
 
3847
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/create-tokenizer.js
3899
+ // ../../node_modules/micromark/lib/create-tokenizer.js
3848
3900
  function createTokenizer(parser, initialize, from) {
3849
3901
  let point3 = {
3850
3902
  _bufferIndex: -1,
@@ -4170,7 +4222,7 @@ function serializeChunks(chunks, expandTabs) {
4170
4222
  return result.join("");
4171
4223
  }
4172
4224
 
4173
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/parse.js
4225
+ // ../../node_modules/micromark/lib/parse.js
4174
4226
  function parse(options) {
4175
4227
  const settings = options || {};
4176
4228
  const constructs2 = (
@@ -4196,14 +4248,14 @@ function parse(options) {
4196
4248
  }
4197
4249
  }
4198
4250
 
4199
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/postprocess.js
4251
+ // ../../node_modules/micromark/lib/postprocess.js
4200
4252
  function postprocess(events) {
4201
4253
  while (!subtokenize(events)) {
4202
4254
  }
4203
4255
  return events;
4204
4256
  }
4205
4257
 
4206
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark/lib/preprocess.js
4258
+ // ../../node_modules/micromark/lib/preprocess.js
4207
4259
  var search = /[\0\t\n\r]/g;
4208
4260
  function preprocess() {
4209
4261
  let column = 1;
@@ -4283,7 +4335,7 @@ function preprocess() {
4283
4335
  }
4284
4336
  }
4285
4337
 
4286
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-util-decode-string/index.js
4338
+ // ../../node_modules/micromark-util-decode-string/index.js
4287
4339
  var characterEscapeOrReference = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
4288
4340
  function decodeString(value) {
4289
4341
  return value.replace(characterEscapeOrReference, decode);
@@ -4301,7 +4353,7 @@ function decode($0, $1, $2) {
4301
4353
  return decodeNamedCharacterReference($2) || $0;
4302
4354
  }
4303
4355
 
4304
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-stringify-position/lib/index.js
4356
+ // ../../node_modules/unist-util-stringify-position/lib/index.js
4305
4357
  function stringifyPosition(value) {
4306
4358
  if (!value || typeof value !== "object") {
4307
4359
  return "";
@@ -4327,7 +4379,7 @@ function index(value) {
4327
4379
  return value && typeof value === "number" ? value : 1;
4328
4380
  }
4329
4381
 
4330
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-from-markdown/lib/index.js
4382
+ // ../../node_modules/mdast-util-from-markdown/lib/index.js
4331
4383
  var own = {}.hasOwnProperty;
4332
4384
  function fromMarkdown(value, encoding, options) {
4333
4385
  if (encoding && typeof encoding === "object") {
@@ -5036,7 +5088,7 @@ function defaultOnError(left, right) {
5036
5088
  }
5037
5089
  }
5038
5090
 
5039
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/ccount/index.js
5091
+ // ../../node_modules/ccount/index.js
5040
5092
  function ccount(value, character) {
5041
5093
  const source = String(value);
5042
5094
  if (typeof character !== "string") {
@@ -5051,11 +5103,11 @@ function ccount(value, character) {
5051
5103
  return count;
5052
5104
  }
5053
5105
 
5054
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/devlop/lib/default.js
5106
+ // ../../node_modules/devlop/lib/default.js
5055
5107
  function ok() {
5056
5108
  }
5057
5109
 
5058
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/escape-string-regexp/index.js
5110
+ // ../../node_modules/escape-string-regexp/index.js
5059
5111
  function escapeStringRegexp(string5) {
5060
5112
  if (typeof string5 !== "string") {
5061
5113
  throw new TypeError("Expected a string");
@@ -5063,7 +5115,7 @@ function escapeStringRegexp(string5) {
5063
5115
  return string5.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
5064
5116
  }
5065
5117
 
5066
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-is/lib/index.js
5118
+ // ../../node_modules/unist-util-is/lib/index.js
5067
5119
  var convert = (
5068
5120
  // Note: overloads in JSDoc can’t yet use different `@template`s.
5069
5121
  /**
@@ -5162,12 +5214,12 @@ function looksLikeANode(value) {
5162
5214
  return value !== null && typeof value === "object" && "type" in value;
5163
5215
  }
5164
5216
 
5165
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/color.js
5217
+ // ../../node_modules/unist-util-visit-parents/lib/color.js
5166
5218
  function color(d) {
5167
5219
  return d;
5168
5220
  }
5169
5221
 
5170
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/unist-util-visit-parents/lib/index.js
5222
+ // ../../node_modules/unist-util-visit-parents/lib/index.js
5171
5223
  var empty = [];
5172
5224
  var CONTINUE = true;
5173
5225
  var EXIT = false;
@@ -5287,7 +5339,7 @@ function toResult(value) {
5287
5339
  return value === null || value === void 0 ? empty : [value];
5288
5340
  }
5289
5341
 
5290
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-find-and-replace/lib/index.js
5342
+ // ../../node_modules/mdast-util-find-and-replace/lib/index.js
5291
5343
  function findAndReplace(tree, list2, options) {
5292
5344
  const settings = options || {};
5293
5345
  const ignored = convert(settings.ignore || []);
@@ -5388,7 +5440,7 @@ function toFunction(replace2) {
5388
5440
  };
5389
5441
  }
5390
5442
 
5391
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-autolink-literal/lib/index.js
5443
+ // ../../node_modules/mdast-util-gfm-autolink-literal/lib/index.js
5392
5444
  function gfmAutolinkLiteralFromMarkdown() {
5393
5445
  return {
5394
5446
  transforms: [transformGfmAutolinkLiterals],
@@ -5553,7 +5605,7 @@ function previous2(match) {
5553
5605
  return match.index === 0 || unicodeWhitespace(code2) || unicodePunctuation(code2);
5554
5606
  }
5555
5607
 
5556
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-footnote/lib/index.js
5608
+ // ../../node_modules/mdast-util-gfm-footnote/lib/index.js
5557
5609
  footnoteReference.peek = footnoteReferencePeek;
5558
5610
  function enterFootnoteCallString() {
5559
5611
  this.buffer();
@@ -5627,7 +5679,7 @@ function gfmFootnoteFromMarkdown() {
5627
5679
  };
5628
5680
  }
5629
5681
 
5630
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-strikethrough/lib/index.js
5682
+ // ../../node_modules/mdast-util-gfm-strikethrough/lib/index.js
5631
5683
  handleDelete.attention = attentionDelete;
5632
5684
  handleDelete.peek = peekDelete;
5633
5685
  function gfmStrikethroughFromMarkdown() {
@@ -5664,7 +5716,7 @@ function peekDelete() {
5664
5716
  return "~";
5665
5717
  }
5666
5718
 
5667
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-table/lib/index.js
5719
+ // ../../node_modules/mdast-util-gfm-table/lib/index.js
5668
5720
  function gfmTableFromMarkdown() {
5669
5721
  return {
5670
5722
  enter: {
@@ -5725,7 +5777,7 @@ function replace($0, $1) {
5725
5777
  return $1 === "|" ? $1 : $0;
5726
5778
  }
5727
5779
 
5728
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm-task-list-item/lib/index.js
5780
+ // ../../node_modules/mdast-util-gfm-task-list-item/lib/index.js
5729
5781
  function gfmTaskListItemFromMarkdown() {
5730
5782
  return {
5731
5783
  exit: {
@@ -5772,7 +5824,7 @@ function exitParagraphWithTaskListItem(token) {
5772
5824
  this.exit(token);
5773
5825
  }
5774
5826
 
5775
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/mdast-util-gfm/lib/index.js
5827
+ // ../../node_modules/mdast-util-gfm/lib/index.js
5776
5828
  function gfmFromMarkdown() {
5777
5829
  return [
5778
5830
  gfmAutolinkLiteralFromMarkdown(),
@@ -5783,7 +5835,7 @@ function gfmFromMarkdown() {
5783
5835
  ];
5784
5836
  }
5785
5837
 
5786
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
5838
+ // ../../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
5787
5839
  var wwwPrefix = {
5788
5840
  tokenize: tokenizeWwwPrefix,
5789
5841
  partial: true
@@ -6125,7 +6177,7 @@ function previousUnbalanced(events) {
6125
6177
  return result;
6126
6178
  }
6127
6179
 
6128
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-footnote/lib/syntax.js
6180
+ // ../../node_modules/micromark-extension-gfm-footnote/lib/syntax.js
6129
6181
  var indent = {
6130
6182
  tokenize: tokenizeIndent2,
6131
6183
  partial: true
@@ -6400,7 +6452,7 @@ function tokenizeIndent2(effects, ok3, nok) {
6400
6452
  }
6401
6453
  }
6402
6454
 
6403
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
6455
+ // ../../node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js
6404
6456
  function gfmStrikethrough(options) {
6405
6457
  const options_ = options || {};
6406
6458
  let single = options_.singleTilde;
@@ -6494,7 +6546,7 @@ function gfmStrikethrough(options) {
6494
6546
  }
6495
6547
  }
6496
6548
 
6497
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/edit-map.js
6549
+ // ../../node_modules/micromark-extension-gfm-table/lib/edit-map.js
6498
6550
  var EditMap2 = class {
6499
6551
  /**
6500
6552
  * Create a new edit map.
@@ -6580,7 +6632,7 @@ function addImplementation2(editMap, at, remove, add) {
6580
6632
  editMap.index.set(at, change);
6581
6633
  }
6582
6634
 
6583
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/infer.js
6635
+ // ../../node_modules/micromark-extension-gfm-table/lib/infer.js
6584
6636
  function gfmTableAlign(events, index2) {
6585
6637
  let inDelimiterRow = false;
6586
6638
  const align = [];
@@ -6607,7 +6659,7 @@ function gfmTableAlign(events, index2) {
6607
6659
  return align;
6608
6660
  }
6609
6661
 
6610
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-table/lib/syntax.js
6662
+ // ../../node_modules/micromark-extension-gfm-table/lib/syntax.js
6611
6663
  function gfmTable() {
6612
6664
  return {
6613
6665
  flow: {
@@ -6998,7 +7050,7 @@ function getPoint(events, index2) {
6998
7050
  return event[1][side];
6999
7051
  }
7000
7052
 
7001
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
7053
+ // ../../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js
7002
7054
  var tasklistCheck = {
7003
7055
  name: "tasklistCheck",
7004
7056
  tokenize: tokenizeTasklistCheck
@@ -7072,7 +7124,7 @@ function spaceThenNonSpace(effects, ok3, nok) {
7072
7124
  }
7073
7125
  }
7074
7126
 
7075
- // ../../../../../../Users/imac/Code/万机/wanji_dazi_dsh/node_modules/micromark-extension-gfm/index.js
7127
+ // ../../node_modules/micromark-extension-gfm/index.js
7076
7128
  function gfm(options) {
7077
7129
  return combineExtensions([
7078
7130
  gfmAutolinkLiteral(),
@@ -7143,25 +7195,21 @@ var import_react = __toESM(require("react"), 1);
7143
7195
  // src/wechat/image-preview-geometry.ts
7144
7196
  function fitImageScale(width, height, availableWidth, availableHeight) {
7145
7197
  if (![width, height, availableWidth, availableHeight].every((v) => Number.isFinite(v) && v > 0)) return 1;
7146
- return Math.min(1, availableWidth / width, availableHeight / height);
7198
+ return Math.min(availableWidth / width, availableHeight / height);
7199
+ }
7200
+ function imageZoomRange(fit) {
7201
+ return { min: Math.min(0.1, fit), max: Math.max(4, fit) };
7147
7202
  }
7148
7203
  function clampImageScale(value, fit) {
7149
- return Number.isFinite(value) ? Math.max(Math.min(0.1, fit), Math.min(4, value)) : fit;
7204
+ const { min, max } = imageZoomRange(fit);
7205
+ return Number.isFinite(value) ? Math.max(min, Math.min(max, value)) : fit;
7150
7206
  }
7151
7207
 
7152
7208
  // src/wechat/image-preview.tsx
7153
7209
  function ImagePreview({ src, t, onClose, onError, returnFocus }) {
7154
- const dialog = (0, import_react.useRef)(null), canvas = (0, import_react.useRef)(null), fitted = (0, import_react.useRef)(true), fit = (0, import_react.useRef)(1);
7155
- const [natural, setNatural] = (0, import_react.useState)({ width: 0, height: 0 }), [scale, setScale] = (0, import_react.useState)(1);
7156
- const fitToCanvas = () => {
7157
- const el = canvas.current;
7158
- if (!el || !natural.width) return;
7159
- fit.current = fitImageScale(natural.width, natural.height, Math.max(1, el.clientWidth - 32), Math.max(1, el.clientHeight - 32));
7160
- if (fitted.current) {
7161
- setScale(fit.current);
7162
- el.scrollTo(0, 0);
7163
- }
7164
- };
7210
+ const dialog = (0, import_react.useRef)(null), canvas = (0, import_react.useRef)(null);
7211
+ const [{ width, height }, setNatural] = (0, import_react.useState)({ width: 0, height: 0 }), [fit, setFit] = (0, import_react.useState)(1);
7212
+ const [manualScale, setManualScale] = (0, import_react.useState)();
7165
7213
  (0, import_react.useLayoutEffect)(() => {
7166
7214
  const el = dialog.current;
7167
7215
  el?.showModal();
@@ -7171,19 +7219,25 @@ function ImagePreview({ src, t, onClose, onError, returnFocus }) {
7171
7219
  };
7172
7220
  }, []);
7173
7221
  (0, import_react.useLayoutEffect)(() => {
7174
- fitToCanvas();
7175
- if (!canvas.current || typeof ResizeObserver === "undefined") return;
7176
- const observer = new ResizeObserver(fitToCanvas);
7177
- observer.observe(canvas.current);
7222
+ const el = canvas.current;
7223
+ if (!el || !width) return;
7224
+ const measure = () => setFit(fitImageScale(width, height, Math.max(1, el.clientWidth - 32), Math.max(1, el.clientHeight - 32)));
7225
+ measure();
7226
+ if (typeof ResizeObserver === "undefined") return;
7227
+ const observer = new ResizeObserver(measure);
7228
+ observer.observe(el);
7178
7229
  return () => observer.disconnect();
7179
- }, [natural.width, natural.height]);
7230
+ }, [width, height]);
7231
+ const scale = manualScale === void 0 ? fit : clampImageScale(manualScale, fit);
7232
+ const { min, max } = imageZoomRange(fit);
7180
7233
  const zoom = (factor) => {
7181
- fitted.current = false;
7182
- setScale((value) => clampImageScale(value * factor, fit.current));
7234
+ if (!width) return;
7235
+ const next = clampImageScale(scale * factor, fit);
7236
+ if (next !== scale) setManualScale(next);
7183
7237
  };
7184
7238
  const reset = () => {
7185
- fitted.current = true;
7186
- fitToCanvas();
7239
+ setManualScale(void 0);
7240
+ canvas.current?.scrollTo(0, 0);
7187
7241
  };
7188
7242
  return /* @__PURE__ */ import_react.default.createElement("dialog", { ref: dialog, className: "ws-image-dialog", "aria-label": t("wxImagePreview"), onCancel: (event) => {
7189
7243
  event.preventDefault();
@@ -7193,12 +7247,14 @@ function ImagePreview({ src, t, onClose, onError, returnFocus }) {
7193
7247
  const r = event.currentTarget.getBoundingClientRect();
7194
7248
  if (event.clientX < r.left || event.clientX > r.right || event.clientY < r.top || event.clientY > r.bottom) onClose();
7195
7249
  }, onKeyDown: (event) => {
7196
- if (["+", "=", "-", "0"].includes(event.key)) {
7250
+ if (["+", "=", "-", "0", "1"].includes(event.key)) {
7197
7251
  event.preventDefault();
7198
7252
  if (event.key === "0") reset();
7199
- else zoom(event.key === "-" ? 1 / 1.25 : 1.25);
7253
+ else if (event.key === "1") {
7254
+ if (width) setManualScale(1);
7255
+ } else zoom(event.key === "-" ? 1 / 1.25 : 1.25);
7200
7256
  }
7201
- } }, /* @__PURE__ */ import_react.default.createElement("header", { className: "ws-image-toolbar" }, /* @__PURE__ */ import_react.default.createElement("strong", null, t("wxImagePreview")), /* @__PURE__ */ import_react.default.createElement("div", { className: "ws-image-tools" }, /* @__PURE__ */ import_react.default.createElement("button", { type: "button", disabled: !natural.width || scale <= Math.min(0.1, fit.current), "aria-label": t("wxImageZoomOut"), title: t("wxImageZoomOut"), onClick: () => zoom(1 / 1.25) }, "\u2212"), /* @__PURE__ */ import_react.default.createElement("span", { className: "ws-image-scale", "aria-live": "polite" }, Math.round(scale * 100), "%"), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", disabled: !natural.width || scale >= 4, "aria-label": t("wxImageZoomIn"), title: t("wxImageZoomIn"), onClick: () => zoom(1.25) }, "+"), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: "ws-image-fit", disabled: !natural.width, onClick: reset }, t("wxImageFit")), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: "ws-image-close", autoFocus: true, "aria-label": t("wxClosePreview"), title: t("wxClosePreview"), onClick: onClose }, "\xD7"))), /* @__PURE__ */ import_react.default.createElement("div", { className: "ws-image-canvas", ref: canvas }, /* @__PURE__ */ import_react.default.createElement("div", { className: "ws-image-stage" }, /* @__PURE__ */ import_react.default.createElement("img", { src, alt: t("wxImageAlt"), draggable: false, style: natural.width ? { width: natural.width * scale, height: natural.height * scale } : void 0, onLoad: (event) => setNatural({ width: event.currentTarget.naturalWidth, height: event.currentTarget.naturalHeight }), onError }))));
7257
+ } }, /* @__PURE__ */ import_react.default.createElement("header", { className: "ws-image-toolbar" }, /* @__PURE__ */ import_react.default.createElement("strong", null, t("wxImagePreview")), /* @__PURE__ */ import_react.default.createElement("div", { className: "ws-image-tools" }, /* @__PURE__ */ import_react.default.createElement("button", { type: "button", disabled: !width || scale <= min, "aria-label": t("wxImageZoomOut"), title: t("wxImageZoomOut"), onClick: () => zoom(1 / 1.25) }, "\u2212"), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: "ws-image-scale", disabled: !width, "aria-label": t("wxImageActualSize"), title: t("wxImageActualSize"), onClick: () => setManualScale(1) }, /* @__PURE__ */ import_react.default.createElement("span", { "aria-live": "polite" }, Math.round(scale * 100), "%")), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", disabled: !width || scale >= max, "aria-label": t("wxImageZoomIn"), title: t("wxImageZoomIn"), onClick: () => zoom(1.25) }, "+"), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: "ws-image-fit", disabled: !width, onClick: reset }, t("wxImageFit")), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", className: "ws-image-close", autoFocus: true, "aria-label": t("wxClosePreview"), title: t("wxClosePreview"), onClick: onClose }, "\xD7"))), /* @__PURE__ */ import_react.default.createElement("div", { className: "ws-image-canvas", ref: canvas }, /* @__PURE__ */ import_react.default.createElement("div", { className: "ws-image-stage" }, /* @__PURE__ */ import_react.default.createElement("img", { src, alt: t("wxImageAlt"), draggable: false, style: { width: width * scale, height: height * scale }, onLoad: (event) => setNatural({ width: event.currentTarget.naturalWidth, height: event.currentTarget.naturalHeight }), onError }))));
7202
7258
  }
7203
7259
 
7204
7260
  // src/reply-content.tsx
@@ -7502,7 +7558,7 @@ function wechatPresentation(view) {
7502
7558
  if (s?.message === "WECHAT_OTHER_WORKSPACE") return { statusKey: "wxOtherWorkspace", emptyKey, hintKey: "wxOtherWorkspaceHint", blocked: true };
7503
7559
  if (s?.phase === "error") return { statusKey: "wxConnectionFailed", emptyKey, hintKey: "wxConnectionFailedHint", blocked: false };
7504
7560
  if (s?.phase === "authorizing") return { statusKey: "wxAwaitConsent", emptyKey, hintKey: "wxAwaitConsentHint", blocked: false };
7505
- if (s?.phase === "paused") return { statusKey: "wxPaused", emptyKey, hintKey: "wxPausedHint", blocked: false };
7561
+ if (s?.phase === "paused") return { statusKey: "wxPaused", emptyKey, blocked: false };
7506
7562
  if (s?.phase === "waiting") return { statusKey: "wxLive", emptyKey, blocked: false };
7507
7563
  if (s?.phase === "ready") return { statusKey: "wxReady", emptyKey, blocked: false };
7508
7564
  if (s) return { statusKey: "wxDisconnected", emptyKey, hintKey: "wxDisconnectedHint", blocked: false };
@@ -7721,7 +7777,7 @@ function createWechatClient(rpc, snapshot, options = {}) {
7721
7777
  },
7722
7778
  async media(mediaId) {
7723
7779
  const result = await request("media", { mediaId });
7724
- if (!/^(image\/(png|jpeg|gif|webp)|audio\/[a-z0-9.+-]+)$/i.test(result.mimeType)) throw Error("\u4E0D\u652F\u6301\u6B64\u5A92\u4F53\u7C7B\u578B");
7780
+ if (!/^(image\/(png|jpeg|gif|webp)|audio\/[a-z0-9.+-]+|video\/mp4)$/i.test(result.mimeType)) throw Error("\u4E0D\u652F\u6301\u6B64\u5A92\u4F53\u7C7B\u578B");
7725
7781
  return `data:${result.mimeType};base64,${result.data}`;
7726
7782
  },
7727
7783
  dispose() {
@@ -7803,18 +7859,19 @@ var voicePlayback = new VoicePlaybackCoordinator();
7803
7859
 
7804
7860
  // src/wechat/message-media.tsx
7805
7861
  function WechatMessageBody({ message, client, revision: revision2, t }) {
7806
- const attachment = message.kind === "image" || message.kind === "voice" || message.kind === "audio";
7807
- const text4 = attachment ? /^\[(?:image|图片|(?:voice|audio|语音)(?:\s*\d+(?:\.\d+)?\s*(?:秒|s|["″”]))?)\]$/i.test(message.text?.trim() ?? "") ? "" : message.text : message.text || `[${message.kind}]`;
7808
- return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, text4 && /* @__PURE__ */ import_react7.default.createElement("div", null, text4), message.mediaId ? /* @__PURE__ */ import_react7.default.createElement(NativeMedia, { client, mediaId: message.mediaId, kind: message.kind, revision: revision2, t }) : attachment && (message.kind === "image" ? /* @__PURE__ */ import_react7.default.createElement("span", { className: "ws-media-placeholder" }, t("wxImagePending")) : /* @__PURE__ */ import_react7.default.createElement(VoicePlaceholder, { state: "pending", t })));
7862
+ const attachment = message.kind === "image" || message.kind === "voice" || message.kind === "audio" || message.kind === "video";
7863
+ const text4 = attachment ? /^\[(?:image|图片|video|视频|(?:voice|audio|语音)(?:\s*\d+(?:\.\d+)?\s*(?:秒|s|["″”]))?)\]$/i.test(message.text?.trim() ?? "") ? "" : message.text : message.text || `[${message.kind}]`;
7864
+ return /* @__PURE__ */ import_react7.default.createElement(import_react7.default.Fragment, null, text4 && /* @__PURE__ */ import_react7.default.createElement("div", null, text4), message.mediaId ? /* @__PURE__ */ import_react7.default.createElement(NativeMedia, { client, mediaId: message.mediaId, kind: message.kind, revision: revision2, t }) : attachment && (message.kind === "image" || message.kind === "video" ? /* @__PURE__ */ import_react7.default.createElement("span", { className: "ws-media-placeholder" }, t(message.kind === "video" ? "wxVideoPending" : "wxImagePending")) : /* @__PURE__ */ import_react7.default.createElement(VoicePlaceholder, { state: "pending", t })));
7809
7865
  }
7810
7866
  function NativeMedia(props) {
7811
7867
  return /* @__PURE__ */ import_react7.default.createElement(MediaAttachment, { key: props.mediaId, ...props });
7812
7868
  }
7813
7869
  function MediaAttachment({ client, mediaId, kind, revision: revision2, t }) {
7814
7870
  const [result, setResult] = (0, import_react7.useState)({ mediaId });
7871
+ const [requested, setRequested] = (0, import_react7.useState)(kind !== "video");
7815
7872
  const [retry, setRetry] = (0, import_react7.useState)(0), element2 = (0, import_react7.useRef)(null), loaded = (0, import_react7.useRef)(false);
7816
7873
  (0, import_react7.useEffect)(() => {
7817
- if (loaded.current) return;
7874
+ if (!requested || loaded.current) return;
7818
7875
  let cancel, started = false;
7819
7876
  const load = () => {
7820
7877
  if (started) return;
@@ -7837,11 +7894,14 @@ function MediaAttachment({ client, mediaId, kind, revision: revision2, t }) {
7837
7894
  observer?.disconnect();
7838
7895
  cancel?.();
7839
7896
  };
7840
- }, [client, mediaId, revision2, retry]);
7897
+ }, [client, mediaId, revision2, retry, requested]);
7841
7898
  const failed = () => {
7842
7899
  loaded.current = false;
7843
7900
  setResult({ mediaId, error: "decode" });
7844
7901
  };
7902
+ if (kind === "video") {
7903
+ return /* @__PURE__ */ import_react7.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? /* @__PURE__ */ import_react7.default.createElement("video", { src: result.url, controls: true, playsInline: true, preload: "metadata", "aria-label": t("wxVideoMessage"), onError: failed }) : result.error ? /* @__PURE__ */ import_react7.default.createElement("span", { role: "status" }, t("wxVideoUnavailable"), " ", /* @__PURE__ */ import_react7.default.createElement("button", { type: "button", className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : requested ? /* @__PURE__ */ import_react7.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxVideoLoading")) : /* @__PURE__ */ import_react7.default.createElement("button", { type: "button", className: "ws-button ws-video-load", onClick: () => setRequested(true) }, t("wxVideoLoad")));
7904
+ }
7845
7905
  return /* @__PURE__ */ import_react7.default.createElement("div", { ref: element2, className: "ws-native-media" }, result.url ? result.url.startsWith("data:image/") ? /* @__PURE__ */ import_react7.default.createElement(ImageAttachment, { src: result.url, t, onError: failed }) : /* @__PURE__ */ import_react7.default.createElement(VoiceAttachment, { key: result.url, src: result.url, t, onError: failed }) : result.error ? kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react7.default.createElement(VoicePlaceholder, { state: "error", t, retry: () => setRetry((value) => value + 1) }) : /* @__PURE__ */ import_react7.default.createElement("span", { role: "status" }, t(kind === "image" ? "wxImageUnavailable" : "wxAudioUnavailable"), " ", /* @__PURE__ */ import_react7.default.createElement("button", { className: "ws-text-button", onClick: () => setRetry((value) => value + 1) }, t("wxMediaRetry"))) : kind === "voice" || kind === "audio" ? /* @__PURE__ */ import_react7.default.createElement(VoicePlaceholder, { state: "loading", t }) : /* @__PURE__ */ import_react7.default.createElement("span", { className: "ws-media-placeholder", role: "status" }, t("wxImageLoading")));
7846
7906
  }
7847
7907
  function ImageAttachment({ src, t, onError }) {
@@ -7899,7 +7959,8 @@ function SyncPanel({ client, view, workspaceId, t }) {
7899
7959
  void client.control("authorize", { requestId: consent.requestId, approved });
7900
7960
  };
7901
7961
  if (s?.runtime && s.runtime.phase !== "ready") return /* @__PURE__ */ import_react8.default.createElement(RuntimePanel, { runtime: s.runtime, t, retry: () => void client.control("runtime-retry"), disabled: !workspaceId });
7902
- const presentation = wechatPresentation(view), statusText = t(presentation.statusKey), message = view.error || s?.message;
7962
+ const presentation = wechatPresentation(view), statusText = t(presentation.statusKey);
7963
+ const message = view.error || (isWechatSyncActive(s, view.error) ? void 0 : s?.message);
7903
7964
  const detail = message && !/^WECHAT_/.test(message) ? message : presentation.hintKey ? t(presentation.hintKey) : void 0;
7904
7965
  return /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-sync-status" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-sync-line" }, /* @__PURE__ */ import_react8.default.createElement("span", { className: "ws-dot" }), /* @__PURE__ */ import_react8.default.createElement("span", { role: "status" }, statusText), s?.lastSyncedAt && /* @__PURE__ */ import_react8.default.createElement("time", null, new Date(s.lastSyncedAt).toLocaleTimeString()), canPauseWechat(s) && /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", onClick: () => void client.control("pause") }, t("wxPause")), c && !c.ready ? /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", disabled: !workspaceId, onClick: () => void client.refresh() }, t("wxCheckConnection")) : !canPauseWechat(s) && (s?.phase === "paused" || s?.phase === "error" || !!view.error || s?.phase === "disconnected" && !presentation.blocked) && /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-text-button", disabled: !workspaceId || !c?.ready || s?.running, onClick: () => void client.control("start", { automatic: true }) }, t("wxRetry"))), detail && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status" }, detail), !!s?.warnings?.length && /* @__PURE__ */ import_react8.default.createElement("details", null, /* @__PURE__ */ import_react8.default.createElement("summary", null, t("wxPartial")), s.warnings.map((warning, i) => /* @__PURE__ */ import_react8.default.createElement("p", { key: i }, warning))), consent && !answered.includes(key) && /* @__PURE__ */ import_react8.default.createElement("div", { className: "ws-sync-consent", role: "alert" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, t(consent.kind === "restart" ? "wxRestart" : "wxInitialize")), /* @__PURE__ */ import_react8.default.createElement("p", null, consent.message), /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-button ws-primary", onClick: () => authorize(true) }, t("wxApprove")), /* @__PURE__ */ import_react8.default.createElement("button", { className: "ws-button", onClick: () => authorize(false) }, t("wxCancel"))));
7905
7966
  }
@@ -9497,6 +9558,12 @@ var knowledgeEn = {
9497
9558
 
9498
9559
  // src/locales.ts
9499
9560
  var zh = {
9561
+ wxImageActualSize: "\u5B9E\u9645\u5927\u5C0F",
9562
+ wxVideoMessage: "\u5FAE\u4FE1\u89C6\u9891",
9563
+ wxVideoLoad: "\u52A0\u8F7D\u89C6\u9891",
9564
+ wxVideoLoading: "\u89C6\u9891\u52A0\u8F7D\u4E2D\u2026",
9565
+ wxVideoPending: "\u89C6\u9891\u5C1A\u672A\u540C\u6B65\u5230\u672C\u673A",
9566
+ wxVideoUnavailable: "\u89C6\u9891\u6682\u4E0D\u53EF\u64AD\u653E",
9500
9567
  intentLabel: "\u610F\u5411",
9501
9568
  intentSort: "\u4F1A\u8BDD\u6392\u5E8F",
9502
9569
  intentSortRecent: "\u6700\u65B0\u6D88\u606F",
@@ -9574,7 +9641,6 @@ var zh = {
9574
9641
  wxNoHistory: "\u6682\u65E0\u5DF2\u540C\u6B65\u7684\u5FAE\u4FE1\u4F1A\u8BDD",
9575
9642
  wxAwaitConsent: "\u5FAE\u4FE1\u540C\u6B65\u7B49\u5F85\u6388\u6743",
9576
9643
  wxAwaitConsentHint: "\u8BF7\u5148\u67E5\u770B\u5E76\u5904\u7406\u4E0A\u65B9\u7684\u6388\u6743\u8BF7\u6C42\u3002\u53D6\u6D88\u540E\u4E0D\u4F1A\u7EE7\u7EED\u521D\u59CB\u5316\u3002",
9577
- wxPausedHint: "\u540C\u6B65\u5DF2\u6682\u505C\u3002\u5DF2\u6709\u8BB0\u5F55\u4ECD\u53EF\u67E5\u770B\uFF0C\u9700\u8981\u7EE7\u7EED\u65F6\u70B9\u51FB\u201C\u91CD\u65B0\u540C\u6B65\u201D\u3002",
9578
9644
  wxOtherWorkspace: "\u5FAE\u4FE1\u6B63\u5728\u5176\u4ED6\u5DE5\u4F5C\u533A\u540C\u6B65",
9579
9645
  wxOtherWorkspaceHint: "\u8BF7\u5148\u5728\u539F\u5DE5\u4F5C\u533A\u6682\u505C\u540C\u6B65\uFF0C\u518D\u8FDE\u63A5\u5F53\u524D\u5DE5\u4F5C\u533A\u3002",
9580
9646
  wxCheckConnection: "\u91CD\u65B0\u68C0\u67E5",
@@ -9633,7 +9699,8 @@ var zh = {
9633
9699
  wxImageUnavailable: "\u56FE\u7247\u6682\u4E0D\u53EF\u7528",
9634
9700
  wxAudioUnavailable: "\u8BED\u97F3\u6682\u4E0D\u53EF\u7528",
9635
9701
  wxMediaRetry: "\u91CD\u8BD5",
9636
- wxLive: "\u5FAE\u4FE1\u5DF2\u8FDE\u63A5\uFF0C\u81EA\u52A8\u540C\u6B65\u4E2D",
9702
+ wxImageListPreview: "[\u56FE\u7247]",
9703
+ wxLive: "\u5FAE\u4FE1\u5DF2\u8FDE\u63A5\uFF0C\u81EA\u52A8\u540C\u6B65\u5DF2\u5F00\u542F",
9637
9704
  wxPaused: "\u5FAE\u4FE1\u540C\u6B65\u5DF2\u6682\u505C",
9638
9705
  wxSyncing: "\u6B63\u5728\u540C\u6B65\u5FAE\u4FE1",
9639
9706
  wxLoading: "\u6B63\u5728\u8FDE\u63A5\u5FAE\u4FE1",
@@ -9706,7 +9773,6 @@ var zh = {
9706
9773
  sync: "\u540C\u6B65\u5FAE\u4FE1",
9707
9774
  unavailable: "\u6B64\u529F\u80FD\u5C1A\u672A\u63A5\u5165",
9708
9775
  settings: "\u8FDE\u63A5\u8BBE\u7F6E",
9709
- back: "\u8FD4\u56DE\u4F1A\u8BDD",
9710
9776
  customers: "\u5BA2\u6237\u4F1A\u8BDD",
9711
9777
  search: "\u641C\u7D22\u5BA2\u6237\u3001\u673A\u578B\u6216\u5173\u952E\u8BCD",
9712
9778
  all: "\u5168\u90E8",
@@ -9779,6 +9845,12 @@ var zh = {
9779
9845
  contextHint: "\u57FA\u4E8E\u5F53\u524D\u793A\u4F8B\u804A\u5929\u6574\u7406"
9780
9846
  };
9781
9847
  var en = {
9848
+ wxImageActualSize: "Actual size",
9849
+ wxVideoMessage: "WeChat video",
9850
+ wxVideoLoad: "Load video",
9851
+ wxVideoLoading: "Loading video\u2026",
9852
+ wxVideoPending: "Video has not synced to this computer",
9853
+ wxVideoUnavailable: "Video unavailable",
9782
9854
  intentLabel: "Intent",
9783
9855
  intentSort: "Sort conversations",
9784
9856
  intentSortRecent: "Latest message",
@@ -9856,7 +9928,6 @@ var en = {
9856
9928
  wxNoHistory: "No synced WeChat conversations yet",
9857
9929
  wxAwaitConsent: "WeChat sync is awaiting consent",
9858
9930
  wxAwaitConsentHint: "Review the consent request above. Cancelling will stop initialization.",
9859
- wxPausedHint: "Sync is paused. Existing history remains available. Reconnect when ready.",
9860
9931
  wxOtherWorkspace: "WeChat is syncing in another workspace",
9861
9932
  wxOtherWorkspaceHint: "Pause sync in the original workspace before connecting this one.",
9862
9933
  wxCheckConnection: "Check again",
@@ -9915,7 +9986,8 @@ var en = {
9915
9986
  wxImageUnavailable: "Image unavailable",
9916
9987
  wxAudioUnavailable: "Voice message unavailable",
9917
9988
  wxMediaRetry: "Retry",
9918
- wxLive: "WeChat connected \xB7 syncing automatically",
9989
+ wxImageListPreview: "[image]",
9990
+ wxLive: "WeChat connected \xB7 Auto-sync enabled",
9919
9991
  wxPaused: "WeChat sync paused",
9920
9992
  wxSyncing: "Syncing WeChat",
9921
9993
  wxLoading: "Connecting to WeChat",
@@ -9988,7 +10060,6 @@ var en = {
9988
10060
  sync: "Sync WeChat",
9989
10061
  unavailable: "This integration is not connected yet",
9990
10062
  settings: "Connections",
9991
- back: "Back to chat",
9992
10063
  customers: "Conversations",
9993
10064
  search: "Search customers, devices or keywords",
9994
10065
  all: "All",
@@ -10287,6 +10358,10 @@ function currentCompanyFacts(contact, now = Date.now()) {
10287
10358
  }
10288
10359
  function buildTurnPacket(contact, latest, knowledge) {
10289
10360
  const sources = /* @__PURE__ */ Object.create(null), current = contact.wechat ? contact.messages.filter((m) => m.direction === "in").at(-1)?.text ?? "" : latest.trim() || contact.preview;
10361
+ const lastInbound = contact.messages.map((m) => m.direction).lastIndexOf("in");
10362
+ const throughInbound = lastInbound >= 0 ? contact.messages.slice(0, lastInbound + 1) : [];
10363
+ const lastOutbound = throughInbound.map((m) => m.direction).lastIndexOf("out");
10364
+ const currentTurn = contact.wechat ? throughInbound.slice(lastOutbound + 1).slice(-8).map((m) => m.text) : [current].filter(Boolean);
10290
10365
  if (current) sources.C0 = { text: current, authority: "customer" };
10291
10366
  contact.messages.filter((m) => m.direction === "in").forEach((m, i) => sources["C" + (i + 1)] = { text: m.text, authority: "customer" });
10292
10367
  contact.messages.filter((m) => m.direction === "out").forEach((m, i) => sources["S" + (i + 1)] = { text: m.text, authority: "historical_sales" });
@@ -10354,6 +10429,7 @@ function buildTurnPacket(contact, latest, knowledge) {
10354
10429
  product: contact.product,
10355
10430
  participant_roles: { our_sales: "\u4E07\u673A\u9500\u552E\uFF0C\u5356\u8F6F\u4EF6/\u63A8\u5E7F\u5E73\u53F0", merchant: "\u5F53\u524D\u5546\u5BB6", merchant_counterparty: "\u5546\u5BB6\u81EA\u5DF1\u7684\u4E70\u5BB6\u6216\u540C\u884C\uFF1B\u5176\u6210\u4EA4/\u4EA4\u8D27/\u6536\u6B3E\u4E0D\u662F\u5546\u5BB6\u8D2D\u4E70\u4E07\u673A\u8F6F\u4EF6" },
10356
10431
  latest_customer_message: current,
10432
+ current_customer_turn: currentTurn,
10357
10433
  sources,
10358
10434
  selection_rule: "\u6570\u91CF\u610F\u613F\u4E0D\u7B49\u4E8E\u5BF9\u8C61\u9009\u62E9\u3002\u6279\u6B21\u5B58\u5728\u4E0D\u540C\u673A\u51B5\u3001\u5F52\u5C5E\u6216\u8303\u56F4\u65F6\uFF0C\u5BA2\u6237\u53EA\u8BF4\u8981\u5176\u4E2D\u51E0\u53F0/\u51E0\u9879\uFF0C\u5C1A\u672A\u6307\u660E\u9009\u4E2D\u5BF9\u8C61\uFF1B\u5148\u786E\u8BA4\u54EA\u7EC4\u3001\u54EA\u51E0\u9879\uFF0C\u6216\u6309\u4E0D\u540C\u9009\u62E9\u5206\u60C5\u51B5\u8BF4\u660E\uFF0C\u4E0D\u4ECE\u6570\u91CF\u81EA\u52A8\u9009\u51FA\u4E00\u7EC4\u3002\u540E\u7EED\u4EF7\u683C\u3001\u8D23\u4EFB\u548C\u5269\u4F59\u5BF9\u8C61\u53EA\u7ED1\u5B9A\u5DF2\u660E\u786E\u7684\u9009\u62E9\u3002\u5BA2\u6237\u5DF2\u660E\u786E\u9009\u5B9A\u65F6\u4FDD\u7559\uFF0C\u4E0D\u518D\u91CD\u95EE\u3002",
10359
10435
  current_company_facts: company.facts.map((f, i) => ({ source_id: "V" + (i + 1), ...f })),
@@ -10828,36 +10904,52 @@ function selectedMaterialIds(wechat, materials) {
10828
10904
  // src/turn-plan.ts
10829
10905
  var planFields = ["goal", "customer_decisions", "need_to_answer", "not_needed_now", "next_action", "action", "progress"];
10830
10906
  function buildTurnPlanCorrection(error) {
10831
- return "\n\u4E0A\u6761\u7B56\u7565\u672A\u901A\u8FC7\uFF1A" + (error instanceof Error ? error.message : "\u7ED3\u6784\u4E0D\u5B8C\u6574") + "\u3002\u4FEE\u6B63\u540E\u8FD4\u56DE\u5B8C\u6574JSON\uFF0C" + planFields.length + "\u4E2A\u5B57\u6BB5\u5FC5\u987B\u9F50\u5168\uFF1A" + planFields.join("\u3001") + "\u3002\u4FDD\u7559\u5176\u4ED6\u6B63\u786E\u5185\u5BB9\uFF1B\u6CA1\u6709\u5BA2\u6237\u51B3\u5B9A\u65F6customer_decisions\u4E5F\u5FC5\u987B\u7ED9\u7A7A\u6570\u7EC4\uFF0C\u4E0D\u7701\u7565\u4EFB\u4F55\u5B57\u6BB5\u3002\u53EA\u8F93\u51FA\u4E00\u4E2A\u5408\u6CD5JSON\u5BF9\u8C61\uFF1B\u6570\u7EC4\u6BCF\u4E2A\u5143\u7D20\u90FD\u662F\u5B8C\u6574\u53CC\u5F15\u53F7\u5B57\u7B26\u4E32\uFF0C\u9664\u4E86\u9017\u53F7\u4E0D\u5939\u5E26\u6CE8\u91CA\u6216\u591A\u4F59\u7B26\u53F7\u3002";
10907
+ return "\n\u4E0A\u6761\u7B56\u7565\u672A\u901A\u8FC7\uFF1A" + (error instanceof Error ? error.message : "\u7ED3\u6784\u4E0D\u5B8C\u6574") + "\u3002\u4FEE\u6B63\u540E\u8FD4\u56DE\u5B8C\u6574JSON\uFF0C" + planFields.length + "\u4E2A\u5B57\u6BB5\u5FC5\u987B\u9F50\u5168\uFF1A" + planFields.join("\u3001") + "\u3002\u4FDD\u7559\u5176\u4ED6\u6B63\u786E\u5185\u5BB9\uFF1B\u6CA1\u6709\u5BA2\u6237\u51B3\u5B9A\u65F6customer_decisions\u4E5F\u5FC5\u987B\u7ED9\u7A7A\u6570\u7EC4\uFF0C\u4E0D\u7701\u7565\u4EFB\u4F55\u9876\u5C42\u5B57\u6BB5\u3002progress.decisions\u6BCF\u9879\u5FC5\u987B\u542Btopic\u3001source_id\u3001meaning\uFF0C\u540C\u4E00\u4E3B\u9898\u53EA\u5199\u4E00\u9879\uFF0C\u6700\u65B0\u4E00\u53E5\u53EF\u76F4\u63A5\u7528C0\u3002\u4E0D\u80FD\u786E\u8BA4\u4E3B\u9898\u65F6\uFF0Cprogress.decisions\u586B[]\u3002\u53EA\u8F93\u51FA\u4E00\u4E2A\u5408\u6CD5JSON\u5BF9\u8C61\uFF1B\u6570\u7EC4\u6BCF\u4E2A\u5143\u7D20\u90FD\u662F\u5B8C\u6574\u53CC\u5F15\u53F7\u5B57\u7B26\u4E32\uFF0C\u9664\u4E86\u9017\u53F7\u4E0D\u5939\u5E26\u6CE8\u91CA\u6216\u591A\u4F59\u7B26\u53F7\u3002";
10832
10908
  }
10833
10909
  function decisionSources(contact, latest) {
10834
10910
  return Object.fromEntries([...Object.entries(customerEvidenceSources(contact)).filter(([, v]) => JSON.parse(v).speaker === "customer"), ["C0", latest.trim() || contact.preview], ...contact.messages.filter((m) => m.direction === "in").map((m, i) => ["C" + (i + 1), m.text]), ...contact.facts.map((f, i) => ["F" + (i + 1), f.value])]);
10835
10911
  }
10836
- function parseTurnPlan(text4, contact, latest, packet) {
10912
+ function bindTurnProgress(progress, packet) {
10913
+ const currentAliases = packet.history.filter((message) => message.speaker === "customer").length;
10914
+ const latestAlias = "C" + currentAliases;
10915
+ if (!progress || typeof progress !== "object" || !("decisions" in progress) || !Array.isArray(progress.decisions) || progress.decisions.length > 10) return bindProgress(progress, packet);
10916
+ const equivalent = packet.sources[latestAlias]?.authority === "customer" && packet.sources[latestAlias]?.text === packet.latest_customer_message;
10917
+ const groups = /* @__PURE__ */ new Map();
10918
+ for (const decision of progress.decisions) {
10919
+ const item = equivalent && decision?.source_id === latestAlias ? { ...decision, source_id: "C0" } : decision;
10920
+ const checked = bindProgress({ ...progress, decisions: [item] }, packet).decisions[0];
10921
+ const group = groups.get(checked.topic) ?? [];
10922
+ group.push(item);
10923
+ groups.set(checked.topic, group);
10924
+ }
10925
+ const decisions = [...groups.values()].flatMap((group) => {
10926
+ const current = group.filter((item) => item.source_id === "C0");
10927
+ return group.length > 1 && current.length === 1 && group.every((item) => packet.sources[item.source_id]?.authority === "customer") ? current : group;
10928
+ });
10929
+ return bindProgress({ ...progress, decisions }, packet);
10930
+ }
10931
+ function parseTurnPlan(text4, contact, latest, packet, recoverProgress = false) {
10837
10932
  if (packet) {
10838
10933
  const parsed = JSON.parse(text4.trim().replace(/^```(?:json)?\s*\n([\s\S]*?)\n```$/, "$1"));
10839
10934
  const { material_need, ...wire } = parsed ?? {};
10840
10935
  if (!wire || Object.keys(wire).sort().join(",") !== [...planFields].sort().join(",") || !salesActions.includes(wire.action)) throw Error("\u7B56\u7565\u5FC5\u987B\u9009\u62E9\u5141\u8BB8\u7684action\u5E76\u66F4\u65B0\u5E26\u6765\u6E90\u7684progress\u3002");
10841
10936
  const { action, progress, ...base } = wire;
10842
- let projected = progress;
10843
- if (progress && Array.isArray(progress.decisions) && progress.decisions.length <= 10) {
10844
- const groups = /* @__PURE__ */ new Map();
10845
- for (const decision of progress.decisions) {
10846
- bindProgress({ ...progress, decisions: [decision] }, packet);
10847
- const group = groups.get(decision.topic) ?? [];
10848
- group.push(decision);
10849
- groups.set(decision.topic, group);
10850
- }
10851
- projected = { ...progress, decisions: [...groups.values()].flatMap((group) => group.length > 1 && group.filter((d) => d.source_id === "C0").length === 1 && group.every((d) => packet.sources[d.source_id]?.authority === "customer") ? group.filter((d) => d.source_id === "C0") : group) };
10852
- }
10853
- let bound = bindProgress(projected, packet);
10937
+ const sources = Object.fromEntries(Object.entries(packet.sources).filter(([, s]) => s.authority === "customer" || s.authority === "deal").map(([id, s]) => [id, s.text]));
10938
+ const basePlan = parseBasePlan(JSON.stringify(base), sources);
10939
+ let bound, reused = false;
10940
+ try {
10941
+ bound = bindTurnProgress(progress, packet);
10942
+ } catch (error) {
10943
+ if (!recoverProgress || !contact.wechat || !packet.sources.C0?.text?.trim()) throw error;
10944
+ bound = packet.previous_progress ?? { stage: "exploring", source_id: "C0", quote: packet.sources.C0.text, decisions: [], artifacts: [] };
10945
+ reused = true;
10946
+ }
10854
10947
  const stop = isExplicitStop(packet.latest_customer_message);
10855
10948
  if (stop) bound = { ...bound, stage: "declined", source_id: "C0", quote: packet.latest_customer_message };
10856
- let safeAction = stop ? "stop" : action === "stop" ? "answer" : action === "prepare_confirmation" && bound.stage !== "confirming" ? "provide_material" : action;
10949
+ let safeAction = stop ? "stop" : reused || action === "stop" ? "answer" : action === "prepare_confirmation" && bound.stage !== "confirming" ? "provide_material" : action;
10857
10950
  if (safeAction === "prepare_confirmation" && bound.artifacts.some((a) => a.kind === "confirmation" && a.status !== "requested") || safeAction === "provide_material" && bound.artifacts.length > 0 && bound.artifacts.every((a) => a.status !== "requested")) safeAction = "answer";
10858
- const sources = Object.fromEntries(Object.entries(packet.sources).filter(([, s]) => s.authority === "customer" || s.authority === "deal").map(([id, s]) => [id, s.text]));
10859
10951
  const material = safeAction === "stop" ? void 0 : parseMaterialNeed(material_need, packet);
10860
- return { ...parseBasePlan(JSON.stringify(base), sources), action: safeAction, progress: bound, ...material ? { material_need: material } : {} };
10952
+ return { ...basePlan, action: safeAction, progress: bound, ...material ? { material_need: material } : {} };
10861
10953
  }
10862
10954
  return parseBasePlan(text4, decisionSources(contact, latest));
10863
10955
  }
@@ -10877,7 +10969,7 @@ function parseBasePlan(text4, sources) {
10877
10969
  return { ...v, customer_decisions: decisions };
10878
10970
  }
10879
10971
  function buildTurnPlanPrompt(contact, latest, contextId, packet = buildTurnPacket(contact, latest)) {
10880
- return "/wanji-sales-assistant\nhost_checks=true\u3002\u672C\u8F6E\u5148\u89C4\u5212\uFF0C\u4E0D\u5199\u5FAE\u4FE1\u3001\u4E0D\u8C03\u7528\u5DE5\u5177\u3002\u6240\u6709\u9636\u6BB5\u5171\u7528turn_packet\uFF1B\u53EA\u6839\u636E\u5F53\u524D\u8BC1\u636E\u66F4\u65B0\u8FDB\u5C55\uFF0C\u4E0D\u6279\u51C6\u516C\u53F8\u6761\u4EF6\u6216\u6267\u884C\u52A8\u4F5C\u3002\n" + intentGuidance(contact.intent) + wechatVoice + "\n" + operationProofRules + "\n\u672C\u8F6E\u53EA\u662F\u5410\u69FD\u3001\u5F00\u73A9\u7B11\u6216\u7B80\u5355\u786E\u8BA4\u4E14\u6CA1\u6709\u5B9E\u9645\u8BF7\u6C42\u65F6\uFF0Cneed_to_answer\u53EF\u4E3A\u7A7A\uFF0Caction\u9009answer\u6216\u6709\u7EA6\u5B9A\u65F6wait\uFF1B\u4FDD\u7559\u91C7\u8D2D\u9636\u6BB5\uFF0C\u4E0D\u5347\u7EA7\u6210\u552E\u540E\u6838\u67E5/\u91C7\u8D2D\u3002\u4E0D\u56E0\u4E3A\u67D0\u9879\u89C4\u5219\u5C1A\u672A\u77E5\u5C31\u51ED\u7A7A\u5B89\u6392\u53BB\u95EE\uFF0C\u4E0D\u628A\u5BD2\u6684\u53D8\u6210\u65B0\u4EFB\u52A1\u3002\n\u5148\u7EE7\u627Fprevious_progress\uFF0C\u518D\u4EE5\u65B0\u7684\u5BA2\u6237\u539F\u8BDD\u66F4\u6B63\u5BF9\u5E94\u4E3B\u9898\uFF1B\u5BA2\u6237\u3001\u516C\u53F8\u548C\u65E7\u9500\u552E\u8BDD\u4E0D\u53EF\u4E92\u76F8\u66FF\u4EE3\u3002\u5DF2\u6709\u62A5\u4EF7\u8303\u56F4\u4FDD\u7559\uFF0C\u660E\u786E\u53EA\u770B\u4E0D\u4E70\u4E0D\u6539\u6210\u91C7\u8D2D\u3002\u6750\u6599\u7684requested/received/reviewed\u53EA\u5F15\u7528\u5BA2\u6237\u8BC1\u636E\uFF1B\u201C\u8FD9\u4EFD\u6211\u8F6C\u7ED9\u5408\u4F19\u4EBA/\u5DF2\u7167\u7740\u505A/\u770B\u5B8C\u4E86\u201D\u4E5F\u80FD\u652F\u6301\u6536\u5230\u6216\u770B\u8FC7\uFF0C\u4E0D\u5FC5\u5BA2\u6237\u9010\u5B57\u8BF4\u201C\u6536\u5230\u201D\uFF1B\u5F15\u7528\u5B9E\u9645\u5BA2\u6237\u539F\u8BDD\uFF0C\u4E0D\u4EE5\u9500\u552E\u7684\u51C6\u5907\u8BA1\u5212\u63A8\u65AD\u3002\u5BA2\u6237\u8981\u6C42\u91CD\u505A\u6216\u66F4\u65B0\u4E00\u4EFD\u65F6\u624D\u91CD\u65B0requested\u3002\u9500\u552E\u8BF4\u51C6\u5907\u53D1\u4E0D\u80FD\u8BC1\u660E\u5BA2\u6237\u6536\u5230\u4E86\uFF0C\u6CA1\u56DE\u6267\u4E5F\u4E0D\u8BC1\u660E\u8FD8\u6CA1\u505A\u3002\u65E0\u6CD5\u5224\u65AD\u7684\u6750\u6599\u7559\u7A7A\uFF0C\u4E0D\u8865\u9020\u72B6\u6001\u3002\n\u53EA\u9009\u62E9\u4E00\u4E2Aaction\uFF1Aanswer\u76F4\u63A5\u89E3\u7B54\uFF1Bprovide_material\u63D0\u4F9B\u6240\u9700\u5185\u5BB9\uFF1Bprepare_confirmation\u51C6\u5907\u5DF2\u5B9A\u8303\u56F4\u7684\u786E\u8BA4\uFF1Bclarify\u53EA\u95EE\u5FC5\u8981\u7F3A\u53E3\uFF1Bverify_company\u6838\u67D0\u9879\u516C\u53F8\u6761\u4EF6\uFF1Bcoordinate_demo\u534F\u8C03\u5DF2\u5141\u8BB8\u7684\u6F14\u793A\uFF1Bwait\u7B49\u5F85\u5BA2\u6237\u660E\u786E\u7EA6\u5B9A\u7684\u53CD\u9988\uFF1Bstop\u4EC5\u7528\u4E8E\u660E\u786E\u505C\u8054\u4E14\u65E0\u65B0\u95EE\u9898\u3002\u52A8\u4F5C\u4E0D\u4EE3\u8868\u5DF2\u6267\u884C\u3002\u5BA2\u6237\u51C6\u5907\u786E\u8BA4\u65F6\u4E0D\u8981\u9000\u56DE\u6F14\u793A\uFF0C\u6750\u6599\u5DF2\u6536\u5230\u540E\u4E0D\u8981\u91CD\u505A\uFF0C\u672A\u77E5\u95EE\u9898\u4E0D\u6263\u4F4F\u5DF2\u77E5\u6750\u6599\u3002\nprevious_progress.pending\u662F\u5BBF\u4E3B\u8BB0\u5F55\u7684\u5916\u90E8\u5F85\u6838\u95EE\u9898\uFF0C\u4E0D\u662F\u6279\u51C6\u6216\u5DF2\u6267\u884C\u3002\u516C\u53F8\u4F9D\u636E\u672A\u53D8\u65F6\uFF0C\u4E0D\u628A\u5DF2\u7ECF\u8BF4\u8FC7\u53BB\u6838\u7684\u540C\u4E00\u4EF6\u4E8B\u518D\u5F53\u65B0\u7684\u63A8\u8FDB\uFF1B\u5BA2\u6237\u53EA\u8868\u793A\u7B49\u5F85\u65F6\u9009wait\uFF0C\u6709\u65B0\u95EE\u9898\u5148\u7B54\u65B0\u95EE\u9898\u3002response_contract\u89C4\u5B9A\u8FD9\u8F6E\u8981\u5B9E\u9645\u7ED9\u51FA\u7684\u5185\u5BB9\u3002pending\u7531\u5BBF\u4E3B\u7EF4\u62A4\uFF0C\u4E0D\u6284\u8FDB\u8F93\u51FAprogress\u3002\ngoal\u672C\u8F6E\u76EE\u6807\uFF1Bneed_to_answer\u7528\u7B80\u77ED\u6761\u76EE\u5217\u5F53\u524D\u95EE\u9898\uFF0C\u6BCF\u9879\u53EA\u5199\u4E00\u4E2A\u95EE\u9898\uFF0C\u4E0D\u66FF\u4F5C\u8005\u5199\u7B54\u6848\u548C\u80CC\u666F\uFF1Bnot_needed_now\u5199\u4E0D\u5E94\u91CD\u8BB2\u7684\u5185\u5BB9\uFF1Bnext_action\u662F\u5185\u90E8\u5B57\u6BB5\uFF0C\u76F4\u63A5\u7B54\u6E05\u5C31\u5199\u201C\u56DE\u7B54\u5F53\u524D\u95EE\u9898\u201D\uFF0C\u65E0\u9700\u989D\u5916\u63A8\u8FDB\u3002customer_decisions\u9009\u6700\u591A3\u9879\u73B0\u6709C/F/P\u6765\u6E90\uFF0C\u4E0D\u9009\u65E7\u9500\u552ES\uFF1Bmeaning\u662F\u63A8\u65AD\uFF0C\u4E0D\u80FD\u5347\u7EA7\u4E3A\u6279\u51C6\u3002\nneed_to_answer\u5217\u5F85\u7B54\u95EE\u9898\uFF0C\u4E0D\u8981\u9884\u5148\u5199\u5165\u672A\u7ECF\u6765\u6E90\u652F\u6301\u7684\u7B54\u6848\u3002\u4F8B\u5982\u5BA2\u6237\u95EE\u4F1A\u4E0D\u4F1A\u81EA\u52A8\u6263\u6B3E\uFF0C\u53EA\u5217\u201C\u5F53\u524D\u6536\u8D39\u4E0E\u6388\u6743\u6263\u6B3E\u89C4\u5219\u80FD\u5426\u786E\u8BA4\uFF0C\u7F3A\u4EC0\u4E48\u4F9D\u636E\u201D\uFF0C\u4E0D\u80FD\u51ED\u5E38\u8BC6\u5148\u5199\u201C\u5FC5\u987B\u56DE\u7B54\u4E0D\u4F1A\u6263\u6B3E\u201D\uFF1B\u95EE\u8BB0\u5F55\u4FDD\u7559\u3001\u5E76\u53D1\u8986\u76D6\u3001\u8DE8\u6708\u5229\u6DA6\u65F6\u540C\u7406\u3002\u5DF2\u77E5\u7684\u6570\u5B57\u548C\u516C\u53F8\u6761\u4EF6\u53EF\u4FDD\u7559\u5176\u6765\u6E90\u8303\u56F4\uFF0C\u672A\u77E5\u5C31\u5217\u5F85\u6838\u9879\uFF0C\u4E0D\u8981\u6C42\u5199\u4F5C\u8005\u53D1\u660E\u627F\u8BFA\u3002\u5408\u7406\u4EBA\u5DE5\u53EA\u8BFB\u6838\u5BF9\u5EFA\u8BAE\u4E0E\u8F6F\u4EF6\u529F\u80FD\u5206\u5F00\u3002\n\u590D\u5408\u95EE\u9898\u9010\u9879\u5217\u51FA\uFF0C\u4F8B\u5982\u5165\u53E3\u3001\u64CD\u4F5C\u6B65\u9AA4\u3001\u600E\u6837\u786E\u8BA4\u7ED3\u679C\u3001\u6559\u5B66\u7D20\u6750\u3002\u8D44\u6599\u652F\u6301\u5176\u4E2D\u51E0\u9879\u5C31\u5B89\u6392\u5148\u56DE\u7B54\u8FD9\u51E0\u9879\uFF1B\u7F3A\u5177\u4F53\u7248\u672C\u65F6\u5C06\u9002\u7528\u6761\u4EF6\u653E\u5728\u8BE5\u6B65\u9AA4\u524D\uFF0C\u672A\u77E5\u5B57\u6BB5\u6216\u6743\u9650\u5355\u72EC\u5F85\u6838\u3002\nprogress\u662F\u5BA2\u6237\u4FA7\u8FDB\u5C55\u6295\u5F71\uFF0C\u4E0D\u662F\u516C\u53F8\u6388\u6743\u3002\u6240\u6709progress\u6765\u6E90\u53EA\u9009C/F/P\u4E2D\u7684\u5BA2\u6237\u8BC1\u636E\uFF0CQ/V/O\u516C\u53F8\u6761\u4EF6\u72EC\u7ACB\u4FDD\u7559\uFF0C\u4E0D\u80FD\u590D\u5236\u5230progress\uFF1Bscope/budget\u53EA\u8BB0\u5F55\u5BA2\u6237\u9009\u62E9\u3002stage\u53EA\u80FDexploring/evaluating/confirming/paused/declined\u5E76\u9644source_id\u3002decisions\u6BCF\u4E3B\u9898\u4FDD\u7559\u5F53\u524D\u7ED3\u8BBA\uFF0Ctopic\u53EA\u80FDproduct/purchase/scope/privacy/materials/timing/budget/role/followup\uFF1B\u6BCF\u9879\u542Btopic\u3001source_id\u3001meaning\u3002artifacts\u6BCF\u7C7B\u6700\u591A\u4E00\u9879\uFF0Ckind\u53EA\u80FDsample/intro/confirmation\uFF1Bstatus\u53EA\u80FDrequested/received/reviewed\uFF0Csource_id\u5FC5\u987B\u662F\u5BA2\u6237\u8BC1\u636E\u3002\u6CA1\u6709\u8BC1\u636E\u5C31\u7559\u7A7A\u3002\u5DF2\u6709\u7ED3\u8BBA\u82E5\u88AB\u65B0\u6D88\u606F\u7EA0\u6B63\uFF0C\u4F7F\u7528\u65B0\u6765\u6E90\u66FF\u6362\uFF1B\u4ECD\u6709\u6548\u7684\u4FDD\u7559\u3002\n" + (packet.knowledge.materials_available ? '\u72EC\u7ACB\u7D20\u6750\u5E93\u5DF2\u914D\u7F6E\u3002\u5F53\u524D\u64CD\u4F5C\u95EE\u9898\u53EF\u7528\u89C6\u9891/\u6587\u6863\u8F85\u52A9\uFF0C\u6216\u5DF2\u52A0\u8F7D\u7535\u8BDD\u4E2D\u7684\u5BA2\u6237\u660E\u786E\u63D0\u51FA\u76F8\u5173\u9700\u6C42\u4E14\u540E\u7EED\u672A\u64A4\u56DE\u65F6\uFF0C\u53EF\u53E6\u5916\u8FD4\u56DEmaterial_need={"query":"\u53EA\u542B\u4EA7\u54C1\u4E0E\u64CD\u4F5C\u4E3B\u9898\u7684\u81EA\u7136\u8BED\u8A00\u67E5\u8BE2","kind":"video\u6216document\u6216image\u6216any","edition":"\u95E8\u5E97\u7248\u6216\u4E13\u4E1A\u7248\u6216\u6807\u51C6\u7248\u6216unknown","source_id":"\u5B9E\u9645\u5BA2\u6237\u6765\u6E90\u7F16\u53F7"}\uFF1B\u5176\u4ED6\u65F6\u5019\u4E0D\u8FD4\u56DE\u6B64\u5B57\u6BB5\u3002\u7535\u8BDD\u91CC\u7684\u9500\u552E\u4ECB\u7ECD\u4E0D\u7B97\u5BA2\u6237\u9700\u6C42\u3002\u5148\u770B\u6700\u65B0\u5FAE\u4FE1\u7684\u62D2\u53D1\u3001\u6536\u5230/\u4E0D\u91CD\u53D1\u3001\u65B0\u95EE\u9898\u4E0E\u7248\u672C\u7EA0\u6B63\uFF1B\u4E0D\u8981\u7528\u65E7\u7535\u8BDD\u9700\u6C42\u8986\u76D6\u3002\u6CA1\u6709\u786E\u5B9A\u4EA7\u54C1\u7248\u672C\u65F6\u586Bunknown\uFF0C\u4F01\u4E1A\u7248\u4E0D\u81EA\u52A8\u7B49\u4E8E\u4E13\u4E1A\u7248\u3002\u4E0D\u8981\u628A\u5BA2\u6237\u624B\u673A\u53F7\u3001\u59D3\u540D\u3001\u8D26\u53F7\u6216\u5355\u636E\u53F7\u585E\u8FDB\u67E5\u8BE2\u3002\u4E0D\u56E0\u666E\u901A\u5BD2\u6684\u5C31\u627E\u7D20\u6750\uFF1B\u7D20\u6750\u4E0D\u4EE3\u8868\u91C7\u8D2D\u6216\u5F00\u901A\u3002\n' : "") + (packet.knowledge.materials_available ? "\u5BBF\u4E3B\u7684material_request_constraints\u53EA\u7EA6\u675F\u5BA2\u6237\u5DF2\u660E\u786E\u7684\u7D20\u6750\u5F62\u6001\u548C\u7248\u672C\u3002required=true\u65F6\uFF0C\u672C\u6B21\u5FC5\u987B\u8F93\u51FAmaterial_need\u4E14kind\u4E25\u683C\u53D6\u7EA6\u675Fkind\uFF0C\u4E0D\u53EF\u7701\u7565\u3001null\u6216\u6539\u6210any\uFF1Bquery\u7531\u4F60\u63D0\u70BC\u672C\u8F6E\u64CD\u4F5C\u4E3B\u9898\uFF0C\u4E0D\u8981\u9020\u9644\u4EF6\uFF0C\u4E0D\u628A\u6587\u6863\u6539\u6210\u89C6\u9891\u3002required=false\u4E0D\u6392\u9664\u7535\u8BDD\u5BA2\u6237\u5DF2\u6709\u9700\u6C42\uFF0C\u6309\u6765\u6E90\u5224\u65AD\u3002\n" : "") + 'material_need.kind\u8868\u793A\u6587\u4EF6\u5F62\u6001\uFF0Cprogress.artifacts.kind\u8868\u793A\u6750\u6599\u7528\u9014\uFF0C\u4E24\u8005\u4E0D\u53EF\u6DF7\u7528\u3002\u6587\u6863\u3001\u89C6\u9891\u3001\u56FE\u7247\u64CD\u4F5C\u8D44\u6599\u5728artifacts.kind\u7EDF\u4E00\u7528intro\uFF0C\u4E0D\u5199document/video/image\uFF1B\u8BF7\u6C42\u3001\u6536\u5230\u3001\u770B\u8FC7\u4ECD\u53EA\u80FD\u6309\u5BA2\u6237\u539F\u8BDD\u5206\u522B\u8BB0\u5F55\u3002\n\u53EA\u8FD4\u56DEJSON\uFF1A{"goal":"...","customer_decisions":[{"source_id":"C0","meaning":"..."}],"need_to_answer":["..."],"not_needed_now":["..."],"next_action":"...","action":"answer","progress":{"stage":"evaluating","source_id":"C0","decisions":[],"artifacts":[]}' + (packet.knowledge.materials_available ? ',"material_need":null' : "") + "}\u3002\u4E0D\u6284quote\uFF0C\u7A0B\u5E8F\u7ED1\u5B9A\u539F\u6587\u3002" + (packet.knowledge.materials_available ? "\u5B58\u5728\u7D20\u6750\u9700\u6C42\u65F6\u5C06material_need\u66FF\u6362\u4E3A\u542Bquery\u3001kind\u3001edition\u3001source_id\u7684\u5BF9\u8C61\uFF0C\u4E0D\u80FD\u53EA\u5199\u5728next_action\u4E2D\u3002" : "") + "\nDATA\n" + JSON.stringify({ turn_packet: packet, contextId, ...packet.knowledge.materials_available ? { material_request_constraints: materialRequestConstraints(packet) } : {} });
10972
+ return "/wanji-sales-assistant\nhost_checks=true\u3002\u672C\u8F6E\u5148\u89C4\u5212\uFF0C\u4E0D\u5199\u5FAE\u4FE1\u3001\u4E0D\u8C03\u7528\u5DE5\u5177\u3002\u8FDE\u7EED\u5BA2\u6237\u6D88\u606F\u770Bcurrent_customer_turn\uFF0C\u672B\u53E5\u662F\u611F\u60F3\u6216\u8865\u5145\u65F6\uFF0C\u4ECD\u56DE\u5E94\u8FD9\u8F6E\u524D\u9762\u63D0\u51FA\u7684\u5177\u4F53\u95EE\u9898\u3002\u6240\u6709\u9636\u6BB5\u5171\u7528turn_packet\uFF1B\u53EA\u6839\u636E\u5F53\u524D\u8BC1\u636E\u66F4\u65B0\u8FDB\u5C55\uFF0C\u4E0D\u6279\u51C6\u516C\u53F8\u6761\u4EF6\u6216\u6267\u884C\u52A8\u4F5C\u3002\n" + intentGuidance(contact.intent) + wechatVoice + "\n" + operationProofRules + "\n\u672C\u8F6E\u53EA\u662F\u5410\u69FD\u3001\u5F00\u73A9\u7B11\u6216\u7B80\u5355\u786E\u8BA4\u4E14\u6CA1\u6709\u5B9E\u9645\u8BF7\u6C42\u65F6\uFF0Cneed_to_answer\u53EF\u4E3A\u7A7A\uFF0Caction\u9009answer\u6216\u6709\u7EA6\u5B9A\u65F6wait\uFF1B\u4FDD\u7559\u91C7\u8D2D\u9636\u6BB5\uFF0C\u4E0D\u5347\u7EA7\u6210\u552E\u540E\u6838\u67E5/\u91C7\u8D2D\u3002\u4E0D\u56E0\u4E3A\u67D0\u9879\u89C4\u5219\u5C1A\u672A\u77E5\u5C31\u51ED\u7A7A\u5B89\u6392\u53BB\u95EE\uFF0C\u4E0D\u628A\u5BD2\u6684\u53D8\u6210\u65B0\u4EFB\u52A1\u3002\n\u5148\u7EE7\u627Fprevious_progress\uFF0C\u518D\u4EE5\u65B0\u7684\u5BA2\u6237\u539F\u8BDD\u66F4\u6B63\u5BF9\u5E94\u4E3B\u9898\uFF1B\u5BA2\u6237\u3001\u516C\u53F8\u548C\u65E7\u9500\u552E\u8BDD\u4E0D\u53EF\u4E92\u76F8\u66FF\u4EE3\u3002\u5DF2\u6709\u62A5\u4EF7\u8303\u56F4\u4FDD\u7559\uFF0C\u660E\u786E\u53EA\u770B\u4E0D\u4E70\u4E0D\u6539\u6210\u91C7\u8D2D\u3002\u6750\u6599\u7684requested/received/reviewed\u53EA\u5F15\u7528\u5BA2\u6237\u8BC1\u636E\uFF1B\u201C\u8FD9\u4EFD\u6211\u8F6C\u7ED9\u5408\u4F19\u4EBA/\u5DF2\u7167\u7740\u505A/\u770B\u5B8C\u4E86\u201D\u4E5F\u80FD\u652F\u6301\u6536\u5230\u6216\u770B\u8FC7\uFF0C\u4E0D\u5FC5\u5BA2\u6237\u9010\u5B57\u8BF4\u201C\u6536\u5230\u201D\uFF1B\u5F15\u7528\u5B9E\u9645\u5BA2\u6237\u539F\u8BDD\uFF0C\u4E0D\u4EE5\u9500\u552E\u7684\u51C6\u5907\u8BA1\u5212\u63A8\u65AD\u3002\u5BA2\u6237\u8981\u6C42\u91CD\u505A\u6216\u66F4\u65B0\u4E00\u4EFD\u65F6\u624D\u91CD\u65B0requested\u3002\u9500\u552E\u8BF4\u51C6\u5907\u53D1\u4E0D\u80FD\u8BC1\u660E\u5BA2\u6237\u6536\u5230\u4E86\uFF0C\u6CA1\u56DE\u6267\u4E5F\u4E0D\u8BC1\u660E\u8FD8\u6CA1\u505A\u3002\u65E0\u6CD5\u5224\u65AD\u7684\u6750\u6599\u7559\u7A7A\uFF0C\u4E0D\u8865\u9020\u72B6\u6001\u3002\n\u53EA\u9009\u62E9\u4E00\u4E2Aaction\uFF1Aanswer\u76F4\u63A5\u89E3\u7B54\uFF1Bprovide_material\u63D0\u4F9B\u6240\u9700\u5185\u5BB9\uFF1Bprepare_confirmation\u51C6\u5907\u5DF2\u5B9A\u8303\u56F4\u7684\u786E\u8BA4\uFF1Bclarify\u53EA\u95EE\u5FC5\u8981\u7F3A\u53E3\uFF1Bverify_company\u6838\u67D0\u9879\u516C\u53F8\u6761\u4EF6\uFF1Bcoordinate_demo\u534F\u8C03\u5DF2\u5141\u8BB8\u7684\u6F14\u793A\uFF1Bwait\u7B49\u5F85\u5BA2\u6237\u660E\u786E\u7EA6\u5B9A\u7684\u53CD\u9988\uFF1Bstop\u4EC5\u7528\u4E8E\u660E\u786E\u505C\u8054\u4E14\u65E0\u65B0\u95EE\u9898\u3002\u52A8\u4F5C\u4E0D\u4EE3\u8868\u5DF2\u6267\u884C\u3002\u5BA2\u6237\u51C6\u5907\u786E\u8BA4\u65F6\u4E0D\u8981\u9000\u56DE\u6F14\u793A\uFF0C\u6750\u6599\u5DF2\u6536\u5230\u540E\u4E0D\u8981\u91CD\u505A\uFF0C\u672A\u77E5\u95EE\u9898\u4E0D\u6263\u4F4F\u5DF2\u77E5\u6750\u6599\u3002\nprevious_progress.pending\u662F\u5BBF\u4E3B\u8BB0\u5F55\u7684\u5916\u90E8\u5F85\u6838\u95EE\u9898\uFF0C\u4E0D\u662F\u6279\u51C6\u6216\u5DF2\u6267\u884C\u3002\u516C\u53F8\u4F9D\u636E\u672A\u53D8\u65F6\uFF0C\u4E0D\u628A\u5DF2\u7ECF\u8BF4\u8FC7\u53BB\u6838\u7684\u540C\u4E00\u4EF6\u4E8B\u518D\u5F53\u65B0\u7684\u63A8\u8FDB\uFF1B\u5BA2\u6237\u53EA\u8868\u793A\u7B49\u5F85\u65F6\u9009wait\uFF0C\u6709\u65B0\u95EE\u9898\u5148\u7B54\u65B0\u95EE\u9898\u3002response_contract\u89C4\u5B9A\u8FD9\u8F6E\u8981\u5B9E\u9645\u7ED9\u51FA\u7684\u5185\u5BB9\u3002pending\u7531\u5BBF\u4E3B\u7EF4\u62A4\uFF0C\u4E0D\u6284\u8FDB\u8F93\u51FAprogress\u3002\ngoal\u672C\u8F6E\u76EE\u6807\uFF1Bneed_to_answer\u7528\u7B80\u77ED\u6761\u76EE\u5217\u5F53\u524D\u95EE\u9898\uFF0C\u6BCF\u9879\u53EA\u5199\u4E00\u4E2A\u95EE\u9898\uFF0C\u4E0D\u66FF\u4F5C\u8005\u5199\u7B54\u6848\u548C\u80CC\u666F\uFF1Bnot_needed_now\u5199\u4E0D\u5E94\u91CD\u8BB2\u7684\u5185\u5BB9\uFF1Bnext_action\u662F\u5185\u90E8\u5B57\u6BB5\uFF0C\u76F4\u63A5\u7B54\u6E05\u5C31\u5199\u201C\u56DE\u7B54\u5F53\u524D\u95EE\u9898\u201D\uFF0C\u65E0\u9700\u989D\u5916\u63A8\u8FDB\u3002customer_decisions\u9009\u6700\u591A3\u9879\u73B0\u6709C/F/P\u6765\u6E90\uFF0C\u4E0D\u9009\u65E7\u9500\u552ES\uFF1Bmeaning\u662F\u63A8\u65AD\uFF0C\u4E0D\u80FD\u5347\u7EA7\u4E3A\u6279\u51C6\u3002\nneed_to_answer\u5217\u5F85\u7B54\u95EE\u9898\uFF0C\u4E0D\u8981\u9884\u5148\u5199\u5165\u672A\u7ECF\u6765\u6E90\u652F\u6301\u7684\u7B54\u6848\u3002\u4F8B\u5982\u5BA2\u6237\u95EE\u4F1A\u4E0D\u4F1A\u81EA\u52A8\u6263\u6B3E\uFF0C\u53EA\u5217\u201C\u5F53\u524D\u6536\u8D39\u4E0E\u6388\u6743\u6263\u6B3E\u89C4\u5219\u80FD\u5426\u786E\u8BA4\uFF0C\u7F3A\u4EC0\u4E48\u4F9D\u636E\u201D\uFF0C\u4E0D\u80FD\u51ED\u5E38\u8BC6\u5148\u5199\u201C\u5FC5\u987B\u56DE\u7B54\u4E0D\u4F1A\u6263\u6B3E\u201D\uFF1B\u95EE\u8BB0\u5F55\u4FDD\u7559\u3001\u5E76\u53D1\u8986\u76D6\u3001\u8DE8\u6708\u5229\u6DA6\u65F6\u540C\u7406\u3002\u5DF2\u77E5\u7684\u6570\u5B57\u548C\u516C\u53F8\u6761\u4EF6\u53EF\u4FDD\u7559\u5176\u6765\u6E90\u8303\u56F4\uFF0C\u672A\u77E5\u5C31\u5217\u5F85\u6838\u9879\uFF0C\u4E0D\u8981\u6C42\u5199\u4F5C\u8005\u53D1\u660E\u627F\u8BFA\u3002\u5408\u7406\u4EBA\u5DE5\u53EA\u8BFB\u6838\u5BF9\u5EFA\u8BAE\u4E0E\u8F6F\u4EF6\u529F\u80FD\u5206\u5F00\u3002\n\u590D\u5408\u95EE\u9898\u9010\u9879\u5217\u51FA\uFF0C\u4F8B\u5982\u5165\u53E3\u3001\u64CD\u4F5C\u6B65\u9AA4\u3001\u600E\u6837\u786E\u8BA4\u7ED3\u679C\u3001\u6559\u5B66\u7D20\u6750\u3002\u8D44\u6599\u652F\u6301\u5176\u4E2D\u51E0\u9879\u5C31\u5B89\u6392\u5148\u56DE\u7B54\u8FD9\u51E0\u9879\uFF1B\u7F3A\u5177\u4F53\u7248\u672C\u65F6\u5C06\u9002\u7528\u6761\u4EF6\u653E\u5728\u8BE5\u6B65\u9AA4\u524D\uFF0C\u672A\u77E5\u5B57\u6BB5\u6216\u6743\u9650\u5355\u72EC\u5F85\u6838\u3002\nprogress\u662F\u5BA2\u6237\u4FA7\u8FDB\u5C55\u6295\u5F71\uFF0C\u4E0D\u662F\u516C\u53F8\u6388\u6743\u3002\u6240\u6709progress\u6765\u6E90\u53EA\u9009C/F/P\u4E2D\u7684\u5BA2\u6237\u8BC1\u636E\uFF0CQ/V/O\u516C\u53F8\u6761\u4EF6\u72EC\u7ACB\u4FDD\u7559\uFF0C\u4E0D\u80FD\u590D\u5236\u5230progress\uFF1Bscope/budget\u53EA\u8BB0\u5F55\u5BA2\u6237\u9009\u62E9\u3002stage\u53EA\u80FDexploring/evaluating/confirming/paused/declined\u5E76\u9644source_id\u3002decisions\u6BCF\u4E3B\u9898\u4FDD\u7559\u5F53\u524D\u7ED3\u8BBA\uFF0Ctopic\u53EA\u80FDproduct/purchase/scope/privacy/materials/timing/budget/role/followup\uFF1B\u6BCF\u9879\u542Btopic\u3001source_id\u3001meaning\u3002artifacts\u6BCF\u7C7B\u6700\u591A\u4E00\u9879\uFF0Ckind\u53EA\u80FDsample/intro/confirmation\uFF1Bstatus\u53EA\u80FDrequested/received/reviewed\uFF0Csource_id\u5FC5\u987B\u662F\u5BA2\u6237\u8BC1\u636E\u3002\u6CA1\u6709\u8BC1\u636E\u5C31\u7559\u7A7A\u3002\u5DF2\u6709\u7ED3\u8BBA\u82E5\u88AB\u65B0\u6D88\u606F\u7EA0\u6B63\uFF0C\u4F7F\u7528\u65B0\u6765\u6E90\u66FF\u6362\uFF1B\u4ECD\u6709\u6548\u7684\u4FDD\u7559\u3002\n" + (packet.knowledge.materials_available ? '\u72EC\u7ACB\u7D20\u6750\u5E93\u5DF2\u914D\u7F6E\u3002\u5F53\u524D\u64CD\u4F5C\u95EE\u9898\u53EF\u7528\u89C6\u9891/\u6587\u6863\u8F85\u52A9\uFF0C\u6216\u5DF2\u52A0\u8F7D\u7535\u8BDD\u4E2D\u7684\u5BA2\u6237\u660E\u786E\u63D0\u51FA\u76F8\u5173\u9700\u6C42\u4E14\u540E\u7EED\u672A\u64A4\u56DE\u65F6\uFF0C\u53EF\u53E6\u5916\u8FD4\u56DEmaterial_need={"query":"\u53EA\u542B\u4EA7\u54C1\u4E0E\u64CD\u4F5C\u4E3B\u9898\u7684\u81EA\u7136\u8BED\u8A00\u67E5\u8BE2","kind":"video\u6216document\u6216image\u6216any","edition":"\u95E8\u5E97\u7248\u6216\u4E13\u4E1A\u7248\u6216\u6807\u51C6\u7248\u6216unknown","source_id":"\u5B9E\u9645\u5BA2\u6237\u6765\u6E90\u7F16\u53F7"}\uFF1B\u5176\u4ED6\u65F6\u5019\u4E0D\u8FD4\u56DE\u6B64\u5B57\u6BB5\u3002\u7535\u8BDD\u91CC\u7684\u9500\u552E\u4ECB\u7ECD\u4E0D\u7B97\u5BA2\u6237\u9700\u6C42\u3002\u5148\u770B\u6700\u65B0\u5FAE\u4FE1\u7684\u62D2\u53D1\u3001\u6536\u5230/\u4E0D\u91CD\u53D1\u3001\u65B0\u95EE\u9898\u4E0E\u7248\u672C\u7EA0\u6B63\uFF1B\u4E0D\u8981\u7528\u65E7\u7535\u8BDD\u9700\u6C42\u8986\u76D6\u3002\u6CA1\u6709\u786E\u5B9A\u4EA7\u54C1\u7248\u672C\u65F6\u586Bunknown\uFF0C\u4F01\u4E1A\u7248\u4E0D\u81EA\u52A8\u7B49\u4E8E\u4E13\u4E1A\u7248\u3002\u4E0D\u8981\u628A\u5BA2\u6237\u624B\u673A\u53F7\u3001\u59D3\u540D\u3001\u8D26\u53F7\u6216\u5355\u636E\u53F7\u585E\u8FDB\u67E5\u8BE2\u3002\u4E0D\u56E0\u666E\u901A\u5BD2\u6684\u5C31\u627E\u7D20\u6750\uFF1B\u7D20\u6750\u4E0D\u4EE3\u8868\u91C7\u8D2D\u6216\u5F00\u901A\u3002\n' : "") + (packet.knowledge.materials_available ? "\u5BBF\u4E3B\u7684material_request_constraints\u53EA\u7EA6\u675F\u5BA2\u6237\u5DF2\u660E\u786E\u7684\u7D20\u6750\u5F62\u6001\u548C\u7248\u672C\u3002required=true\u65F6\uFF0C\u672C\u6B21\u5FC5\u987B\u8F93\u51FAmaterial_need\u4E14kind\u4E25\u683C\u53D6\u7EA6\u675Fkind\uFF0C\u4E0D\u53EF\u7701\u7565\u3001null\u6216\u6539\u6210any\uFF1Bquery\u7531\u4F60\u63D0\u70BC\u672C\u8F6E\u64CD\u4F5C\u4E3B\u9898\uFF0C\u4E0D\u8981\u9020\u9644\u4EF6\uFF0C\u4E0D\u628A\u6587\u6863\u6539\u6210\u89C6\u9891\u3002required=false\u4E0D\u6392\u9664\u7535\u8BDD\u5BA2\u6237\u5DF2\u6709\u9700\u6C42\uFF0C\u6309\u6765\u6E90\u5224\u65AD\u3002\n" : "") + 'material_need.kind\u8868\u793A\u6587\u4EF6\u5F62\u6001\uFF0Cprogress.artifacts.kind\u8868\u793A\u6750\u6599\u7528\u9014\uFF0C\u4E24\u8005\u4E0D\u53EF\u6DF7\u7528\u3002\u6587\u6863\u3001\u89C6\u9891\u3001\u56FE\u7247\u64CD\u4F5C\u8D44\u6599\u5728artifacts.kind\u7EDF\u4E00\u7528intro\uFF0C\u4E0D\u5199document/video/image\uFF1B\u8BF7\u6C42\u3001\u6536\u5230\u3001\u770B\u8FC7\u4ECD\u53EA\u80FD\u6309\u5BA2\u6237\u539F\u8BDD\u5206\u522B\u8BB0\u5F55\u3002\n\u53EA\u8FD4\u56DEJSON\uFF1A{"goal":"...","customer_decisions":[{"source_id":"C0","meaning":"..."}],"need_to_answer":["..."],"not_needed_now":["..."],"next_action":"...","action":"answer","progress":{"stage":"evaluating","source_id":"C0","decisions":[],"artifacts":[]}' + (packet.knowledge.materials_available ? ',"material_need":null' : "") + "}\u3002\u4E0D\u6284quote\uFF0C\u7A0B\u5E8F\u7ED1\u5B9A\u539F\u6587\u3002" + (packet.knowledge.materials_available ? "\u5B58\u5728\u7D20\u6750\u9700\u6C42\u65F6\u5C06material_need\u66FF\u6362\u4E3A\u542Bquery\u3001kind\u3001edition\u3001source_id\u7684\u5BF9\u8C61\uFF0C\u4E0D\u80FD\u53EA\u5199\u5728next_action\u4E2D\u3002" : "") + "\nDATA\n" + JSON.stringify({ turn_packet: packet, contextId, ...packet.knowledge.materials_available ? { material_request_constraints: materialRequestConstraints(packet) } : {} });
10881
10973
  }
10882
10974
 
10883
10975
  // src/data-scope.ts
@@ -11669,7 +11761,7 @@ function parseReply(text4, allowedMoney, customerMoney = []) {
11669
11761
  return { judgment: value.judgment, wechat: value.wechat, next_step: value.next_step, no_send: value.no_send };
11670
11762
  }
11671
11763
  function buildPrompt(contact, latest, knowledge, packet = buildTurnPacket(contact, latest, knowledge)) {
11672
- return "/wanji-sales-assistant\nhost_checks=true\u3002\u4E3A\u4E07\u673A\u9500\u552E\u8D77\u8349\u7ED9\u5546\u5BB6\u7684\u5FAE\u4FE1\uFF0C\u4E0D\u6267\u884C\u4EFB\u4F55\u5BF9\u5916\u52A8\u4F5C\u3002\u4F7F\u7528\u5F53\u524D\u6280\u80FD\u7684\u65B9\u6CD5\uFF0C\u6700\u7EC8\u53EA\u8FD4\u56DEJSON\u56DB\u5B57\u6BB5judgment\u3001wechat\u3001next_step\u3001no_send\u3002\n" + intentGuidance(contact.intent) + wechatVoice + "\n\u672C\u8F6E\u5199\u6CD5\uFF1A\u50CF\u5FAE\u4FE1\u91CC\u63A5\u7740\u4E00\u4E2A\u5177\u4F53\u5546\u5BB6\u7684\u8BDD\u5F80\u4E0B\u804A\u3002\u5E38\u7528\u8BCD\u3001\u81EA\u7136\u505C\u987F\u90FD\u53EF\u4EE5\uFF0C\u76F4\u63A5\u63A5\u8FD9\u6B21\u6700\u5728\u610F\u7684\u4E8B\uFF1B\u89E3\u91CA\u5230\u5BF9\u65B9\u80FD\u660E\u767D\u5C31\u6536\u4F4F\u3002\u4E0D\u8981\u4E3A\u663E\u5F97\u70ED\u60C5\u518D\u52A0\u4E00\u8F6E\u603B\u7ED3\u3001\u8C28\u614E\u58F0\u660E\u6216\u63D0\u95EE\u3002\u7D20\u6750\u5360\u4F4D\u524D\u4E0D\u518D\u6284\u7D20\u6750\u5168\u540D\uFF0C\u6807\u9898\u548C\u94FE\u63A5\u7531\u7A0B\u5E8F\u7ED9\u51FA\u3002\n" + voiceExamplePrompt(latest) + "\n\u6240\u6709\u9636\u6BB5\u5171\u7528turn_packet\u3002sources\u6709\u6765\u6E90\u89D2\u8272\uFF1A\u5BA2\u6237\u539F\u8BDD\u53EA\u8BC1\u660E\u5BA2\u6237\u60C5\u51B5\u4E0E\u9009\u62E9\uFF0Chistorical_sales\u53EA\u7528\u4E8E\u907F\u514D\u91CD\u8BB2\uFF0C\u4E0D\u6279\u51C6\u516C\u53F8\u6761\u6B3E\u3002deal\u4E0Ecompany\u8BC1\u636E\u53EA\u6309\u539F\u6587\u8303\u56F4\u4F7F\u7528\uFF1Bmethods\u662F\u57F9\u8BAD\u65B9\u6CD5\uFF0Cpolicy_candidates\u5C1A\u975E\u672C\u5355\u6388\u6743\u3002\u4E0D\u80FD\u628A\u672A\u77E5\u8BF4\u6210\u514D\u8D39\u3001\u4E0D\u652F\u6301\u3001\u5DF2\u5B8C\u6210\u6216\u4FDD\u8BC1\u7ED3\u679C\u3002\nsources\u4E2DR\u7F16\u53F7\u7684product_reference\u662F\u7ECF\u6765\u6E90\u6838\u5BF9\u7684\u4EA7\u54C1\u4ECB\u7ECD\u8D44\u6599\uFF1A\u53EF\u4EE5\u4ECB\u7ECD\u539F\u6587\u660E\u5217\u7684\u4EA7\u54C1\u65B9\u5411\uFF0C\u5E76\u4E0E\u5BA2\u6237\u5F53\u524D\u505A\u6CD5\u4F5C\u4E1A\u52A1\u5C42\u9762\u7684\u5BF9\u7167\u3002\u5FC5\u987B\u4FDD\u7559\u5176\u8FB9\u754C\uFF1B\u6CA1\u6709\u5177\u4F53\u5B57\u6BB5/\u7248\u672C\u4F9D\u636E\u65F6\u4E0D\u8865\u9020\u3002\u4E0D\u8981\u5148\u627F\u8BFA\u80FD\u529B\u518D\u52A0\u514D\u8D23\u58F0\u660E\uFF0C\u4E5F\u4E0D\u8981\u6574\u6BB5\u9000\u56DE\u6838\u5B9E\uFF1A\u628A\u8D44\u6599\u5DF2\u77E5\u7684\u65B9\u5411\u8BF4\u6E05\uFF0C\u518D\u53EA\u6709\u7F3A\u9879\u4F1A\u6539\u53D8\u7B54\u6848\u65F6\uFF0C\u624D\u95EE\u8FD9\u4E2A\u5177\u4F53\u7F3A\u9879\u3002\nsources\u4E2DU\u7F16\u53F7\u662F\u7ECF\u6838\u5BF9\u7684\u8D44\u6599\u8303\u56F4\u5185\u7684\u64CD\u4F5C\u4F9D\u636E\u3002\u6709\u5BF9\u5E94\u8D44\u6599\u5C31\u5148\u56DE\u7B54\u5BA2\u6237\u95EE\u5230\u7684\u5165\u53E3\u3001\u6B65\u9AA4\u6216\u9A8C\u8BC1\u70B9\u3002\u672A\u786E\u5B9A\u5BA2\u6237\u7248\u672C\u65F6\u5199\u201C\u5982\u679C\u60A8\u7528\u7684\u662F\u2026\uFF0C\u6309\u8BE5\u7248\u672C\u8D44\u6599\u53EF\u4EE5\u5148\u2026\u201D\uFF0C\u4E0D\u80FD\u56E0\u6B64\u628A\u6574\u9898\u7559\u5F85\u786E\u8BA4\uFF1B\u6BD4\u8F83\u7248\u672C\u8981\u5206\u5F00\u5199\u3002\u5BF9\u4E8E\u8D44\u6599\u672A\u8BC1\u660E\u7684\u5B57\u6BB5\u3001\u8BBE\u5907\u517C\u5BB9\u3001\u662F\u5426\u5F00\u901A\u3001\u771F\u5B9E\u6267\u884C\u7ED3\u679C\u548C\u73B0\u884C\u4EF7\u683C\uFF0C\u53EA\u628A\u90A3\u4E00\u9879\u5217\u4E3A\u5F85\u6838\u3002\u660E\u786E\u7248\u672C\u7684\u8D44\u6599\u4E0D\u5957\u5230\u5176\u4ED6\u7248\u672C\u3002\nmaterial_context\u6765\u81EA\u72EC\u7ACB\u5BA2\u6237\u7D20\u6750\u5E93\u3002M\u7F16\u53F7\u662F\u5DF2\u6838\u5BF9\u7684\u7D20\u6750\uFF0C\u4E0D\u662F\u516C\u53F8\u6388\u6743\uFF1B\u53EA\u9009\u4E0E\u672C\u8F6E\u4E3B\u9898\u53CA\u7248\u672C\u786E\u5B9E\u5BF9\u5E94\u7684\u6700\u591A\u4E24\u4EFD\uFF0C\u7528{{MATERIAL_1}}\u7B49\u5360\u4F4D\uFF0C\u7A0B\u5E8F\u63D0\u4F9B\u771F\u5B9E\u6807\u9898\u548C\u94FE\u63A5\u3002\u6587\u6863\u6CE8\u660E\u9875\u7801\uFF0C\u89C6\u9891\u8BF4\u660E\u4E0B\u8F7D\u67E5\u770B\u5373\u53EF\uFF1B\u4E0D\u80FD\u8BF4\u9644\u4EF6\u5DF2\u7ECF\u53D1\u5230\u5FAE\u4FE1\u3002\u6587\u672C\u8D44\u6599\u91CC\u7684\u89C6\u9891/\u6587\u6863\u5730\u5740\u53EA\u662F\u68C0\u7D22\u7EBF\u7D22\uFF0C\u4E0D\u4EE3\u66FF\u72EC\u7ACB\u7D20\u6750\u53EC\u56DE\u3002\u65E0\u5339\u914D\u3001\u7248\u672C\u4E0D\u660E\u6216\u94FE\u63A5\u4E0D\u53EF\u7528\u65F6\u8BF4\u660E\u5177\u4F53\u7F3A\u9879\uFF0C\u5148\u56DE\u7B54\u53EF\u77E5\u5185\u5BB9\uFF0C\u4E0D\u9020\u94FE\u63A5\uFF0C\u4E0D\u628A\u201C\u6211\u53D1\u4F60\u201D\u5F53\u5DF2\u7ED9\u51FA\u6750\u6599\uFF1B\u4E0D\u91CD\u590D\u53D1\u5BA2\u6237\u5DF2\u7ECF\u6536\u5230\u4E14\u6CA1\u8981\u6C42\u91CD\u53D1\u7684\u5185\u5BB9\u3002\n" + operationProofRules + "\n\u5148\u4FDD\u8BC1\u4E8B\u5B9E\u4E0E\u653F\u7B56\u51C6\u786E\uFF0C\u8D34\u7740\u5BA2\u6237\u60C5\u5883\u76F4\u63A5\u56DE\u7B54\u5F53\u524D\u95EE\u9898\uFF0C\u518D\u6309\u786E\u6709\u7684\u54A8\u8BE2\u3001\u987E\u8651\u6216\u8D2D\u4E70\u9700\u6C42\u9009\u62E9\u5408\u9002\u7684\u8BF4\u6CD5\u3002\u5BA2\u6237\u6307\u5B9A\u65E5\u671F/\u4ED8\u6B3E\u6E20\u9053\u53EA\u662F\u5BA2\u6237\u8981\u6C42\uFF1B\u516C\u53F8\u672A\u786E\u8BA4\u65F6\uFF0C\u8BF4\u6E05\u5F85\u6838\u5E76\u4FDD\u7559\u8BC9\u6C42\u5373\u53EF\uFF0C\u4E0D\u80FD\u4E3A\u4E86\u7ED9\u5B8C\u6574\u786E\u8BA4\u5355\u8865\u9020\u6761\u6B3E\u3002\u5DF2\u6536\u5230\u7684\u6750\u6599\u53EA\u8865\u672C\u8F6E\u53D8\u5316\uFF0C\u5BA2\u6237\u8981\u6C42\u6838\u6E05\u540E\u518D\u53D1\u5219\u7B49\u4F9D\u636E\uFF0C\u4E0D\u6BCF\u8F6E\u91CD\u5217\u6574\u4EFD\u3002\n\u63A5\u6700\u65B0\u8FD9\u53E5\u8BDD\uFF0C\u7EE7\u627F\u4ECD\u6709\u6548\u7684\u5BA2\u6237\u51B3\u5B9A\u548C\u6750\u6599\u72B6\u6001\uFF1B\u5BA2\u6237\u5DF2\u7ECF\u6536\u5230\u6216\u8F6C\u4EA4\u7684\u6750\u6599\u4E0D\u91CD\u65B0\u51C6\u5907\uFF0C\u9664\u975E\u660E\u786E\u8981\u6539\u3002\u672C\u8F6E\u786E\u6709\u4E1A\u52A1\u95EE\u9898\u5C31\u76F4\u63A5\u7B54\u5E76\u8BF4\u6E05\u5FC5\u8981\u6761\u4EF6\uFF1B\u5410\u69FD\u3001\u73A9\u7B11\u3001\u7B80\u5355\u786E\u8BA4\u53EF\u81EA\u7136\u6536\u4F4F\uFF0C\u4E0D\u5957\u9500\u552E\u4E09\u6BB5\u5F0F\u3002\u5DF2\u786E\u8BA4\u7684\u62A5\u4EF7\u548C\u8303\u56F4\u4E0D\u9000\u56DE\u672A\u77E5\uFF0C\u672A\u77E5\u9879\u53EA\u5F71\u54CD\u5BF9\u5E94\u90E8\u5206\u3002\u4E0D\u8981\u4E3A\u4E86\u63A8\u8FDB\u589E\u52A0\u514D\u8D39\u3001\u65F6\u95F4\u3001\u6548\u679C\u3001\u6743\u9650\u6216\u6267\u884C\u627F\u8BFA\u3002\n\u8FD9\u662F\u7ED9\u9500\u552E\u4EBA\u5DE5\u5BA1\u6838\u7684\u8349\u7A3F\u3002\u5148\u6309response_contract\u56DE\u7B54\u80FD\u786E\u8BA4\u7684\u90E8\u5206\uFF1B\u4E0D\u6E05\u695A\u7684\u5177\u4F53\u7EC6\u8282\u76F4\u63A5\u8BF4\u6682\u4E0D\u80FD\u786E\u8BA4\u3002\u53EF\u7ED9\u660E\u786E\u6807\u4E3A\u5EFA\u8BAE\u7684\u9009\u578B\u601D\u8DEF\u3001\u5BF9\u7167\u7EF4\u5EA6\u6216\u53EA\u8BFB\u6838\u9A8C\u65B9\u6CD5\uFF0C\u4E0D\u9700\u8981\u8F6F\u4EF6\u5165\u53E3\u6216\u4EA7\u54C1\u80FD\u529B\u624D\u80FD\u6210\u7ACB\u3002\u6CA1\u6709\u53EF\u9760\u5EFA\u8BAE\uFF0C\u7B80\u77ED\u8BF4\u660E\u8FD8\u7F3A\u4EC0\u4E48\u4FE1\u606F\u4E5F\u53EF\u4EA4\u7A3F\u3002\u4E0D\u80FD\u628A\u6709\u5F85\u786E\u8BA4\u7684\u80FD\u529B\u6539\u6210\u201C\u5982\u679C\u53EF\u4EE5\u201D\u518D\u7ED9\u5177\u4F53\u865A\u6784\u6B65\u9AA4\u3002\n\u5BA2\u6237\u63D0\u51FA\u987E\u8651\u65F6\uFF0C\u56DE\u7B54\u8981\u843D\u5230\u8FD9\u4E2A\u987E\u8651\u7684\u5224\u65AD\u4F9D\u636E\uFF1A\u4F8B\u5982\u62C5\u5FC3\u91CD\u590D\u8BB0\u5F55\u5C31\u8BF4\u660E\u5F53\u524D\u8D44\u6599\u80FD\u786E\u8BA4\u7684\u8BB0\u5F55\u4E0E\u6838\u5BF9\u5173\u7CFB\uFF0C\u62C5\u5FC3\u8868\u683C\u5207\u6362\u5C31\u6309\u5176\u5DF2\u77E5\u4E1A\u52A1\u6BD4\u8F83\uFF0C\u62C5\u5FC3\u5458\u5DE5\u80FD\u770B\u5230\u4EC0\u4E48\u5C31\u533A\u5206\u6240\u9700\u804C\u8D23\u4E0E\u5C1A\u672A\u6838\u5B9E\u7684\u6743\u9650\u3002\u4E0D\u80FD\u62FF\u4E00\u4EFD\u901A\u7528\u529F\u80FD\u4ECB\u7ECD\u4EE3\u66FF\u5F53\u524D\u95EE\u9898\uFF1B\u4E0D\u628A\u5BA2\u6237\u4E3B\u89C2\u8BC4\u4EF7\u6539\u5199\u4E3A\u5176\u4E60\u60EF\u3001\u5DF2\u53D1\u751F\u635F\u5931\u6216\u5176\u4ED6\u4EBA\u7684\u8BA4\u53EF\u3002\n\u6B63\u6587\u7B2C\u4E00\u53E5\u5C31\u63A5\u5177\u4F53\u95EE\u9898\u3002\u6709\u4E24\u4E09\u4E2A\u64CD\u4F5C\u70B9\u65F6\uFF0C\u6309\u5B9E\u9645\u987A\u5E8F\u9010\u70B9\u7ED9\u5165\u53E3\u3001\u52A8\u4F5C\u548C\u600E\u4E48\u6838\u5BF9\uFF0C\u4E0D\u5148\u590D\u8FF0\u9700\u6C42\u3002\u80FD\u7528\u4E00\u53E5\u8BF4\u6E05\u5C31\u4E00\u53E5\uFF0C\u591A\u4E2A\u72EC\u7ACB\u95EE\u9898\u53EF\u5206\u884C\u3002\u53EA\u6709\u7F3A\u7684\u90A3\u9879\u8BF4\u6682\u4E0D\u80FD\u786E\u8BA4\uFF1B\u4F8B\u5982\u8D44\u6599\u53EA\u8BC1\u660E\u67D0\u4E00\u7248\u672C\u65F6\uFF0C\u76F4\u63A5\u4EE5\u201C\u5982\u679C\u4F60\u7528\u7684\u662F\u8BE5\u7248\u672C\u201D\u7ED9\u8BE5\u7248\u6B65\u9AA4\u3002\n\u5BA2\u6237\u6CA1\u6709\u8981\u6C42\u4E0B\u4E00\u6B65\u65F6\uFF0C\u4E0D\u7528\u5728\u5FAE\u4FE1\u672B\u5C3E\u8865\u8FFD\u95EE\u3001\u9080\u7EA6\u3001\u518D\u603B\u7ED3\u6216\u201C\u6709\u95EE\u9898\u968F\u65F6\u627E\u6211\u201D\u3002\u5982\u679C\u95EE\u7684\u662F\u600E\u4E48\u505A\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BF4\u8981\u5BF9\u7167\u7684\u5B57\u6BB5\u6216\u770B\u54EA\u9875\u3002\u5DF2\u6709\u6750\u6599\u73B0\u5728\u7ED9\uFF1B\u53EA\u6709\u7F3A\u5931\u6761\u4EF6\u4F1A\u6539\u53D8\u7B54\u6848\u65F6\u624D\u8865\u95EE\uFF0C\u522B\u91CD\u95EE\u5BA2\u6237\u5DF2\u7ED9\u7684\u4FE1\u606F\u3002\n\u8D44\u6599\u4E0D\u8DB3\u65F6\u4ECD\u53EF\u7ED9\u4EBA\u5DE5\u53EA\u8BFB\u6838\u5BF9\u601D\u8DEF\uFF0C\u660E\u786E\u662F\u7BA1\u7406\u5EFA\u8BAE\uFF1A\u6309\u5BA2\u6237\u624B\u5934\u80FD\u53D6\u5F97\u7684\u673A\u5668\u552F\u4E00\u6807\u8BC6\u3001\u539F\u59CB\u51ED\u636E\uFF0C\u5206\u6E05\u8D27\u7269\u6D41\u5411\u3001\u7EA6\u5B9A\u91D1\u989D\u4E0E\u5B9E\u9645\u6536\u4ED8\uFF1B\u7F3A\u9879\u5148\u7559\u7A7A\u3002\u4E0D\u628A\u5EFA\u8BAE\u5199\u6210\u8F6F\u4EF6\u5177\u5907\u67D0\u5B57\u6BB5\u3001\u53EF\u6539\u5355\u3001\u81EA\u52A8\u53BB\u91CD\u6216\u786E\u5B9A\u7684\u4F1A\u8BA1\u5904\u7406\u89C4\u5219\u3002\u4E0D\u58F0\u79F0\u5BA2\u6237\u5DF2\u7ECF\u6709\u8FD9\u4E9B\u8BB0\u5F55\u3002\u672A\u77E5\u8F6F\u4EF6\u7EC6\u8282\u53EA\u6838\u5BF9\u5E94\u9879\uFF0C\u4E0D\u8BA9\u6574\u4EFD\u7B54\u590D\u53D8\u6210\u5F85\u6838\u3002\n\u5F53\u524D\u6D88\u606F\u6216\u8D44\u6599\u6CA1\u5217\u5177\u4F53\u6570\u5B57\u3001\u6743\u9650\u3001\u8BB0\u5F55\uFF0C\u53EA\u8BF4\u660E\u5F53\u524D\u63D0\u4F9B\u8303\u56F4\u6CA1\u6709\u8BE5\u7EC6\u8282\uFF0C\u4E0D\u80FD\u5199\u201C\u4ECE\u672A\u8C08\u8FC7\u3001\u5C1A\u672A\u5F00\u901A\u3001\u672A\u53D1\u751F\u4ED8\u6B3E\u3001\u4E0D\u7B97\u8BD5\u7528\u201D\u7B49\u4E1A\u52A1\u72B6\u6001\u5426\u5B9A\u3002\u5BA2\u6237\u8BF4\u53D1\u8FC7\u6587\u4EF6\uFF0C\u4E0D\u7B49\u4E8E\u672C\u8F6E\u8F93\u5165\u5DF2\u5305\u542B\u6587\u4EF6\u6B63\u6587\uFF1B\u53EA\u6709\u4E00\u53E5\u201C\u53D1\u8FC7\u4E86\u201D\u65F6\uFF0C\u522B\u8BF4\u201C\u6211\u8FD9\u91CC\u6709\u4E86/\u5DF2\u770B\u8FC7\u201D\uFF0C\u4E5F\u4E0D\u7F16\u5177\u4F53\u7F3A\u9879\u3002\u53EF\u4EE5\u63A5\u201C\u4E0D\u7528\u91CD\u586B\uFF0C\u5149\u51ED\u8FD9\u53E5\u8FD8\u770B\u4E0D\u51FA\u5355\u5B50\u54EA\u513F\u5BF9\u4E0D\u4E0A\u201D\uFF0C\u8BF4\u660E\u5F53\u524D\u771F\u6B63\u7F3A\u7684\u662F\u6750\u6599\u5185\u5BB9\uFF0C\u4E0D\u8BA9\u5BA2\u6237\u91CD\u65B0\u9010\u9879\u53E3\u8FF0\uFF1B\u5DF2\u6709\u6750\u6599\u5185\u5BB9\u65F6\u5219\u76F4\u63A5\u636E\u6B64\u6838\u5BF9\u3002\u5F53\u524D\u53EA\u662F\u54A8\u8BE2\u4E0D\u7B49\u4E8E\u4EE5\u524D\u6CA1\u6709\u8BD5\u7528\uFF1B\u5BA2\u6237\u5DF2\u8BF4\u8C08\u5B9A\u53EF\u627F\u63A5\u786E\u8BA4\u5355\uFF0C\u7F3A\u7684\u5177\u4F53\u6761\u6B3E\u8BF7\u5176\u8865\u5145\u6216\u5411\u516C\u53F8\u6838\u5B9E\u3002\nprevious_progress.pending\u4ECD\u672A\u53D6\u5F97\u65B0\u4F9D\u636E\u65F6\uFF0C\u4E0D\u518D\u6362\u53E5\u8BDD\u627F\u8BFA\u6838\u5B9E\uFF1B\u5BA2\u6237\u8BF4\u7B49\u5F85\u5C31\u786E\u8BA4\u7B49\u7ED3\u679C\uFF0C\u6709\u65B0\u7684\u95EE\u9898\u76F4\u63A5\u63A5\u3002calculation\u662F\u7A0B\u5E8F\u6838\u7B97\uFF0C\u5148\u770Bmode\u548C\u8303\u56F4\uFF0C\u4E0D\u80FD\u628A\u670D\u52A1\u8D39\u5C0F\u8BA1\u6216\u5047\u8BBE\u7B97\u5F0F\u8BB2\u6210\u771F\u5B9E\u7ED3\u6E05\u3002\u5BA2\u6237\u63D0\u8BAE\u3001\u53CC\u65B9\u786E\u8BA4\u3001\u5B9E\u9645\u6267\u884C\u5206\u5F00\u3002\n\u672C\u8F6E\u53EA\u8BFB\u6240\u7ED9\u6280\u80FD\u4E0E\u8BC1\u636E\uFF0C\u4E0D\u8C03\u7528\u5DE5\u5177\u3001\u4E0D\u91CD\u65B0\u53D6CRM\u3002\u6570\u636E\u8303\u56F4\u4E3Aanonymized-only\u65F6\uFF0C\u53EA\u7528\u516C\u53F8\u6216\u5BA2\u6237\u81EA\u613F\u63D0\u4F9B\u7684\u8131\u654F\u6750\u6599\uFF0C\u4E0D\u7D22\u771F\u8D26\u6216\u5BA2\u6237\u8D26\u53F7\u3002\u5DF2\u6709calculation\u65F6\u7528{{QUOTE}}\u5360\u4F4D\u4E00\u6B21\uFF0C\u4E0D\u53E6\u7B97\u3002{{QUOTE}}\u4EE3\u8868\u5B8C\u6574\u6838\u7B97\u6BB5\u843D\uFF0C\u4E0D\u662F\u4E00\u4E2A\u91D1\u989D\uFF0C\u5FC5\u987B\u72EC\u7ACB\u6210\u6BB5\uFF1B\u4E0D\u8981\u5199\u6210\u201C\u6302\u724C\u81F3\u5C11{{QUOTE}}\u201D\u6216\u5728\u5360\u4F4D\u524D\u540E\u91CD\u590D\u91D1\u989D\u3001\u7B97\u5F0F\u3001\u8D39\u7528\u6761\u4EF6\u3002numericBinding\u4E3Aquote_only\u65F6\uFF0C\u6240\u6709\u672C\u6B21\u6838\u7B97\u6570\u5B57\u53EA\u5728\u8BE5\u6BB5\uFF0C\u7531\u7A0B\u5E8F\u5199\u5165\u3002no_send\u4E25\u683C\u6309\u5BBF\u4E3B\u5DF2\u9A8C\u8BC1\u7684action\uFF1A\u53EA\u6709stop\u624Dtrue\u4E14wechat\u7559\u7A7A\uFF1B\u5176\u4ED6action\u5747false\u5E76\u5199\u6709\u6548\u6B63\u6587\u3002paused\u662F\u6682\u505C\u91C7\u8D2D\uFF0C\u4E0D\u7B49\u4E8E\u7981\u6B62\u56DE\u5E94\uFF1B\u672C\u8F6Eplan\u9009answer\u65F6\uFF0C\u7B80\u5355\u63A5\u4F4F\u5373\u53EF\uFF0C\u4E0D\u7528\u91CD\u8BB2\u65E7\u6761\u4EF6\u3002\nDATA\n" + JSON.stringify({ turn_packet: packet });
11764
+ return "/wanji-sales-assistant\nhost_checks=true\u3002\u4E3A\u4E07\u673A\u9500\u552E\u8D77\u8349\u7ED9\u5546\u5BB6\u7684\u5FAE\u4FE1\uFF0C\u4E0D\u6267\u884C\u4EFB\u4F55\u5BF9\u5916\u52A8\u4F5C\u3002\u4F7F\u7528\u5F53\u524D\u6280\u80FD\u7684\u65B9\u6CD5\uFF0C\u6700\u7EC8\u53EA\u8FD4\u56DEJSON\u56DB\u5B57\u6BB5judgment\u3001wechat\u3001next_step\u3001no_send\u3002\n" + intentGuidance(contact.intent) + wechatVoice + "\n\u672C\u8F6E\u5199\u6CD5\uFF1A\u50CF\u5FAE\u4FE1\u91CC\u63A5\u7740\u4E00\u4E2A\u5177\u4F53\u5546\u5BB6\u7684\u8BDD\u5F80\u4E0B\u804A\u3002\u5E38\u7528\u8BCD\u3001\u81EA\u7136\u505C\u987F\u90FD\u53EF\u4EE5\uFF0C\u76F4\u63A5\u63A5\u8FD9\u6B21\u6700\u5728\u610F\u7684\u4E8B\uFF1B\u89E3\u91CA\u5230\u5BF9\u65B9\u80FD\u660E\u767D\u5C31\u6536\u4F4F\u3002\u4E0D\u8981\u4E3A\u663E\u5F97\u70ED\u60C5\u518D\u52A0\u4E00\u8F6E\u603B\u7ED3\u3001\u8C28\u614E\u58F0\u660E\u6216\u63D0\u95EE\u3002\u7D20\u6750\u5360\u4F4D\u524D\u4E0D\u518D\u6284\u7D20\u6750\u5168\u540D\uFF0C\u6807\u9898\u548C\u94FE\u63A5\u7531\u7A0B\u5E8F\u7ED9\u51FA\u3002\n" + voiceExamplePrompt(latest) + "\n\u6240\u6709\u9636\u6BB5\u5171\u7528turn_packet\u3002sources\u6709\u6765\u6E90\u89D2\u8272\uFF1A\u5BA2\u6237\u539F\u8BDD\u53EA\u8BC1\u660E\u5BA2\u6237\u60C5\u51B5\u4E0E\u9009\u62E9\uFF0Chistorical_sales\u53EA\u7528\u4E8E\u907F\u514D\u91CD\u8BB2\uFF0C\u4E0D\u6279\u51C6\u516C\u53F8\u6761\u6B3E\u3002deal\u4E0Ecompany\u8BC1\u636E\u53EA\u6309\u539F\u6587\u8303\u56F4\u4F7F\u7528\uFF1Bmethods\u662F\u57F9\u8BAD\u65B9\u6CD5\uFF0Cpolicy_candidates\u5C1A\u975E\u672C\u5355\u6388\u6743\u3002\u4E0D\u80FD\u628A\u672A\u77E5\u8BF4\u6210\u514D\u8D39\u3001\u4E0D\u652F\u6301\u3001\u5DF2\u5B8C\u6210\u6216\u4FDD\u8BC1\u7ED3\u679C\u3002\nsources\u4E2DR\u7F16\u53F7\u7684product_reference\u662F\u7ECF\u6765\u6E90\u6838\u5BF9\u7684\u4EA7\u54C1\u4ECB\u7ECD\u8D44\u6599\uFF1A\u53EF\u4EE5\u4ECB\u7ECD\u539F\u6587\u660E\u5217\u7684\u4EA7\u54C1\u65B9\u5411\uFF0C\u5E76\u4E0E\u5BA2\u6237\u5F53\u524D\u505A\u6CD5\u4F5C\u4E1A\u52A1\u5C42\u9762\u7684\u5BF9\u7167\u3002\u5FC5\u987B\u4FDD\u7559\u5176\u8FB9\u754C\uFF1B\u6CA1\u6709\u5177\u4F53\u5B57\u6BB5/\u7248\u672C\u4F9D\u636E\u65F6\u4E0D\u8865\u9020\u3002\u4E0D\u8981\u5148\u627F\u8BFA\u80FD\u529B\u518D\u52A0\u514D\u8D23\u58F0\u660E\uFF0C\u4E5F\u4E0D\u8981\u6574\u6BB5\u9000\u56DE\u6838\u5B9E\uFF1A\u628A\u8D44\u6599\u5DF2\u77E5\u7684\u65B9\u5411\u8BF4\u6E05\uFF0C\u518D\u53EA\u6709\u7F3A\u9879\u4F1A\u6539\u53D8\u7B54\u6848\u65F6\uFF0C\u624D\u95EE\u8FD9\u4E2A\u5177\u4F53\u7F3A\u9879\u3002\nsources\u4E2DU\u7F16\u53F7\u662F\u7ECF\u6838\u5BF9\u7684\u8D44\u6599\u8303\u56F4\u5185\u7684\u64CD\u4F5C\u4F9D\u636E\u3002\u6709\u5BF9\u5E94\u8D44\u6599\u5C31\u5148\u56DE\u7B54\u5BA2\u6237\u95EE\u5230\u7684\u5165\u53E3\u3001\u6B65\u9AA4\u6216\u9A8C\u8BC1\u70B9\u3002\u672A\u786E\u5B9A\u5BA2\u6237\u7248\u672C\u65F6\u5199\u201C\u5982\u679C\u60A8\u7528\u7684\u662F\u2026\uFF0C\u6309\u8BE5\u7248\u672C\u8D44\u6599\u53EF\u4EE5\u5148\u2026\u201D\uFF0C\u4E0D\u80FD\u56E0\u6B64\u628A\u6574\u9898\u7559\u5F85\u786E\u8BA4\uFF1B\u6BD4\u8F83\u7248\u672C\u8981\u5206\u5F00\u5199\u3002\u5BF9\u4E8E\u8D44\u6599\u672A\u8BC1\u660E\u7684\u5B57\u6BB5\u3001\u8BBE\u5907\u517C\u5BB9\u3001\u662F\u5426\u5F00\u901A\u3001\u771F\u5B9E\u6267\u884C\u7ED3\u679C\u548C\u73B0\u884C\u4EF7\u683C\uFF0C\u53EA\u628A\u90A3\u4E00\u9879\u5217\u4E3A\u5F85\u6838\u3002\u660E\u786E\u7248\u672C\u7684\u8D44\u6599\u4E0D\u5957\u5230\u5176\u4ED6\u7248\u672C\u3002\nmaterial_context\u6765\u81EA\u72EC\u7ACB\u5BA2\u6237\u7D20\u6750\u5E93\u3002M\u7F16\u53F7\u662F\u5DF2\u6838\u5BF9\u7684\u7D20\u6750\uFF0C\u4E0D\u662F\u516C\u53F8\u6388\u6743\uFF1B\u53EA\u9009\u4E0E\u672C\u8F6E\u4E3B\u9898\u53CA\u7248\u672C\u786E\u5B9E\u5BF9\u5E94\u7684\u6700\u591A\u4E24\u4EFD\uFF0C\u7528{{MATERIAL_1}}\u7B49\u5360\u4F4D\uFF0C\u7A0B\u5E8F\u63D0\u4F9B\u771F\u5B9E\u6807\u9898\u548C\u94FE\u63A5\u3002\u6587\u6863\u6CE8\u660E\u9875\u7801\uFF0C\u89C6\u9891\u8BF4\u660E\u4E0B\u8F7D\u67E5\u770B\u5373\u53EF\uFF1B\u4E0D\u80FD\u8BF4\u9644\u4EF6\u5DF2\u7ECF\u53D1\u5230\u5FAE\u4FE1\u3002\u6587\u672C\u8D44\u6599\u91CC\u7684\u89C6\u9891/\u6587\u6863\u5730\u5740\u53EA\u662F\u68C0\u7D22\u7EBF\u7D22\uFF0C\u4E0D\u4EE3\u66FF\u72EC\u7ACB\u7D20\u6750\u53EC\u56DE\u3002\u65E0\u5339\u914D\u3001\u7248\u672C\u4E0D\u660E\u6216\u94FE\u63A5\u4E0D\u53EF\u7528\u65F6\u8BF4\u660E\u5177\u4F53\u7F3A\u9879\uFF0C\u5148\u56DE\u7B54\u53EF\u77E5\u5185\u5BB9\uFF0C\u4E0D\u9020\u94FE\u63A5\uFF0C\u4E0D\u628A\u201C\u6211\u53D1\u4F60\u201D\u5F53\u5DF2\u7ED9\u51FA\u6750\u6599\uFF1B\u4E0D\u91CD\u590D\u53D1\u5BA2\u6237\u5DF2\u7ECF\u6536\u5230\u4E14\u6CA1\u8981\u6C42\u91CD\u53D1\u7684\u5185\u5BB9\u3002\n" + operationProofRules + "\n\u5148\u4FDD\u8BC1\u4E8B\u5B9E\u4E0E\u653F\u7B56\u51C6\u786E\uFF0C\u8D34\u7740\u5BA2\u6237\u60C5\u5883\u76F4\u63A5\u56DE\u7B54\u5F53\u524D\u95EE\u9898\uFF0C\u518D\u6309\u786E\u6709\u7684\u54A8\u8BE2\u3001\u987E\u8651\u6216\u8D2D\u4E70\u9700\u6C42\u9009\u62E9\u5408\u9002\u7684\u8BF4\u6CD5\u3002\u5BA2\u6237\u6307\u5B9A\u65E5\u671F/\u4ED8\u6B3E\u6E20\u9053\u53EA\u662F\u5BA2\u6237\u8981\u6C42\uFF1B\u516C\u53F8\u672A\u786E\u8BA4\u65F6\uFF0C\u8BF4\u6E05\u5F85\u6838\u5E76\u4FDD\u7559\u8BC9\u6C42\u5373\u53EF\uFF0C\u4E0D\u80FD\u4E3A\u4E86\u7ED9\u5B8C\u6574\u786E\u8BA4\u5355\u8865\u9020\u6761\u6B3E\u3002\u5DF2\u6536\u5230\u7684\u6750\u6599\u53EA\u8865\u672C\u8F6E\u53D8\u5316\uFF0C\u5BA2\u6237\u8981\u6C42\u6838\u6E05\u540E\u518D\u53D1\u5219\u7B49\u4F9D\u636E\uFF0C\u4E0D\u6BCF\u8F6E\u91CD\u5217\u6574\u4EFD\u3002\n\u7528current_customer_turn\u63A5\u4F4F\u5BA2\u6237\u8FDE\u7EED\u53D1\u6765\u7684\u8FD9\u8F6E\u8BDD\u3002\u6700\u540E\u4E00\u53E5\u53EA\u662F\u8865\u5145\u8BED\u6C14\u65F6\uFF0C\u56DE\u5E94\u524D\u9762\u5C1A\u672A\u56DE\u7B54\u7684\u987E\u8651\u3002\u7EE7\u627F\u4ECD\u6709\u6548\u7684\u5BA2\u6237\u51B3\u5B9A\u548C\u6750\u6599\u72B6\u6001\uFF1B\u5BA2\u6237\u5DF2\u7ECF\u6536\u5230\u6216\u8F6C\u4EA4\u7684\u6750\u6599\u4E0D\u91CD\u65B0\u51C6\u5907\uFF0C\u9664\u975E\u660E\u786E\u8981\u6539\u3002\u672C\u8F6E\u786E\u6709\u4E1A\u52A1\u95EE\u9898\u5C31\u76F4\u63A5\u7B54\u5E76\u8BF4\u6E05\u5FC5\u8981\u6761\u4EF6\uFF1B\u5410\u69FD\u3001\u73A9\u7B11\u3001\u7B80\u5355\u786E\u8BA4\u53EF\u81EA\u7136\u6536\u4F4F\uFF0C\u4E0D\u5957\u9500\u552E\u4E09\u6BB5\u5F0F\u3002\u5DF2\u786E\u8BA4\u7684\u62A5\u4EF7\u548C\u8303\u56F4\u4E0D\u9000\u56DE\u672A\u77E5\uFF0C\u672A\u77E5\u9879\u53EA\u5F71\u54CD\u5BF9\u5E94\u90E8\u5206\u3002\u4E0D\u8981\u4E3A\u4E86\u63A8\u8FDB\u589E\u52A0\u514D\u8D39\u3001\u65F6\u95F4\u3001\u6548\u679C\u3001\u6743\u9650\u6216\u6267\u884C\u627F\u8BFA\u3002\n\u8FD9\u662F\u7ED9\u9500\u552E\u4EBA\u5DE5\u5BA1\u6838\u7684\u8349\u7A3F\u3002\u5148\u6309response_contract\u56DE\u7B54\u80FD\u786E\u8BA4\u7684\u90E8\u5206\uFF1B\u4E0D\u6E05\u695A\u7684\u5177\u4F53\u7EC6\u8282\u76F4\u63A5\u8BF4\u6682\u4E0D\u80FD\u786E\u8BA4\u3002\u53EF\u7ED9\u660E\u786E\u6807\u4E3A\u5EFA\u8BAE\u7684\u9009\u578B\u601D\u8DEF\u3001\u5BF9\u7167\u7EF4\u5EA6\u6216\u53EA\u8BFB\u6838\u9A8C\u65B9\u6CD5\uFF0C\u4E0D\u9700\u8981\u8F6F\u4EF6\u5165\u53E3\u6216\u4EA7\u54C1\u80FD\u529B\u624D\u80FD\u6210\u7ACB\u3002\u6CA1\u6709\u53EF\u9760\u5EFA\u8BAE\uFF0C\u7B80\u77ED\u8BF4\u660E\u8FD8\u7F3A\u4EC0\u4E48\u4FE1\u606F\u4E5F\u53EF\u4EA4\u7A3F\u3002\u4E0D\u80FD\u628A\u6709\u5F85\u786E\u8BA4\u7684\u80FD\u529B\u6539\u6210\u201C\u5982\u679C\u53EF\u4EE5\u201D\u518D\u7ED9\u5177\u4F53\u865A\u6784\u6B65\u9AA4\u3002\n\u5BA2\u6237\u63D0\u51FA\u987E\u8651\u65F6\uFF0C\u56DE\u7B54\u8981\u843D\u5230\u8FD9\u4E2A\u987E\u8651\u7684\u5224\u65AD\u4F9D\u636E\uFF1A\u4F8B\u5982\u62C5\u5FC3\u91CD\u590D\u8BB0\u5F55\u5C31\u8BF4\u660E\u5F53\u524D\u8D44\u6599\u80FD\u786E\u8BA4\u7684\u8BB0\u5F55\u4E0E\u6838\u5BF9\u5173\u7CFB\uFF0C\u62C5\u5FC3\u8868\u683C\u5207\u6362\u5C31\u6309\u5176\u5DF2\u77E5\u4E1A\u52A1\u6BD4\u8F83\uFF0C\u62C5\u5FC3\u5458\u5DE5\u80FD\u770B\u5230\u4EC0\u4E48\u5C31\u533A\u5206\u6240\u9700\u804C\u8D23\u4E0E\u5C1A\u672A\u6838\u5B9E\u7684\u6743\u9650\u3002\u4E0D\u80FD\u62FF\u4E00\u4EFD\u901A\u7528\u529F\u80FD\u4ECB\u7ECD\u4EE3\u66FF\u5F53\u524D\u95EE\u9898\uFF1B\u4E0D\u628A\u5BA2\u6237\u4E3B\u89C2\u8BC4\u4EF7\u6539\u5199\u4E3A\u5176\u4E60\u60EF\u3001\u5DF2\u53D1\u751F\u635F\u5931\u6216\u5176\u4ED6\u4EBA\u7684\u8BA4\u53EF\u3002\n\u6B63\u6587\u7B2C\u4E00\u53E5\u5C31\u63A5\u5177\u4F53\u95EE\u9898\u3002\u6709\u4E24\u4E09\u4E2A\u64CD\u4F5C\u70B9\u65F6\uFF0C\u6309\u5B9E\u9645\u987A\u5E8F\u9010\u70B9\u7ED9\u5165\u53E3\u3001\u52A8\u4F5C\u548C\u600E\u4E48\u6838\u5BF9\uFF0C\u4E0D\u5148\u590D\u8FF0\u9700\u6C42\u3002\u80FD\u7528\u4E00\u53E5\u8BF4\u6E05\u5C31\u4E00\u53E5\uFF0C\u591A\u4E2A\u72EC\u7ACB\u95EE\u9898\u53EF\u5206\u884C\u3002\u53EA\u6709\u7F3A\u7684\u90A3\u9879\u8BF4\u6682\u4E0D\u80FD\u786E\u8BA4\uFF1B\u4F8B\u5982\u8D44\u6599\u53EA\u8BC1\u660E\u67D0\u4E00\u7248\u672C\u65F6\uFF0C\u76F4\u63A5\u4EE5\u201C\u5982\u679C\u4F60\u7528\u7684\u662F\u8BE5\u7248\u672C\u201D\u7ED9\u8BE5\u7248\u6B65\u9AA4\u3002\n\u5BA2\u6237\u6CA1\u6709\u8981\u6C42\u4E0B\u4E00\u6B65\u65F6\uFF0C\u4E0D\u7528\u5728\u5FAE\u4FE1\u672B\u5C3E\u8865\u8FFD\u95EE\u3001\u9080\u7EA6\u3001\u518D\u603B\u7ED3\u6216\u201C\u6709\u95EE\u9898\u968F\u65F6\u627E\u6211\u201D\u3002\u5982\u679C\u95EE\u7684\u662F\u600E\u4E48\u505A\uFF0C\u53EF\u4EE5\u76F4\u63A5\u8BF4\u8981\u5BF9\u7167\u7684\u5B57\u6BB5\u6216\u770B\u54EA\u9875\u3002\u5DF2\u6709\u6750\u6599\u73B0\u5728\u7ED9\uFF1B\u53EA\u6709\u7F3A\u5931\u6761\u4EF6\u4F1A\u6539\u53D8\u7B54\u6848\u65F6\u624D\u8865\u95EE\uFF0C\u522B\u91CD\u95EE\u5BA2\u6237\u5DF2\u7ED9\u7684\u4FE1\u606F\u3002\n\u8D44\u6599\u4E0D\u8DB3\u65F6\u4ECD\u53EF\u7ED9\u4EBA\u5DE5\u53EA\u8BFB\u6838\u5BF9\u601D\u8DEF\uFF0C\u660E\u786E\u662F\u7BA1\u7406\u5EFA\u8BAE\uFF1A\u6309\u5BA2\u6237\u624B\u5934\u80FD\u53D6\u5F97\u7684\u673A\u5668\u552F\u4E00\u6807\u8BC6\u3001\u539F\u59CB\u51ED\u636E\uFF0C\u5206\u6E05\u8D27\u7269\u6D41\u5411\u3001\u7EA6\u5B9A\u91D1\u989D\u4E0E\u5B9E\u9645\u6536\u4ED8\uFF1B\u7F3A\u9879\u5148\u7559\u7A7A\u3002\u4E0D\u628A\u5EFA\u8BAE\u5199\u6210\u8F6F\u4EF6\u5177\u5907\u67D0\u5B57\u6BB5\u3001\u53EF\u6539\u5355\u3001\u81EA\u52A8\u53BB\u91CD\u6216\u786E\u5B9A\u7684\u4F1A\u8BA1\u5904\u7406\u89C4\u5219\u3002\u4E0D\u58F0\u79F0\u5BA2\u6237\u5DF2\u7ECF\u6709\u8FD9\u4E9B\u8BB0\u5F55\u3002\u672A\u77E5\u8F6F\u4EF6\u7EC6\u8282\u53EA\u6838\u5BF9\u5E94\u9879\uFF0C\u4E0D\u8BA9\u6574\u4EFD\u7B54\u590D\u53D8\u6210\u5F85\u6838\u3002\n\u5F53\u524D\u6D88\u606F\u6216\u8D44\u6599\u6CA1\u5217\u5177\u4F53\u6570\u5B57\u3001\u6743\u9650\u3001\u8BB0\u5F55\uFF0C\u53EA\u8BF4\u660E\u5F53\u524D\u63D0\u4F9B\u8303\u56F4\u6CA1\u6709\u8BE5\u7EC6\u8282\uFF0C\u4E0D\u80FD\u5199\u201C\u4ECE\u672A\u8C08\u8FC7\u3001\u5C1A\u672A\u5F00\u901A\u3001\u672A\u53D1\u751F\u4ED8\u6B3E\u3001\u4E0D\u7B97\u8BD5\u7528\u201D\u7B49\u4E1A\u52A1\u72B6\u6001\u5426\u5B9A\u3002\u5BA2\u6237\u8BF4\u53D1\u8FC7\u6587\u4EF6\uFF0C\u4E0D\u7B49\u4E8E\u672C\u8F6E\u8F93\u5165\u5DF2\u5305\u542B\u6587\u4EF6\u6B63\u6587\uFF1B\u53EA\u6709\u4E00\u53E5\u201C\u53D1\u8FC7\u4E86\u201D\u65F6\uFF0C\u522B\u8BF4\u201C\u6211\u8FD9\u91CC\u6709\u4E86/\u5DF2\u770B\u8FC7\u201D\uFF0C\u4E5F\u4E0D\u7F16\u5177\u4F53\u7F3A\u9879\u3002\u53EF\u4EE5\u63A5\u201C\u4E0D\u7528\u91CD\u586B\uFF0C\u5149\u51ED\u8FD9\u53E5\u8FD8\u770B\u4E0D\u51FA\u5355\u5B50\u54EA\u513F\u5BF9\u4E0D\u4E0A\u201D\uFF0C\u8BF4\u660E\u5F53\u524D\u771F\u6B63\u7F3A\u7684\u662F\u6750\u6599\u5185\u5BB9\uFF0C\u4E0D\u8BA9\u5BA2\u6237\u91CD\u65B0\u9010\u9879\u53E3\u8FF0\uFF1B\u5DF2\u6709\u6750\u6599\u5185\u5BB9\u65F6\u5219\u76F4\u63A5\u636E\u6B64\u6838\u5BF9\u3002\u5F53\u524D\u53EA\u662F\u54A8\u8BE2\u4E0D\u7B49\u4E8E\u4EE5\u524D\u6CA1\u6709\u8BD5\u7528\uFF1B\u5BA2\u6237\u5DF2\u8BF4\u8C08\u5B9A\u53EF\u627F\u63A5\u786E\u8BA4\u5355\uFF0C\u7F3A\u7684\u5177\u4F53\u6761\u6B3E\u8BF7\u5176\u8865\u5145\u6216\u5411\u516C\u53F8\u6838\u5B9E\u3002\nprevious_progress.pending\u4ECD\u672A\u53D6\u5F97\u65B0\u4F9D\u636E\u65F6\uFF0C\u4E0D\u518D\u6362\u53E5\u8BDD\u627F\u8BFA\u6838\u5B9E\uFF1B\u5BA2\u6237\u8BF4\u7B49\u5F85\u5C31\u786E\u8BA4\u7B49\u7ED3\u679C\uFF0C\u6709\u65B0\u7684\u95EE\u9898\u76F4\u63A5\u63A5\u3002calculation\u662F\u7A0B\u5E8F\u6838\u7B97\uFF0C\u5148\u770Bmode\u548C\u8303\u56F4\uFF0C\u4E0D\u80FD\u628A\u670D\u52A1\u8D39\u5C0F\u8BA1\u6216\u5047\u8BBE\u7B97\u5F0F\u8BB2\u6210\u771F\u5B9E\u7ED3\u6E05\u3002\u5BA2\u6237\u63D0\u8BAE\u3001\u53CC\u65B9\u786E\u8BA4\u3001\u5B9E\u9645\u6267\u884C\u5206\u5F00\u3002\n\u672C\u8F6E\u53EA\u8BFB\u6240\u7ED9\u6280\u80FD\u4E0E\u8BC1\u636E\uFF0C\u4E0D\u8C03\u7528\u5DE5\u5177\u3001\u4E0D\u91CD\u65B0\u53D6CRM\u3002\u6570\u636E\u8303\u56F4\u4E3Aanonymized-only\u65F6\uFF0C\u53EA\u7528\u516C\u53F8\u6216\u5BA2\u6237\u81EA\u613F\u63D0\u4F9B\u7684\u8131\u654F\u6750\u6599\uFF0C\u4E0D\u7D22\u771F\u8D26\u6216\u5BA2\u6237\u8D26\u53F7\u3002\u5DF2\u6709calculation\u65F6\u7528{{QUOTE}}\u5360\u4F4D\u4E00\u6B21\uFF0C\u4E0D\u53E6\u7B97\u3002{{QUOTE}}\u4EE3\u8868\u5B8C\u6574\u6838\u7B97\u6BB5\u843D\uFF0C\u4E0D\u662F\u4E00\u4E2A\u91D1\u989D\uFF0C\u5FC5\u987B\u72EC\u7ACB\u6210\u6BB5\uFF1B\u4E0D\u8981\u5199\u6210\u201C\u6302\u724C\u81F3\u5C11{{QUOTE}}\u201D\u6216\u5728\u5360\u4F4D\u524D\u540E\u91CD\u590D\u91D1\u989D\u3001\u7B97\u5F0F\u3001\u8D39\u7528\u6761\u4EF6\u3002numericBinding\u4E3Aquote_only\u65F6\uFF0C\u6240\u6709\u672C\u6B21\u6838\u7B97\u6570\u5B57\u53EA\u5728\u8BE5\u6BB5\uFF0C\u7531\u7A0B\u5E8F\u5199\u5165\u3002no_send\u4E25\u683C\u6309\u5BBF\u4E3B\u5DF2\u9A8C\u8BC1\u7684action\uFF1A\u53EA\u6709stop\u624Dtrue\u4E14wechat\u7559\u7A7A\uFF1B\u5176\u4ED6action\u5747false\u5E76\u5199\u6709\u6548\u6B63\u6587\u3002paused\u662F\u6682\u505C\u91C7\u8D2D\uFF0C\u4E0D\u7B49\u4E8E\u7981\u6B62\u56DE\u5E94\uFF1B\u672C\u8F6Eplan\u9009answer\u65F6\uFF0C\u7B80\u5355\u63A5\u4F4F\u5373\u53EF\uFF0C\u4E0D\u7528\u91CD\u8BB2\u65E7\u6761\u4EF6\u3002\nDATA\n" + JSON.stringify({ turn_packet: packet });
11673
11765
  }
11674
11766
  async function generateReply(rpc, workspaceId, contact, latest, signal, options = {}) {
11675
11767
  if (!workspaceId.trim()) throw new Error("\u8BF7\u5148\u9009\u62E9\u5B89\u88C5\u4E86\u9500\u552E\u6280\u80FD\u7684\u5DE5\u4F5C\u533A\u3002");
@@ -11871,7 +11963,7 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
11871
11963
  const catalogObservation = catalogMaterialObservation(material);
11872
11964
  if (catalogObservation) packet = { ...packet, sources: { ...packet.sources, MC0: { authority: "retrieval_observation", text: "Host\u6838\u9A8C\u7684\u5BA2\u6237\u7D20\u6750\u4E0E\u6700\u7EC8\u8349\u7A3F\u9644\u4EF6\u72B6\u6001\uFF1A" + JSON.stringify(catalogObservation) + "\u3002matched\u8868\u793A\u7CFB\u7EDF\u5C06\u5728\u6B63\u6587\u540E\u8FFD\u52A0\u8FD9\u91CC\u7684\u5DF2\u6838\u7D20\u6750\uFF0C\u4E0D\u4EE3\u8868\u5DF2\u901A\u8FC7\u5FAE\u4FE1\u53D1\u9001\uFF0C\u4E5F\u4E0D\u8BC1\u660E\u8D44\u6599\u91CC\u63D0\u5230\u7684\u529F\u80FD\u6216\u653F\u7B56\u5F53\u524D\u751F\u6548\u3002" } } };
11873
11965
  const company = packet.current_company_facts.map(({ source_id, ...fact }) => fact);
11874
- let plan, planFeedback = "";
11966
+ let plan, recoveredPlan, planFeedback = "";
11875
11967
  progress("planning");
11876
11968
  for (let attempt = 0; attempt < 2; attempt++) {
11877
11969
  const text4 = await turn(sessionId, buildTurnPlanPrompt(contact, latest, knowledge.contextId, packet) + planFeedback);
@@ -11881,8 +11973,13 @@ async function generateReply(rpc, workspaceId, contact, latest, signal, options
11881
11973
  } catch (error) {
11882
11974
  signal.throwIfAborted();
11883
11975
  planFeedback = buildTurnPlanCorrection(error);
11976
+ if (contact.wechat) try {
11977
+ recoveredPlan = parseTurnPlan(text4, contact, latest, packet, true);
11978
+ } catch {
11979
+ }
11884
11980
  }
11885
11981
  }
11982
+ plan ??= recoveredPlan;
11886
11983
  if (!plan) throw new Error("\u8FD8\u6CA1\u7406\u6E05\u8FD9\u8F6E\u5BA2\u6237\u7684\u9700\u6C42\uFF0C\u672C\u6B21\u672A\u751F\u6210\u8349\u7A3F\u3002");
11887
11984
  let materials = null;
11888
11985
  if (plan.material_need && !catalogMaterial) {
@@ -12333,7 +12430,7 @@ function mountSales(ctx, Page, Icon) {
12333
12430
  store.reset();
12334
12431
  restores.clear();
12335
12432
  if (ws) for (const c of contacts.filter((c2) => !c2.crm && !c2.wechat)) void journal.reset(ws, c).catch((e) => store.dispatch({ type: "history-error", id: c.id, error: e.message }));
12336
- }, back: () => ctx.layout.selectPanel(null) })
12433
+ } })
12337
12434
  }, Page));
12338
12435
  ctx.slots.inject("sidebar.panellist", () => ctx.slots.register({
12339
12436
  name: "sidebar.panellist",
@@ -12350,26 +12447,30 @@ function mountSales(ctx, Page, Icon) {
12350
12447
 
12351
12448
  // src/intent-styles.ts
12352
12449
  var intentCss = `
12353
- .ws-intent-sortline { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; margin-bottom:13px; }
12354
- .ws-intent-sortline .ws-section-title { margin:0; }
12355
- .ws-intent-sort { min-width:0; max-width:100%; color:var(--ws-ink); background:var(--ws-bg); border:1px solid var(--ws-line); border-radius:7px; padding:5px 7px; font-size:11px; }
12450
+ .ws-intent-sortline { display:flex; align-items:center; justify-content:space-between; gap:6px; min-height:28px; margin-bottom:10px; }
12451
+ .ws-intent-sortline h2 { min-width:0; font-size:13px; overflow-wrap:anywhere; }
12452
+ .ws-intent-sort-control { position:relative; min-width:0; max-width:58%; }
12453
+ .ws-intent-sort-control > svg { position:absolute; inset-inline-end:3px; top:50%; transform:translateY(-50%) rotate(90deg); pointer-events:none; color:var(--ws-muted); }
12454
+ .ws-intent-sort { appearance:none; field-sizing:content; max-width:100%; min-height:28px; text-align:end; padding:3px 19px 3px 5px; border:0; border-radius:5px; color:var(--ws-muted); background:transparent; font-size:11px; cursor:pointer; }
12455
+ .ws-intent-sort:hover { background:var(--ws-soft); }
12456
+ .ws-intent-sort option { color:var(--ws-ink); background:var(--ws-bg); }
12356
12457
  .ws-intent-badge { display:inline-flex; justify-content:center; align-items:center; width:max-content; white-space:nowrap; border:1px solid var(--ws-line); border-radius:6px; padding:1px 5px; font-size:10px; font-weight:600; color:var(--ws-muted); }
12357
12458
  .ws-intent-badge[data-grade] { color:var(--ws-ink); background:var(--ws-soft); }
12358
12459
  .ws-intent-badge[data-grade="A"] { border-color:currentColor; }
12359
12460
  .ws-contact-content > .ws-intent-badge { grid-column:2; grid-row:2; align-self:center; line-height:14px; }
12360
- .ws-intent-sort:focus-visible, .ws-intent-details summary:focus-visible { outline:2px solid var(--ws-accent); outline-offset:2px; }
12361
- .ws-person-title .ws-intent-title { display:flex; align-items:center; flex-wrap:wrap; gap:4px 8px; }
12362
- .ws-person-title .ws-intent-title h2 { min-width:0; overflow-wrap:anywhere; }
12461
+ .ws-intent-sort:focus-visible { outline:2px solid var(--ws-accent); outline-offset:2px; }
12363
12462
  .ws-intent-details { position:relative; flex:none; margin:0; font-size:11px; }
12364
- .ws-intent-details summary { cursor:pointer; display:flex; align-items:center; gap:4px; color:var(--ws-muted); }
12365
- .ws-intent-details summary::after { content:"\u25BE"; font-size:10px; }
12366
- .ws-intent-details[open] summary::after { content:"\u25B4"; }
12367
- .ws-intent-panel { position:absolute; inset-inline-start:0; top:calc(100% + 7px); z-index:6; width:min(310px,66vw); max-height:52vh; overflow:auto; box-sizing:border-box; background:var(--ws-bg); color:var(--ws-ink); border:1px solid var(--ws-line); border-radius:9px; padding:11px 13px; box-shadow:0 6px 20px #0002; }
12463
+ .ws-intent-details > .ws-intent-trigger { display:flex; align-items:center; gap:4px; min-height:21px; padding:0 2px; border:0; background:none; color:var(--ws-muted); white-space:nowrap; user-select:none; -webkit-tap-highlight-color:transparent; }
12464
+ .ws-intent-trigger:hover .ws-intent-value, .ws-intent-trigger[aria-expanded=true] .ws-intent-value { text-decoration:underline; text-underline-offset:2px; }
12465
+ .ws-intent-value { color:var(--ws-ink); font-weight:600; }
12466
+ .ws-intent-popover { position:absolute; inset-inline-start:0; top:100%; z-index:6; width:min(310px,66vw); padding-top:5px; }
12467
+ .ws-intent-panel { max-height:52vh; overflow:auto; background:var(--ws-bg); color:var(--ws-ink); border:1px solid var(--ws-line); border-radius:9px; padding:11px 13px; box-shadow:0 6px 20px #0002; }
12368
12468
  .ws-intent-panel dl, .ws-intent-panel dd { margin:0; }
12369
12469
  .ws-intent-panel dt { margin-top:9px; font-weight:650; }
12370
12470
  .ws-intent-panel blockquote { margin:3px 0 0; white-space:normal; overflow-wrap:anywhere; color:var(--ws-muted); }
12371
12471
  .ws-intent-panel > p { display:block; white-space:normal; margin:0 0 5px; }
12372
- @media(max-width:640px){ .ws-intent-panel { position:fixed; inset:30vh 12px auto; width:auto; max-height:54vh; } }
12472
+ @container(max-width:760px){ .ws-person-meta { position:relative; } .ws-intent-details { position:static; } .ws-intent-popover { width:min(310px,100%); } }
12473
+ @media(max-width:640px) and (hover:none){ .ws-intent-popover { position:fixed; inset:30vh 12px auto; width:auto; padding:0; } .ws-intent-panel { max-height:54vh; } }
12373
12474
  `;
12374
12475
 
12375
12476
  // src/reply-styles.ts
@@ -12381,12 +12482,13 @@ var replyStyles = `
12381
12482
  .ws-reply-editor-bar [role=tab]{border:0;border-radius:5px;background:transparent;color:var(--ws-muted);padding:5px 11px;font-size:12px;cursor:pointer}
12382
12483
  .ws-reply-editor-bar [role=tab][aria-selected=true]{background:var(--ws-bg);color:var(--ws-ink);box-shadow:0 1px 3px rgb(0 0 0 / .06)}
12383
12484
  .ws-reply-editor-bar>small{color:var(--ws-muted);font-size:10px}
12384
- .ws-reply-editor-body{min-height:110px;max-height:clamp(120px,34vh,300px);overflow:auto;padding:12px 13px;scrollbar-gutter:stable}
12485
+ .ws-reply-editor-body{height:110px;overflow:auto;padding:12px 13px;scrollbar-gutter:stable}
12385
12486
  .ws-reply-editor-body:focus-visible{outline:2px solid var(--ws-accent);outline-offset:-3px}
12386
- .ws-reply-editor-body .ws-editor{padding:0;border:0;background:none}
12387
- .ws-reply-editor-body textarea{height:130px;min-height:100px;max-height:250px;resize:vertical}
12388
- .ws-reply-empty{font-size:12px;color:var(--ws-muted)}
12389
- .ws-reply-markdown{font-size:12px;line-height:1.8;overflow-wrap:anywhere;color:var(--ws-ink)}
12487
+ .ws-reply-editor-body .ws-editor{height:100%;padding:0;border:0;background:none}
12488
+ .ws-reply-editor-body .ws-editor textarea{height:100%;min-height:0;max-height:none;padding:0;resize:none}
12489
+ .ws-reply-editor-body .ws-editor textarea,.ws-reply-empty,.ws-reply-markdown{font-size:12px;line-height:1.8}
12490
+ .ws-reply-editor-body .ws-editor textarea::placeholder,.ws-reply-empty{color:var(--ws-muted);opacity:1}
12491
+ .ws-reply-markdown{overflow-wrap:anywhere;color:var(--ws-ink)}
12390
12492
  .ws-reply-markdown p{margin:0 0 .6em;white-space:pre-wrap}.ws-reply-markdown p:last-child{margin-bottom:0}
12391
12493
  .ws-reply-markdown h1,.ws-reply-markdown h2,.ws-reply-markdown h3,.ws-reply-markdown h4,.ws-reply-markdown h5,.ws-reply-markdown h6{font-size:1.12em;margin:.8em 0 .4em;line-height:1.5}
12392
12494
  .ws-reply-markdown>:first-child{margin-top:0}.ws-reply-markdown ol,.ws-reply-markdown ul{padding-left:1.7em;margin:.4em 0}.ws-reply-markdown li{padding-left:.15em}.ws-reply-markdown li>p{margin:0}
@@ -12407,15 +12509,17 @@ var replyStyles = `
12407
12509
  // src/wechat/media-styles.ts
12408
12510
  var mediaStyles = `
12409
12511
  .ws-avatar-image{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
12512
+ .ws-native-media video{display:block;width:320px;max-width:100%;max-height:320px;border-radius:7px;background:#111}
12513
+ .ws-page .ws-video-load{background:var(--ws-bg);color:var(--ws-ink)}
12410
12514
 
12411
12515
  .ws-image-trigger{display:block;padding:0;max-width:100%;border:0;border-radius:7px;background:transparent;cursor:zoom-in!important}
12412
12516
  .ws-image-trigger:focus-visible,.ws-voice-button:focus-visible{outline:2px solid var(--ws-accent);outline-offset:3px}
12413
12517
  .ws-native-media .ws-image-dialog{--ws-preview-top:max(40px,env(safe-area-inset-top,0px),var(--dsh-windows-titlebar-height,env(titlebar-area-height,0px)));position:fixed;inset:calc(var(--ws-preview-top) + 24px) 24px 24px;width:min(1080px,calc(100vw - 48px));height:min(760px,calc(100dvh - var(--ws-preview-top) - 48px));max-width:none;max-height:none;margin:auto;padding:0;border:1px solid var(--ws-line,#dfe1e4);border-radius:12px;background:var(--ws-bg,#fff);color:var(--ws-ink,#111315);overflow:hidden;box-shadow:0 20px 80px #00000040;box-sizing:border-box;-webkit-app-region:no-drag}
12414
12518
  .ws-image-dialog::backdrop{background:rgba(9,12,16,.58)}
12415
12519
  .ws-native-media .ws-image-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr)}
12416
- .ws-image-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px 10px 16px;border-bottom:1px solid var(--ws-line);min-width:0}.ws-image-toolbar>strong{font-size:13px;white-space:nowrap}.ws-image-tools{display:flex;align-items:center;gap:4px;min-width:0}.ws-image-tools button{display:grid;place-items:center;min-width:30px;height:32px;padding:0 7px;border:0;border-radius:6px;background:transparent;color:inherit;font-size:20px;line-height:1;white-space:nowrap}.ws-image-tools button:hover:not(:disabled){background:var(--ws-soft)}.ws-image-tools button:focus-visible{outline:2px solid var(--ws-accent);outline-offset:2px}.ws-image-tools button:disabled{opacity:.35}.ws-image-tools .ws-image-fit{font-size:12px;min-width:66px;margin-inline:4px}.ws-image-scale{min-width:40px;text-align:center;font-size:11px;color:var(--ws-muted);font-variant-numeric:tabular-nums}.ws-image-tools .ws-image-close{font-size:25px;margin-left:4px;border-left:1px solid var(--ws-line);border-radius:0 5px 5px 0}
12520
+ .ws-image-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px 10px 16px;border-bottom:1px solid var(--ws-line);min-width:0}.ws-image-toolbar>strong{font-size:13px;white-space:nowrap}.ws-image-tools{display:flex;align-items:center;gap:4px;min-width:0}.ws-image-tools button{display:grid;place-items:center;min-width:30px;height:32px;padding:0 7px;border:0;border-radius:6px;background:transparent;color:inherit;font-size:20px;line-height:1;white-space:nowrap}.ws-image-tools button:hover:not(:disabled){background:var(--ws-soft)}.ws-image-tools button:focus-visible{outline:2px solid var(--ws-accent);outline-offset:2px}.ws-image-tools button:disabled{opacity:.35}.ws-image-tools .ws-image-fit{font-size:12px;min-width:66px;margin-inline:4px}.ws-image-tools .ws-image-scale{min-width:40px;padding:0 3px;font-size:11px;color:var(--ws-muted);font-variant-numeric:tabular-nums}.ws-image-tools .ws-image-close{font-size:25px;margin-left:4px;border-left:1px solid var(--ws-line);border-radius:0 5px 5px 0}
12417
12521
  .ws-image-canvas{min-height:0;min-width:0;overflow:auto;overscroll-behavior:contain;background:var(--ws-soft);scrollbar-width:thin}.ws-image-stage{display:flex;align-items:center;justify-content:center;width:max-content;height:max-content;min-width:100%;min-height:100%;padding:16px;box-sizing:border-box}.ws-native-media .ws-image-dialog img{display:block;flex:none;max-width:none;max-height:none;border-radius:2px;user-select:none;object-fit:contain}
12418
- @media(max-width:600px){.ws-native-media .ws-image-dialog{inset:calc(var(--ws-preview-top) + 12px) 12px 12px;width:calc(100vw - 24px);height:min(760px,calc(100dvh - var(--ws-preview-top) - 24px));border-radius:10px}.ws-image-toolbar{gap:6px;padding:8px}.ws-image-toolbar>strong{font-size:12px}.ws-image-tools{gap:1px}.ws-image-tools .ws-image-fit{min-width:60px;margin-inline:1px}.ws-image-tools .ws-image-close{margin-left:1px}.ws-image-scale{min-width:32px}}
12522
+ @media(max-width:600px){.ws-native-media .ws-image-dialog{inset:calc(var(--ws-preview-top) + 12px) 12px 12px;width:calc(100vw - 24px);height:min(760px,calc(100dvh - var(--ws-preview-top) - 24px));border-radius:10px}.ws-image-toolbar{gap:6px;padding:8px}.ws-image-toolbar>strong{font-size:12px}.ws-image-tools{gap:1px}.ws-image-tools .ws-image-fit{min-width:60px;margin-inline:1px}.ws-image-tools .ws-image-close{margin-left:1px}.ws-image-tools .ws-image-scale{min-width:32px}}
12419
12523
  .ws-page .ws-bubble.ws-voice-bubble,.ws-bubble:has(>.ws-native-media:only-child .ws-voice-message){padding:0;border:0;background:transparent}
12420
12524
  .ws-voice-message{max-width:100%}.ws-native-media .ws-voice-message audio{display:none}
12421
12525
  .ws-page .ws-voice-button{display:flex;align-items:center;justify-content:space-between;gap:20px;max-width:100%;min-width:100px;min-height:42px;padding:8px 12px;border:1px solid var(--ws-line);border-radius:6px;background:color-mix(in srgb,var(--ws-ink) 7%,var(--ws-bg));color:var(--ws-ink);cursor:pointer;font-size:15px;line-height:24px}
@@ -12431,11 +12535,24 @@ var mediaStyles = `
12431
12535
  // src/styles.ts
12432
12536
  var styles = `
12433
12537
  .ws-page{--ws-line:var(--dsw-alias-border-l3);--ws-ink:var(--dsw-alias-label-primary);--ws-muted:var(--dsw-alias-label-tertiary);--ws-bg:var(--dsw-alias-bg-base);--ws-soft:var(--dsw-alias-bg-layer-1);--ws-hover:var(--dsw-alias-interactive-bg-hover);--ws-accent:var(--dsw-alias-brand-primary);display:flex;flex-direction:column;position:relative;height:100%;min-height:0;min-width:0;overflow:hidden;color:var(--ws-ink);background:var(--ws-bg);font-family:inherit;font-size:13px;line-height:1.6;container-type:inline-size}
12434
- .ws-page *{box-sizing:border-box}.ws-page button,.ws-page input,.ws-page textarea,.ws-dialog button{font:inherit}.ws-page h1,.ws-page h2,.ws-page h3,.ws-page p,.ws-page dl,.ws-page dd,.ws-dialog h2,.ws-dialog p{margin:0}.ws-page button,.ws-dialog button{cursor:pointer;color:inherit}.ws-page button:disabled{cursor:not-allowed;opacity:.42}.ws-page button:focus-visible,.ws-page input:focus-visible,.ws-page textarea:focus-visible,.ws-dialog button:focus-visible{outline:2px solid var(--ws-accent,var(--dsw-alias-brand-primary));outline-offset:3px}.ws-page svg,.ws-dialog svg{flex-shrink:0}.ws-page strong,.ws-page h1,.ws-page h2,.ws-page h3,.ws-dialog h2,.ws-dialog strong{font-weight:500}.ws-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:24px 28px 20px;padding-inline-start:max(28px,var(--dsh-frame-leading-clearance,0px));flex-shrink:0;-webkit-app-region:drag}.ws-header button{-webkit-app-region:no-drag}.ws-heading{display:flex;align-items:center;gap:12px}.ws-brand{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;color:var(--ws-accent);background:var(--ws-soft)}.ws-title-line{display:flex;align-items:center;gap:10px}.ws-title-line h1{font-size:20px;line-height:1.4}.ws-heading p{color:var(--ws-muted);font-size:12px;margin-top:3px}.ws-demo-label,.ws-example-badge{display:inline-flex;align-items:center;font-size:10px;line-height:18px;border:1px solid var(--ws-line);padding:0 6px;border-radius:4px;color:var(--ws-muted);white-space:nowrap}.ws-header-actions{display:flex;align-items:center;gap:14px}.ws-knowledge{display:flex;align-items:center;gap:6px;border:0;background:none;font-size:11px;color:var(--ws-muted)!important;white-space:nowrap}.ws-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:32px;padding:6px 11px;background:transparent;border:1px solid var(--ws-line);border-radius:7px;white-space:nowrap;font-size:12px!important}.ws-button:hover:not(:disabled){background:var(--ws-hover)}.ws-button.ws-primary{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground);border-color:transparent}.ws-button.ws-primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}.ws-icon-button{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:30px;height:30px;background:transparent;border:0;border-radius:6px}.ws-icon-button:hover{background:var(--ws-hover,var(--dsw-alias-interactive-bg-hover))}.ws-demo-note{display:flex;align-items:center;gap:8px;flex-shrink:0;padding:8px 28px;color:var(--ws-muted);background:var(--ws-soft);border-block:1px solid var(--ws-line);font-size:11px}.ws-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:currentColor;flex-shrink:0;opacity:.65}.ws-demo-note button{background:none;border:0;color:var(--ws-muted);white-space:nowrap;margin-left:auto;padding:0 0 0 12px;font-size:11px}.ws-demo-note button:hover{color:var(--ws-ink)}.ws-body{position:relative;display:grid;grid-template-columns:244px minmax(0,1fr) 264px;flex:1;min-height:0;overflow:hidden}.ws-contacts{display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--ws-line)}.ws-contacts-head{padding:22px 16px 14px}.ws-section-title{display:flex;align-items:center;gap:7px;margin-bottom:13px}.ws-section-title h2{font-size:13px}.ws-section-title>span{font-size:10px;color:var(--ws-muted);background:var(--ws-soft);padding:0 5px;border-radius:4px}.ws-section-title .ws-icon-button{margin-left:auto;width:24px;height:24px}.ws-search{display:flex;gap:7px;align-items:center;padding:7px 9px;border:1px solid var(--ws-line);border-radius:7px;color:var(--ws-muted);background:var(--ws-soft)}.ws-search:focus-within{border-color:var(--ws-accent)}.ws-search input{min-width:0;width:100%;border:0;background:none;color:var(--ws-ink);font-size:11px;line-height:20px;outline:none!important}.ws-search input::placeholder{color:var(--ws-muted)}.ws-filters{display:flex;gap:4px;margin-top:12px}.ws-filters button{display:flex;gap:5px;align-items:center;justify-content:center;flex:1;border:0;border-radius:6px;padding:5px 2px;background:none;color:var(--ws-muted);font-size:11px}.ws-filters button[aria-pressed=true]{background:var(--ws-soft);color:var(--ws-ink);font-weight:500}.ws-filters span{font-size:10px;font-variant-numeric:tabular-nums;opacity:.7}.ws-contact-list{overflow:auto;flex:1;padding:0 8px}.ws-contact{display:flex;align-items:center;gap:10px;width:100%;padding:14px 10px;border:0;border-radius:8px;margin-bottom:3px;background:none;text-align:left}.ws-contact:hover{background:var(--ws-hover)}.ws-contact.is-selected{background:var(--dsw-alias-interactive-bg-active)}.ws-avatar{display:grid;place-items:center;width:38px;height:38px;flex-shrink:0;border-radius:11px;background:var(--ws-soft);color:var(--dsw-alias-label-secondary);font-size:15px}.ws-contact.is-selected .ws-avatar{background:var(--ws-bg);color:var(--ws-accent)}.ws-contact-content{min-width:0;flex:1;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:22px 18px;column-gap:8px;row-gap:3px}.ws-contact-line{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:6px;line-height:20px}.ws-contact-line strong{font-size:13px}.ws-contact-line time{font-size:10px;color:var(--ws-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.ws-preview{grid-column:1;grid-row:2;display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:18px;margin:0}.ws-sync{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-top:1px solid var(--ws-line);color:var(--ws-muted);font-size:10px}.ws-sync>span{display:flex;align-items:center;gap:5px}.ws-text-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:none;border:0;padding:3px 0;color:var(--ws-muted)!important;font-size:11px!important}.ws-text-button:hover:not(:disabled){color:var(--ws-ink)!important}.ws-empty{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--ws-muted);padding:48px 10px;text-align:center;font-size:12px}.ws-conversation{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:auto}.ws-conversation-head{display:flex;align-items:center;gap:10px;padding:19px 24px;border-bottom:1px solid var(--ws-line);min-height:83px}.ws-person-title{min-width:0}.ws-person-title h2{display:flex;align-items:center;flex-wrap:wrap;gap:10px;font-size:16px}.ws-person-title h2>span{font-size:10px;color:var(--ws-muted);font-weight:400}.ws-person-title p{display:flex;gap:5px;align-items:center;color:var(--ws-muted);font-size:10px;margin-top:2px}.ws-separator{opacity:.5;margin:0 3px}.ws-conversation-actions{display:flex;align-items:center;gap:5px;margin-left:auto}.ws-handle{font-size:11px!important;min-height:28px;padding:4px 8px}.ws-messages{flex:1;min-height:100px;overflow:auto;padding:20px 24px 16px;scrollbar-gutter:stable}.ws-date{display:flex;align-items:center;justify-content:center;margin:0 0 24px;color:var(--ws-muted);font-size:10px}.ws-date span{background:var(--ws-soft);border-radius:5px;padding:1px 10px}.ws-message{display:flex;align-items:flex-start;gap:9px;margin-bottom:22px}.ws-message-avatar{width:30px;height:30px;border-radius:9px;font-size:12px}.ws-message-content{min-width:0;max-width:82%}.ws-message-meta{display:flex;gap:8px;align-items:center;margin-bottom:5px;color:var(--ws-muted);font-size:10px;line-height:14px}.ws-message-meta time{font-variant-numeric:tabular-nums}.ws-bubble{padding:10px 13px;border-radius:2px 10px 10px 10px;background:var(--ws-soft);font-size:12px;line-height:1.9;white-space:pre-wrap;overflow-wrap:anywhere}.ws-out{flex-direction:row-reverse}.ws-out .ws-message-meta{justify-content:flex-end}.ws-out .ws-bubble{background:var(--dsw-alias-interactive-bg-active);border-radius:10px 2px 10px 10px}.ws-out .ws-message-avatar{color:var(--ws-accent)}.ws-replies{flex-shrink:0;border-top:1px solid var(--ws-line);padding:15px 24px 0}.ws-reply-heading,.ws-reply-heading>div{display:flex;align-items:center;gap:7px}.ws-reply-heading{justify-content:space-between}.ws-reply-heading h3{font-size:12px}.ws-reply-heading>div>svg{color:var(--ws-accent)}.ws-candidates{display:flex;flex-wrap:wrap;gap:6px;margin:11px 0 10px}.ws-candidates button{border:1px solid var(--ws-line);border-radius:5px;background:none;padding:3px 9px;color:var(--ws-muted);font-size:11px}.ws-candidates button[aria-pressed=true]{color:var(--ws-accent);border-color:var(--ws-accent);background:var(--ws-soft)}.ws-editor{display:block;padding:10px 12px;background:var(--ws-soft);border:1px solid var(--ws-line);border-radius:8px}.ws-editor:focus-within{border-color:var(--ws-accent)}.ws-editor textarea{display:block;width:100%;height:82px;min-height:56px;resize:vertical;max-height:180px;border:0;background:none;color:var(--ws-ink);font-size:12px;line-height:1.9;outline:none!important}.ws-editor-footer{display:flex;align-items:center;gap:8px;margin-top:10px;flex-wrap:wrap}.ws-draft-note{display:flex;align-items:center;gap:5px;font-size:10px;color:var(--ws-muted)}.ws-char-count{margin-left:auto;color:var(--ws-muted);font-size:10px;white-space:nowrap}.ws-notice{font-size:10px;line-height:21px;min-height:24px;color:var(--ws-accent)}.ws-profile{display:flex;flex-direction:column;min-height:0;overflow:auto;border-left:1px solid var(--ws-line);background:var(--ws-bg)}.ws-profile-head{display:flex;align-items:center;justify-content:space-between;padding:22px 20px 0}.ws-profile-head h2{font-size:12px}.ws-profile-person{display:flex;flex-direction:column;align-items:center;padding:23px 20px 25px}.ws-profile-avatar{width:54px;height:54px;border-radius:16px;font-size:22px}.ws-profile-person h3{font-size:17px;margin-top:10px}.ws-profile-person>p{font-size:11px;color:var(--ws-muted);margin-top:2px}.ws-tags{display:flex;justify-content:center;flex-wrap:wrap;gap:5px;margin-top:14px}.ws-tags>span{font-size:10px;color:var(--ws-muted);background:var(--ws-soft);padding:2px 7px;border-radius:4px}.ws-profile-section{margin:0 20px;padding:18px 0;border-top:1px solid var(--ws-line)}.ws-profile-section>h3{font-size:11px;margin-bottom:13px}.ws-product{display:flex;align-items:center;gap:10px;padding:11px;background:var(--ws-soft);border-radius:7px}.ws-product>svg{color:var(--ws-accent)}.ws-product strong{font-size:11px}.ws-product p{color:var(--ws-muted);font-size:9px;margin-top:2px}.ws-budget{display:flex;align-items:center;justify-content:space-between;font-size:10px;margin-top:12px;gap:8px}.ws-budget>span{color:var(--ws-muted)}.ws-budget strong{font-size:11px}.ws-profile dl{display:flex;flex-direction:column;gap:15px}.ws-profile dt{color:var(--ws-muted);font-size:10px;margin-bottom:3px}.ws-profile dd{font-size:11px;line-height:1.8}.ws-profile-caption{margin-top:auto;display:flex;align-items:flex-start;gap:6px;color:var(--ws-muted);font-size:9px;padding:15px 20px}.ws-profile-toggle,.ws-profile-close,.ws-mobile-back{display:none}.ws-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
12538
+ .ws-page *{box-sizing:border-box}.ws-page button,.ws-page input,.ws-page textarea,.ws-dialog button{font:inherit}.ws-page h1,.ws-page h2,.ws-page h3,.ws-page p,.ws-page dl,.ws-page dd,.ws-dialog h2,.ws-dialog p{margin:0}.ws-page button,.ws-dialog button{cursor:pointer;color:inherit}.ws-page button:disabled{cursor:not-allowed;opacity:.42}.ws-page button:focus-visible,.ws-page input:focus-visible,.ws-page textarea:focus-visible,.ws-dialog button:focus-visible{outline:2px solid var(--ws-accent,var(--dsw-alias-brand-primary));outline-offset:3px}.ws-page svg,.ws-dialog svg{flex-shrink:0}.ws-page strong,.ws-page h1,.ws-page h2,.ws-page h3,.ws-dialog h2,.ws-dialog strong{font-weight:500}.ws-header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:24px 28px 20px;padding-inline-start:max(28px,var(--dsh-frame-leading-clearance,0px));flex-shrink:0;-webkit-app-region:drag}.ws-header button{-webkit-app-region:no-drag}.ws-heading{display:flex;align-items:center;gap:12px}.ws-brand{display:grid;place-items:center;width:40px;height:40px;border-radius:12px;color:var(--ws-accent);background:var(--ws-soft)}.ws-title-line{display:flex;align-items:center;gap:10px}.ws-title-line h1{font-size:20px;line-height:1.4}.ws-heading p{color:var(--ws-muted);font-size:12px;margin-top:3px}.ws-demo-label,.ws-example-badge{display:inline-flex;align-items:center;font-size:10px;line-height:18px;border:1px solid var(--ws-line);padding:0 6px;border-radius:4px;color:var(--ws-muted);white-space:nowrap}.ws-header-actions{display:flex;align-items:center;gap:14px}.ws-knowledge{display:flex;align-items:center;gap:6px;border:0;background:none;font-size:11px;color:var(--ws-muted)!important;white-space:nowrap}.ws-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:32px;padding:6px 11px;background:transparent;border:1px solid var(--ws-line);border-radius:7px;white-space:nowrap;font-size:12px!important}.ws-button:hover:not(:disabled){background:var(--ws-hover)}.ws-button.ws-primary{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-foreground);border-color:transparent}.ws-button.ws-primary:hover:not(:disabled){background:var(--dsw-alias-button-primary-hover)}.ws-icon-button{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:30px;height:30px;background:transparent;border:0;border-radius:6px}.ws-icon-button:hover{background:var(--ws-hover,var(--dsw-alias-interactive-bg-hover))}.ws-demo-note{display:flex;align-items:center;gap:8px;flex-shrink:0;padding:8px 28px;color:var(--ws-muted);background:var(--ws-soft);border-block:1px solid var(--ws-line);font-size:11px}.ws-dot{display:inline-block;width:5px;height:5px;border-radius:50%;background:currentColor;flex-shrink:0;opacity:.65}.ws-demo-note button{background:none;border:0;color:var(--ws-muted);white-space:nowrap;margin-left:auto;padding:0 0 0 12px;font-size:11px}.ws-demo-note button:hover{color:var(--ws-ink)}.ws-body{--ws-contacts-width:244px;position:relative;display:grid;grid-template-columns:var(--ws-contacts-width) minmax(0,1fr) 264px;flex:1;min-height:0;overflow:hidden}.ws-contacts{display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--ws-line)}.ws-contacts-head{padding:18px 16px 10px}.ws-search{display:flex;gap:7px;align-items:center;padding:6px 9px;border:1px solid transparent;border-radius:6px;color:var(--ws-muted);background:var(--ws-soft)}.ws-search:focus-within{border-color:var(--ws-accent)}.ws-search input{min-width:0;width:100%;border:0;background:none;color:var(--ws-ink);font-size:11px;line-height:20px;outline:none!important}.ws-search input::placeholder{color:var(--ws-muted)}
12539
+ .ws-filters{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin-top:6px;border-bottom:1px solid var(--ws-line)}
12540
+ .ws-filters button{position:relative;display:flex;flex-wrap:wrap;gap:0 4px;align-content:center;align-items:center;justify-content:center;min-width:0;min-height:36px;border:0;padding:4px 2px;background:none;color:var(--ws-muted);font-size:11px}
12541
+ .ws-filters button[aria-pressed=true]{color:var(--ws-ink);font-weight:600}
12542
+ .ws-filters button[aria-pressed=true]::after{content:"";position:absolute;inset-inline:10px;bottom:-1px;height:2px;border-radius:2px 2px 0 0;background:currentColor}
12543
+ .ws-filters span{font-size:10px;font-weight:400;font-variant-numeric:tabular-nums}
12544
+ @media(forced-colors:active){.ws-filters button[aria-pressed=true]::after{background:CanvasText}}
12545
+ .ws-contact-list{overflow:auto;flex:1;padding:0 8px}.ws-contact{display:flex;align-items:center;gap:10px;width:100%;padding:14px 10px;border:0;border-radius:8px;margin-bottom:3px;background:none;text-align:left}.ws-contact:hover{background:var(--ws-hover)}.ws-contact.is-selected{background:var(--dsw-alias-interactive-bg-active)}.ws-avatar{display:grid;place-items:center;width:38px;height:38px;flex-shrink:0;border-radius:11px;background:var(--ws-soft);color:var(--dsw-alias-label-secondary);font-size:15px}.ws-contact.is-selected .ws-avatar{background:var(--ws-bg);color:var(--ws-accent)}.ws-contact-content{min-width:0;flex:1;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:22px 18px;column-gap:8px;row-gap:3px}.ws-contact-line{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:6px;line-height:20px}.ws-contact-line strong{font-size:13px}.ws-contact-line time{font-size:10px;color:var(--ws-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.ws-preview{grid-column:1;grid-row:2;display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:18px;margin:0}.ws-sync{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-top:1px solid var(--ws-line);color:var(--ws-muted);font-size:10px}.ws-sync>span{display:flex;align-items:center;gap:5px}.ws-text-button{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:none;border:0;padding:3px 0;color:var(--ws-muted)!important;font-size:11px!important}.ws-text-button:hover:not(:disabled){color:var(--ws-ink)!important}.ws-empty{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--ws-muted);padding:48px 10px;text-align:center;font-size:12px}.ws-conversation{min-width:0;min-height:0;display:flex;flex-direction:column;overflow:auto}.ws-conversation-head{display:flex;align-items:center;gap:10px;padding:19px 24px;border-bottom:1px solid var(--ws-line);min-height:83px}.ws-person-title{flex:1;min-width:0}.ws-person-title h2{display:flex;align-items:center;flex-wrap:wrap;gap:10px;font-size:16px}.ws-person-title h2>span{font-size:10px;color:var(--ws-muted);font-weight:400}
12546
+ .ws-person-meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;margin-top:2px;color:var(--ws-muted);font-size:10px}
12547
+ .ws-person-source{display:inline-flex;flex-wrap:wrap;align-items:center;gap:5px;min-width:0}
12548
+ .ws-separator{opacity:.5;margin:0 3px}.ws-conversation-actions{display:flex;align-items:center;gap:5px;margin-left:auto}.ws-handle{font-size:11px!important;min-height:28px;padding:4px 8px}.ws-messages{flex:1;min-height:100px;overflow:auto;padding:20px 24px 16px;scrollbar-gutter:stable}.ws-date{display:flex;align-items:center;justify-content:center;margin:0 0 24px;color:var(--ws-muted);font-size:10px}.ws-date span{background:var(--ws-soft);border-radius:5px;padding:1px 10px}.ws-message{display:flex;align-items:flex-start;gap:9px;margin-bottom:22px}.ws-message-avatar{width:30px;height:30px;border-radius:9px;font-size:12px}.ws-message-content{min-width:0;max-width:82%}.ws-message-meta{display:flex;gap:8px;align-items:center;margin-bottom:5px;color:var(--ws-muted);font-size:10px;line-height:14px}.ws-message-meta time{font-variant-numeric:tabular-nums}.ws-bubble{padding:10px 13px;border-radius:2px 10px 10px 10px;background:var(--ws-soft);font-size:12px;line-height:1.9;white-space:pre-wrap;overflow-wrap:anywhere}.ws-out{flex-direction:row-reverse}.ws-out .ws-message-meta{justify-content:flex-end}.ws-out .ws-bubble{background:var(--dsw-alias-interactive-bg-active);border-radius:10px 2px 10px 10px}.ws-out .ws-message-avatar{color:var(--ws-accent)}.ws-replies{flex-shrink:0;border-top:1px solid var(--ws-line);padding:15px 24px 0}.ws-reply-heading,.ws-reply-heading>div{display:flex;align-items:center;gap:7px}.ws-reply-heading{justify-content:space-between}.ws-reply-heading h3{font-size:12px}.ws-reply-heading>div>svg{color:var(--ws-accent)}.ws-candidates{display:flex;flex-wrap:wrap;gap:6px;margin:11px 0 10px}.ws-candidates button{border:1px solid var(--ws-line);border-radius:5px;background:none;padding:3px 9px;color:var(--ws-muted);font-size:11px}.ws-candidates button[aria-pressed=true]{color:var(--ws-accent);border-color:var(--ws-accent);background:var(--ws-soft)}.ws-editor{display:block;padding:10px 12px;background:var(--ws-soft);border:1px solid var(--ws-line);border-radius:8px}.ws-editor:focus-within{border-color:var(--ws-accent)}.ws-editor textarea{display:block;width:100%;height:82px;min-height:56px;resize:vertical;max-height:180px;border:0;background:none;color:var(--ws-ink);font-size:12px;line-height:1.9;outline:none!important}.ws-editor-footer{display:flex;align-items:center;gap:8px;margin-top:10px;flex-wrap:wrap}.ws-draft-note{display:flex;align-items:center;gap:5px;font-size:10px;color:var(--ws-muted)}.ws-char-count{margin-left:auto;color:var(--ws-muted);font-size:10px;white-space:nowrap}.ws-notice{font-size:10px;line-height:21px;min-height:24px;color:var(--ws-accent)}.ws-profile{display:flex;flex-direction:column;min-height:0;overflow:auto;border-left:1px solid var(--ws-line);background:var(--ws-bg)}.ws-profile-head{display:flex;align-items:center;justify-content:space-between;padding:22px 20px 0}.ws-profile-head h2{font-size:12px}.ws-profile-person{display:flex;flex-direction:column;align-items:center;padding:23px 20px 25px}.ws-profile-avatar{width:54px;height:54px;border-radius:16px;font-size:22px}.ws-profile-person h3{font-size:17px;margin-top:10px}.ws-profile-person>p{font-size:11px;color:var(--ws-muted);margin-top:2px}.ws-tags{display:flex;justify-content:center;flex-wrap:wrap;gap:5px;margin-top:14px}.ws-tags>span{font-size:10px;color:var(--ws-muted);background:var(--ws-soft);padding:2px 7px;border-radius:4px}.ws-profile-section{margin:0 20px;padding:18px 0;border-top:1px solid var(--ws-line)}.ws-profile-section>h3{font-size:11px;margin-bottom:13px}.ws-product{display:flex;align-items:center;gap:10px;padding:11px;background:var(--ws-soft);border-radius:7px}.ws-product>svg{color:var(--ws-accent)}.ws-product strong{font-size:11px}.ws-product p{color:var(--ws-muted);font-size:9px;margin-top:2px}.ws-budget{display:flex;align-items:center;justify-content:space-between;font-size:10px;margin-top:12px;gap:8px}.ws-budget>span{color:var(--ws-muted)}.ws-budget strong{font-size:11px}.ws-profile dl{display:flex;flex-direction:column;gap:15px}.ws-profile dt{color:var(--ws-muted);font-size:10px;margin-bottom:3px}.ws-profile dd{font-size:11px;line-height:1.8}.ws-profile-caption{margin-top:auto;display:flex;align-items:flex-start;gap:6px;color:var(--ws-muted);font-size:9px;padding:15px 20px}.ws-profile-toggle,.ws-mobile-back{display:none}
12549
+ .ws-body[data-profile=closed]{grid-template-columns:var(--ws-contacts-width) minmax(0,1fr)}
12550
+ .ws-body[data-profile=closed]>.ws-profile{display:none}
12551
+ .ws-body[data-profile=closed] .ws-profile-toggle{display:inline-flex}.ws-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
12435
12552
  .ws-dialog{--ws-accent:var(--dsw-alias-brand-primary);width:min(500px,calc(100vw - 32px));padding:24px;border:1px solid var(--dsw-alias-border-l3);border-radius:14px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:inherit;font-size:13px;line-height:1.7}.ws-dialog::backdrop{background:var(--dsw-alias-bg-module-platform);opacity:.7}.ws-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.ws-dialog-head h2{font-size:17px}.ws-dialog-note{margin:12px 0 20px!important;color:var(--dsw-alias-label-tertiary);font-size:12px}.ws-connection{display:flex;align-items:center;gap:13px;padding:17px 0;border-top:1px solid var(--dsw-alias-border-l3)}.ws-connection>svg{color:var(--dsw-alias-label-tertiary)}.ws-connection>div{flex:1;min-width:0}.ws-connection strong{font-size:12px}.ws-connection p{font-size:11px;color:var(--dsw-alias-label-tertiary);margin-top:2px}.ws-state{font-size:10px;color:var(--dsw-alias-label-tertiary);white-space:nowrap}.ws-dialog-foot{display:flex;justify-content:flex-end;padding-top:16px}.ws-dialog .ws-button{border-color:var(--dsw-alias-border-l3)}
12436
- @container(max-width:1050px){.ws-body{grid-template-columns:230px minmax(0,1fr)}.ws-profile{display:none}.ws-profile-toggle{display:flex}.ws-body[data-profile=true]>.ws-profile{display:flex;position:absolute;inset:0 0 0 auto;width:272px;z-index:5;border-left:1px solid var(--ws-line)}.ws-profile-close{display:flex}.ws-header{padding:20px 22px;padding-inline-start:max(22px,var(--dsh-frame-leading-clearance,0px))}.ws-demo-note{padding-inline:22px}.ws-knowledge{font-size:10px}.ws-header-actions{gap:8px}}
12437
- @container(max-width:700px){.ws-body{grid-template-columns:210px minmax(0,1fr)}.ws-header{padding:17px 18px;padding-inline-start:max(18px,var(--dsh-frame-leading-clearance,0px))}.ws-heading p{display:none}.ws-title-line h1{font-size:18px}.ws-header-actions .ws-knowledge{display:none}.ws-demo-note{padding:8px 18px;font-size:10px}.ws-demo-note button{display:none}.ws-conversation-head{padding:16px}.ws-messages{padding:18px 16px}.ws-replies{padding:13px 16px 0}.ws-handle{font-size:0!important;gap:0;padding:4px 7px}.ws-handle svg{width:15px}.ws-draft-note{font-size:9px}.ws-char-count{display:none}}
12438
- @container(max-width:530px){.ws-body{display:flex}.ws-contacts{width:100%;border:0}.ws-conversation{display:none;width:100%}.ws-body[data-show-chat=true]>.ws-contacts{display:none}.ws-body[data-show-chat=true]>.ws-conversation{display:flex}.ws-mobile-back{display:flex}.ws-brand{display:none}.ws-header{padding:15px 16px;padding-inline-start:max(16px,var(--dsh-frame-leading-clearance,0px))}.ws-header-actions .ws-button{font-size:10px!important;padding:4px 7px}.ws-demo-note{align-items:flex-start}.ws-demo-note>.ws-dot{margin-top:6px}.ws-contact{padding:14px 12px}.ws-conversation-head{min-height:76px;padding:13px 12px;gap:7px}.ws-person-title h2{font-size:15px}.ws-person-title h2>span{display:none}.ws-editor textarea{height:96px}.ws-bubble{font-size:12px}.ws-message-content{max-width:85%}.ws-connection{align-items:flex-start}.ws-connection>svg{margin-top:3px}}
12553
+ @container(max-width:1050px){.ws-body{--ws-contacts-width:230px;grid-template-columns:var(--ws-contacts-width) minmax(0,1fr)}.ws-profile{display:none}.ws-profile-toggle{display:inline-flex}.ws-body[data-profile=open] .ws-profile-toggle{display:none}.ws-body[data-profile=open]>.ws-profile{display:flex;position:absolute;inset:0 0 0 auto;width:min(272px,100%);z-index:5}.ws-header{padding:20px 22px;padding-inline-start:max(22px,var(--dsh-frame-leading-clearance,0px))}.ws-demo-note{padding-inline:22px}.ws-knowledge{font-size:10px}.ws-header-actions{gap:8px}}
12554
+ @container(max-width:700px){.ws-body{--ws-contacts-width:210px}.ws-profile-toggle{width:30px;height:30px;padding:0;border-color:transparent}.ws-profile-toggle>span{display:none}.ws-header{padding:17px 18px;padding-inline-start:max(18px,var(--dsh-frame-leading-clearance,0px))}.ws-heading p{display:none}.ws-title-line h1{font-size:18px}.ws-header-actions .ws-knowledge{display:none}.ws-demo-note{padding:8px 18px;font-size:10px}.ws-demo-note button{display:none}.ws-conversation-head{padding:16px}.ws-messages{padding:18px 16px}.ws-replies{padding:13px 16px 0}.ws-handle{font-size:0!important;gap:0;padding:4px 7px}.ws-handle svg{width:15px}.ws-draft-note{font-size:9px}.ws-char-count{display:none}}
12555
+ @container(max-width:530px){.ws-body{display:flex}.ws-contacts{width:100%;border:0}.ws-conversation{display:none;width:100%}.ws-body[data-show-chat=true]>.ws-contacts{display:none}.ws-body[data-show-chat=true]>.ws-conversation{display:flex}.ws-body[data-show-chat=false][data-profile=open]>.ws-profile{display:none}.ws-mobile-back{display:flex}.ws-brand{display:none}.ws-header{padding:15px 16px;padding-inline-start:max(16px,var(--dsh-frame-leading-clearance,0px))}.ws-header-actions .ws-button{font-size:10px!important;padding:4px 7px}.ws-demo-note{align-items:flex-start}.ws-demo-note>.ws-dot{margin-top:6px}.ws-contact{padding:14px 12px}.ws-conversation-head{min-height:76px;padding:13px 12px;gap:7px}.ws-person-title h2{font-size:15px}.ws-person-title h2>span{display:none}.ws-editor textarea{height:96px}.ws-bubble{font-size:12px}.ws-message-content{max-width:85%}.ws-connection{align-items:flex-start}.ws-connection>svg{margin-top:3px}}
12439
12556
  @media(prefers-reduced-motion:reduce){.ws-page *{scroll-behavior:auto!important}}
12440
12557
 
12441
12558
  .ws-workspace,.ws-latest{display:flex;gap:8px;flex-direction:column;font-size:12px;color:var(--ws-muted);margin:8px 0}
@@ -12512,7 +12629,7 @@ function SalesIcon({ size = 18 }) {
12512
12629
  return /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chat", size });
12513
12630
  }
12514
12631
  var EMPTY_CONTACT = { id: "", name: "", initials: "", segment: "", time: "", preview: "", status: "pending", unread: 0, product: "", budget: "", moneyAmounts: [], tags: [], facts: [], messages: [], candidates: [] };
12515
- function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConversation, refreshWorkspaces, back, wechat, useWechat, setMode, bindWechat, useUpdate, updater, updateFormDirty, runDelivery }) {
12632
+ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConversation, refreshWorkspaces, wechat, useWechat, setMode, bindWechat, useUpdate, updater, updateFormDirty, runDelivery }) {
12516
12633
  const update = useUpdate?.((s) => s);
12517
12634
  const frozen = update?.preparing ?? false;
12518
12635
  const state = useSales((snapshot) => snapshot);
@@ -12530,7 +12647,14 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
12530
12647
  const [sort, setSort] = (0, import_react11.useState)("recent");
12531
12648
  const [filter, setFilter] = (0, import_react11.useState)("all");
12532
12649
  const [showChat, setShowChat] = (0, import_react11.useState)(false);
12533
- const [showProfile, setShowProfile] = (0, import_react11.useState)(false);
12650
+ const [profileVisibility, setProfileVisibility] = (0, import_react11.useState)("default");
12651
+ const profileId = (0, import_react11.useId)();
12652
+ const openProfileButton = (0, import_react11.useRef)(null);
12653
+ const closeProfileButton = (0, import_react11.useRef)(null);
12654
+ (0, import_react11.useEffect)(() => {
12655
+ if (profileVisibility === "open") closeProfileButton.current?.focus({ preventScroll: true });
12656
+ if (profileVisibility === "closed") openProfileButton.current?.focus({ preventScroll: true });
12657
+ }, [profileVisibility]);
12534
12658
  const [notice, setNotice] = (0, import_react11.useState)("");
12535
12659
  const [copyResult, setCopyResult] = (0, import_react11.useState)(null);
12536
12660
  const contact = state.contacts.find((c) => c.id === state.selectedId) ?? state.contacts[0] ?? EMPTY_CONTACT;
@@ -12693,13 +12817,13 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
12693
12817
  const syncProgress = presentation.blocked || view.status?.phase === "authorizing" ? void 0 : view.status?.progress;
12694
12818
  const syncPercent = wechatProgressPercent({ progress: syncProgress });
12695
12819
  const syncLabel = view.error ? "wxProgressUnavailable" : view.status?.phase === "error" ? "wxProgressFailed" : view.status?.phase === "paused" ? "wxPaused" : syncActive ? "wxIncremental" : "wxRoundComplete";
12696
- return /* @__PURE__ */ import_react11.default.createElement("section", { className: "ws-page", "aria-label": t("title") }, /* @__PURE__ */ import_react11.default.createElement("style", null, styles + updateStyles), /* @__PURE__ */ import_react11.default.createElement("header", { className: "ws-header" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-heading" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-brand" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chat", size: 22 })), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-title-line" }, /* @__PURE__ */ import_react11.default.createElement("h1", null, t("title")), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-demo-label" }, t("wxConnected"))), /* @__PURE__ */ import_react11.default.createElement("p", null, t("subtitle")))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-header-actions" }, updater && update && /* @__PURE__ */ import_react11.default.createElement(UpdatePanel, { client: updater, view: update, t }), /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-button", onClick: back }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "arrow", size: 15 }), t("back")))), frozen && /* @__PURE__ */ import_react11.default.createElement("p", { role: "status", className: "ws-update-freeze" }, t("updateFreeze")), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-inline-sync" }, wechat && /* @__PURE__ */ import_react11.default.createElement(SyncPanel, { client: wechat, t, view, workspaceId: selectedWorkspace }), !contact.id && workspaceState.error && /* @__PURE__ */ import_react11.default.createElement("span", { role: "status" }, workspaceState.error)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-body", "data-empty": !contact.id, "data-show-chat": showChat, "data-profile": showProfile }, /* @__PURE__ */ import_react11.default.createElement("aside", { className: "ws-contacts", "aria-label": t("customers") }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-contacts-head" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-intent-sortline" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-section-title" }, /* @__PURE__ */ import_react11.default.createElement("h2", null, t("customers")), /* @__PURE__ */ import_react11.default.createElement("span", null, state.contacts.length)), /* @__PURE__ */ import_react11.default.createElement("select", { className: "ws-intent-sort", "aria-label": t("intentSort"), value: sort, onChange: (event) => setSort(event.currentTarget.value === "intent" ? "intent" : "recent") }, /* @__PURE__ */ import_react11.default.createElement("option", { value: "recent" }, t("intentSortRecent")), /* @__PURE__ */ import_react11.default.createElement("option", { value: "intent" }, t("intentSortHigh")))), /* @__PURE__ */ import_react11.default.createElement("label", { className: "ws-search" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "search", size: 15 }), /* @__PURE__ */ import_react11.default.createElement("input", { name: "sales-search", autoComplete: "off", "aria-label": t("search"), placeholder: t("search"), value: query, onChange: (e) => setQuery(e.target.value) })), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-filters", "aria-label": t("customers") }, ["all", "pending", "handled"].map((value) => /* @__PURE__ */ import_react11.default.createElement("button", { key: value, "aria-pressed": filter === value, onClick: () => setFilter(value) }, t(value), /* @__PURE__ */ import_react11.default.createElement("span", null, value === "all" ? state.contacts.length : value === "pending" ? pending : state.contacts.length - pending))))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-contact-list" }, contacts.map((c) => /* @__PURE__ */ import_react11.default.createElement("button", { key: c.id, className: `ws-contact ${c.id === contact.id ? "is-selected" : ""}`, "aria-pressed": c.id === contact.id, onClick: () => select(c.id) }, /* @__PURE__ */ import_react11.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, c.wechat?.accountId]), owner: c.wechat?.chatKey ?? c.id, mediaId: c.wechat?.avatarId, fallback: c.initials }), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-contact-content" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-contact-line" }, /* @__PURE__ */ import_react11.default.createElement("strong", { title: c.name }, c.name), /* @__PURE__ */ import_react11.default.createElement("time", { dateTime: c.time, title: c.time }, displayTime(c.time))), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-preview" }, c.preview), c.wechat && /* @__PURE__ */ import_react11.default.createElement(IntentBadge, { intent: c.intent, t })))), !contacts.length && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-empty" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "search", size: 26 }), /* @__PURE__ */ import_react11.default.createElement("p", null, t(state.contacts.length ? "noResults" : presentation.emptyKey)), state.contacts.length > 0 && /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-text-button", onClick: () => {
12820
+ return /* @__PURE__ */ import_react11.default.createElement("section", { className: "ws-page", "aria-label": t("title") }, /* @__PURE__ */ import_react11.default.createElement("style", null, styles + updateStyles), /* @__PURE__ */ import_react11.default.createElement("header", { className: "ws-header" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-heading" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-brand" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chat", size: 22 })), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-title-line" }, /* @__PURE__ */ import_react11.default.createElement("h1", null, t("title")), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-demo-label" }, t("wxConnected"))), /* @__PURE__ */ import_react11.default.createElement("p", null, t("subtitle")))), updater && update && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-header-actions" }, /* @__PURE__ */ import_react11.default.createElement(UpdatePanel, { client: updater, view: update, t }))), frozen && /* @__PURE__ */ import_react11.default.createElement("p", { role: "status", className: "ws-update-freeze" }, t("updateFreeze")), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-inline-sync" }, wechat && /* @__PURE__ */ import_react11.default.createElement(SyncPanel, { client: wechat, t, view, workspaceId: selectedWorkspace }), !contact.id && workspaceState.error && /* @__PURE__ */ import_react11.default.createElement("span", { role: "status" }, workspaceState.error)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-body", "data-empty": !contact.id, "data-show-chat": showChat, "data-profile": profileVisibility }, /* @__PURE__ */ import_react11.default.createElement("aside", { className: "ws-contacts", "aria-label": t("customers") }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-contacts-head" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-intent-sortline" }, /* @__PURE__ */ import_react11.default.createElement("h2", null, t("customers")), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-intent-sort-control" }, /* @__PURE__ */ import_react11.default.createElement("select", { className: "ws-intent-sort", "aria-label": t("intentSort"), value: sort, onChange: (event) => setSort(event.currentTarget.value === "intent" ? "intent" : "recent") }, /* @__PURE__ */ import_react11.default.createElement("option", { value: "recent" }, t("intentSortRecent")), /* @__PURE__ */ import_react11.default.createElement("option", { value: "intent" }, t("intentSortHigh"))), /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chevron", size: 12 }))), /* @__PURE__ */ import_react11.default.createElement("label", { className: "ws-search" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "search", size: 15 }), /* @__PURE__ */ import_react11.default.createElement("input", { name: "sales-search", autoComplete: "off", "aria-label": t("search"), placeholder: t("search"), value: query, onChange: (e) => setQuery(e.target.value) })), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-filters", role: "group", "aria-label": t("customers") }, ["all", "pending", "handled"].map((value) => /* @__PURE__ */ import_react11.default.createElement("button", { key: value, type: "button", "aria-pressed": filter === value, onClick: () => setFilter(value) }, t(value), /* @__PURE__ */ import_react11.default.createElement("span", null, value === "all" ? state.contacts.length : value === "pending" ? pending : state.contacts.length - pending))))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-contact-list" }, contacts.map((c) => /* @__PURE__ */ import_react11.default.createElement("button", { key: c.id, className: `ws-contact ${c.id === contact.id ? "is-selected" : ""}`, "aria-pressed": c.id === contact.id, onClick: () => select(c.id) }, /* @__PURE__ */ import_react11.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, c.wechat?.accountId]), owner: c.wechat?.chatKey ?? c.id, mediaId: c.wechat?.avatarId, fallback: c.initials }), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-contact-content" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-contact-line" }, /* @__PURE__ */ import_react11.default.createElement("strong", { title: c.name }, c.name), /* @__PURE__ */ import_react11.default.createElement("time", { dateTime: c.time, title: c.time }, displayTime(c.time))), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-preview" }, c.wechat && c.preview === "[image]" ? t("wxImageListPreview") : c.preview), c.wechat && /* @__PURE__ */ import_react11.default.createElement(IntentBadge, { intent: c.intent, t })))), !contacts.length && /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-empty" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "search", size: 26 }), /* @__PURE__ */ import_react11.default.createElement("p", null, t(state.contacts.length ? "noResults" : presentation.emptyKey)), state.contacts.length > 0 && /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-text-button", onClick: () => {
12697
12821
  setQuery("");
12698
12822
  setFilter("all");
12699
- } }, t("clearSearch")))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-sync" }, state.contacts.length > 0 ? /* @__PURE__ */ import_react11.default.createElement(SyncFooter, { view, t }) : /* @__PURE__ */ import_react11.default.createElement("span", null, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-dot" }), t("wxLocalHistory")))), /* @__PURE__ */ import_react11.default.createElement("main", { className: "ws-conversation" }, !contact.id ? /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-conversation-empty" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chat", size: 34 }), /* @__PURE__ */ import_react11.default.createElement("h2", null, t("wxRealTitle")), /* @__PURE__ */ import_react11.default.createElement("p", null, syncActive || syncPercent !== void 0 ? /* @__PURE__ */ import_react11.default.createElement(SyncActivity, { active: syncActive, percent: syncPercent }, t(syncActive ? "wxSyncingHint" : syncLabel)) : t(presentation.blocked ? "wxAwaitConnectionHistory" : presentation.hintKey ?? "wxSelectChat")), (syncActive || syncPercent !== void 0) && /* @__PURE__ */ import_react11.default.createElement(SyncProgressTrack, { progress: syncProgress, active: syncActive, t })) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-conversation-head" }, /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-icon-button ws-mobile-back", "aria-label": t("contactsBack"), onClick: () => setShowChat(false) }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "arrow" })), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-person-title" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-intent-title" }, /* @__PURE__ */ import_react11.default.createElement("h2", null, contact.name, /* @__PURE__ */ import_react11.default.createElement("span", null, contact.segment)), contact.wechat && /* @__PURE__ */ import_react11.default.createElement(IntentDetails, { key: contact.id, intent: contact.intent, t })), /* @__PURE__ */ import_react11.default.createElement("p", null, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-dot" }), t("wechat"), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-separator" }, "/"), contact.wechat ? contact.crm ? t("wxBound") : t("wxUnbound") : t("sampleContact"))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-conversation-actions" }, /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-button ws-handle", disabled: frozen || contact.status === "handled", onClick: () => {
12823
+ } }, t("clearSearch")))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-sync" }, state.contacts.length > 0 ? /* @__PURE__ */ import_react11.default.createElement(SyncFooter, { view, t }) : /* @__PURE__ */ import_react11.default.createElement("span", null, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-dot" }), t("wxLocalHistory")))), /* @__PURE__ */ import_react11.default.createElement("main", { className: "ws-conversation" }, !contact.id ? /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-conversation-empty" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chat", size: 34 }), /* @__PURE__ */ import_react11.default.createElement("h2", null, t("wxRealTitle")), /* @__PURE__ */ import_react11.default.createElement("p", null, syncActive || syncPercent !== void 0 ? /* @__PURE__ */ import_react11.default.createElement(SyncActivity, { active: syncActive, percent: syncPercent }, t(syncActive ? "wxSyncingHint" : syncLabel)) : t(presentation.blocked ? "wxAwaitConnectionHistory" : presentation.hintKey ?? "wxSelectChat")), (syncActive || syncPercent !== void 0) && /* @__PURE__ */ import_react11.default.createElement(SyncProgressTrack, { progress: syncProgress, active: syncActive, t })) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-conversation-head" }, /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-icon-button ws-mobile-back", "aria-label": t("contactsBack"), onClick: () => setShowChat(false) }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "arrow" })), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-person-title" }, /* @__PURE__ */ import_react11.default.createElement("h2", null, contact.name, !contact.wechat && /* @__PURE__ */ import_react11.default.createElement("span", null, contact.segment)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-person-meta" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-person-source" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-dot", "aria-hidden": "true" }), t("wechat"), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-separator", "aria-hidden": "true" }, "/"), contact.wechat ? contact.crm ? t("wxBound") : t("wxUnbound") : t("sampleContact")), contact.wechat && /* @__PURE__ */ import_react11.default.createElement(IntentDetails, { key: contact.id, intent: contact.intent, t }))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-conversation-actions" }, /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-button ws-handle", disabled: frozen || contact.status === "handled", onClick: () => {
12700
12824
  dispatch({ type: "handled", id: contact.id });
12701
12825
  setNotice(t(contact.wechat ? "wxHandled" : "handledDone"));
12702
- } }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "check", size: 15 }), contact.status === "handled" ? t("handled") : t("markHandled")), /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-icon-button ws-profile-toggle", "aria-label": showProfile ? t("closeProfile") : t("expand"), onClick: () => setShowProfile((v) => !v) }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "user" })))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-history-wrap" }, /* @__PURE__ */ import_react11.default.createElement("div", { ref: reading.viewport, onScroll: reading.onScroll, className: "ws-messages", role: "region", tabIndex: 0, "aria-label": t("conversation") }, /* @__PURE__ */ import_react11.default.createElement("div", { ref: reading.content }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-date" }, /* @__PURE__ */ import_react11.default.createElement("span", null, contact.wechat ? t("wxHistory") : t("today"))), contact.wechat && wechat && view.contactId === contact.id ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, view.hasMore && /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-button ws-earlier", onClick: () => void wechat.messages(contact.id, true).catch((e) => setNotice(e.message)) }, t("wxEarlier")), view.messages.map((m) => /* @__PURE__ */ import_react11.default.createElement("div", { key: m.id, "data-message-id": m.id, className: `ws-message ${m.direction === "outbound" ? "ws-out" : ""}` }, /* @__PURE__ */ import_react11.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat.accountId]), owner: m.direction === "outbound" ? contact.wechat.accountId : contact.wechat.chatKey, mediaId: m.direction === "outbound" ? contact.wechat.selfAvatarId : contact.wechat.avatarId, fallback: m.direction === "outbound" ? t("user") : contact.initials, className: "ws-message-avatar" }), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-content" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-meta" }, /* @__PURE__ */ import_react11.default.createElement("span", null, m.direction === "inbound" ? contact.name : m.direction === "outbound" ? t("user") : t("wxSystem")), /* @__PURE__ */ import_react11.default.createElement("time", { dateTime: m.sentAt, title: m.sentAt }, displayTime(m.sentAt, true))), /* @__PURE__ */ import_react11.default.createElement("div", { className: `ws-bubble${m.kind === "voice" || m.kind === "audio" ? " ws-voice-bubble" : ""}` }, /* @__PURE__ */ import_react11.default.createElement(WechatMessageBody, { message: m, client: wechat, revision: view.status?.revision, t })))))) : contact.messages.map((message) => /* @__PURE__ */ import_react11.default.createElement("div", { key: message.id, "data-message-id": message.id, className: `ws-message ${message.direction === "out" ? "ws-out" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-avatar ws-message-avatar" }, message.direction === "out" ? t("user") : contact.initials), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-content" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-meta" }, /* @__PURE__ */ import_react11.default.createElement("span", null, message.direction === "out" ? t("user") : contact.name), /* @__PURE__ */ import_react11.default.createElement("time", null, message.time)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-bubble" }, message.text)))))), reading.unseen && /* @__PURE__ */ import_react11.default.createElement("button", { type: "button", className: "ws-latest-action", onClick: reading.goToLatest }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-latest-dot", "aria-hidden": "true" }), t("wxNewMessagesLatest"), /* @__PURE__ */ import_react11.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "m6 9 6 6 6-6" })))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-replies" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-reply-heading" }, /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "spark", size: 16 }), /* @__PURE__ */ import_react11.default.createElement("h3", null, t("reply")), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-example-badge" }, t(replyView.key))), /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-text-button", disabled: frozen || running || !selectedWorkspace || !replyView.canGenerate, onClick: () => {
12826
+ } }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "check", size: 15 }), contact.status === "handled" ? t("handled") : t("markHandled")), /* @__PURE__ */ import_react11.default.createElement("button", { type: "button", className: "ws-button ws-profile-toggle", ref: openProfileButton, "aria-label": t("expand"), "aria-controls": profileId, "aria-expanded": profileVisibility === "open", onClick: () => setProfileVisibility("open") }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "user", size: 15 }), /* @__PURE__ */ import_react11.default.createElement("span", null, t("profile"))))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-history-wrap" }, /* @__PURE__ */ import_react11.default.createElement("div", { ref: reading.viewport, onScroll: reading.onScroll, className: "ws-messages", role: "region", tabIndex: 0, "aria-label": t("conversation") }, /* @__PURE__ */ import_react11.default.createElement("div", { ref: reading.content }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-date" }, /* @__PURE__ */ import_react11.default.createElement("span", null, contact.wechat ? t("wxHistory") : t("today"))), contact.wechat && wechat && view.contactId === contact.id ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, view.hasMore && /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-button ws-earlier", onClick: () => void wechat.messages(contact.id, true).catch((e) => setNotice(e.message)) }, t("wxEarlier")), view.messages.map((m) => /* @__PURE__ */ import_react11.default.createElement("div", { key: m.id, "data-message-id": m.id, className: `ws-message ${m.direction === "outbound" ? "ws-out" : ""}` }, /* @__PURE__ */ import_react11.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat.accountId]), owner: m.direction === "outbound" ? contact.wechat.accountId : contact.wechat.chatKey, mediaId: m.direction === "outbound" ? contact.wechat.selfAvatarId : contact.wechat.avatarId, fallback: m.direction === "outbound" ? t("user") : contact.initials, className: "ws-message-avatar" }), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-content" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-meta" }, /* @__PURE__ */ import_react11.default.createElement("span", null, m.direction === "inbound" ? contact.name : m.direction === "outbound" ? t("user") : t("wxSystem")), /* @__PURE__ */ import_react11.default.createElement("time", { dateTime: m.sentAt, title: m.sentAt }, displayTime(m.sentAt, true))), /* @__PURE__ */ import_react11.default.createElement("div", { className: `ws-bubble${m.kind === "voice" || m.kind === "audio" ? " ws-voice-bubble" : ""}` }, /* @__PURE__ */ import_react11.default.createElement(WechatMessageBody, { message: m, client: wechat, revision: view.status?.revision, t })))))) : contact.messages.map((message) => /* @__PURE__ */ import_react11.default.createElement("div", { key: message.id, "data-message-id": message.id, className: `ws-message ${message.direction === "out" ? "ws-out" : ""}` }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-avatar ws-message-avatar" }, message.direction === "out" ? t("user") : contact.initials), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-content" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-message-meta" }, /* @__PURE__ */ import_react11.default.createElement("span", null, message.direction === "out" ? t("user") : contact.name), /* @__PURE__ */ import_react11.default.createElement("time", null, message.time)), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-bubble" }, message.text)))))), reading.unseen && /* @__PURE__ */ import_react11.default.createElement("button", { type: "button", className: "ws-latest-action", onClick: reading.goToLatest }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-latest-dot", "aria-hidden": "true" }), t("wxNewMessagesLatest"), /* @__PURE__ */ import_react11.default.createElement("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.8", "aria-hidden": "true" }, /* @__PURE__ */ import_react11.default.createElement("path", { d: "m6 9 6 6 6-6" })))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-replies" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-reply-heading" }, /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "spark", size: 16 }), /* @__PURE__ */ import_react11.default.createElement("h3", null, t("reply")), /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-example-badge" }, t(replyView.key))), /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-text-button", disabled: frozen || running || !selectedWorkspace || !replyView.canGenerate, onClick: () => {
12703
12827
  setCopyResult(null);
12704
12828
  setNotice("");
12705
12829
  void generate(selectedWorkspace, contact.id);
@@ -12714,7 +12838,7 @@ function SalesPage({ t, useSales, useWorkspaces, dispatch, generate, loadConvers
12714
12838
  setCopyResult(null);
12715
12839
  } }), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-editor-footer" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "ws-char-count" }, draft.length, " ", t("chars")), /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-button ws-primary", disabled: frozen || running || !draft.trim() || generation?.result?.no_send, onClick: () => {
12716
12840
  void copy();
12717
- } }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: copyResult?.id === contact.id && copyResult.success ? "check" : "copy", size: 15 }), copyResult?.id === contact.id && copyResult.success ? t("copied") : t("copy"))), wechatSendingEnabled && contact.wechat && /* @__PURE__ */ import_react11.default.createElement("p", { role: "status", "aria-live": "polite" }, !delivery.available ? t("wxCuaRequired") : delivery.status === "sending" ? t("wxSending") : delivery.status === "awaiting-receipt" ? t("wxAwaitReceipt") : delivery.status === "sent" ? t("wxSent") : ["unknown", "claimed", "stopped", "blocked"].includes(delivery.status) ? t("wxSendStopped") : t("wxManualNote")), state.historyErrors?.[contact.id] && /* @__PURE__ */ import_react11.default.createElement("p", { role: "status" }, state.historyErrors[contact.id]), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-notice", role: "status" }, copyResult?.id === contact.id && !copyResult.success ? t("copyError") : notice)))), contact.id && /* @__PURE__ */ import_react11.default.createElement("aside", { className: "ws-profile", "aria-label": t("profile") }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-head" }, /* @__PURE__ */ import_react11.default.createElement("h2", null, t("profile")), /* @__PURE__ */ import_react11.default.createElement("button", { className: "ws-icon-button ws-profile-close", "aria-label": t("closeProfile"), onClick: () => setShowProfile(false) }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "close", size: 17 }))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-person" }, /* @__PURE__ */ import_react11.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat?.accountId]), owner: contact.wechat?.chatKey ?? contact.id, mediaId: contact.wechat?.avatarId, fallback: contact.initials, className: "ws-profile-avatar" }), /* @__PURE__ */ import_react11.default.createElement("h3", null, contact.name), /* @__PURE__ */ import_react11.default.createElement("p", null, contact.segment), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-tags" }, contact.tags.map((tag) => /* @__PURE__ */ import_react11.default.createElement("span", { key: tag }, tag)))), contact.wechat && bindWechat && /* @__PURE__ */ import_react11.default.createElement(CrmForm, { key: contact.id, contact, t, frozen, dirty: updateFormDirty, bind: (binding) => bindWechat(selectedWorkspace, contact.id, binding) }), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react11.default.createElement("h3", null, t("interest")), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-product" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chat", size: 18 }), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("strong", null, contact.product), /* @__PURE__ */ import_react11.default.createElement("p", null, contact.wechat ? t("wxContext") : t("contextHint")))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-budget" }, /* @__PURE__ */ import_react11.default.createElement("span", null, t("budget")), /* @__PURE__ */ import_react11.default.createElement("strong", null, contact.budget))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react11.default.createElement("h3", null, t("facts")), /* @__PURE__ */ import_react11.default.createElement("dl", null, contact.facts.map((fact) => /* @__PURE__ */ import_react11.default.createElement("div", { key: fact.label }, /* @__PURE__ */ import_react11.default.createElement("dt", null, fact.label), /* @__PURE__ */ import_react11.default.createElement("dd", null, fact.value))))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-caption" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "spark", size: 14 }), /* @__PURE__ */ import_react11.default.createElement("span", null, contact.wechat ? t("wxSources") : t("profileNote"))))));
12841
+ } }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: copyResult?.id === contact.id && copyResult.success ? "check" : "copy", size: 15 }), copyResult?.id === contact.id && copyResult.success ? t("copied") : t("copy"))), wechatSendingEnabled && contact.wechat && /* @__PURE__ */ import_react11.default.createElement("p", { role: "status", "aria-live": "polite" }, !delivery.available ? t("wxCuaRequired") : delivery.status === "sending" ? t("wxSending") : delivery.status === "awaiting-receipt" ? t("wxAwaitReceipt") : delivery.status === "sent" ? t("wxSent") : ["unknown", "claimed", "stopped", "blocked"].includes(delivery.status) ? t("wxSendStopped") : t("wxManualNote")), state.historyErrors?.[contact.id] && /* @__PURE__ */ import_react11.default.createElement("p", { role: "status" }, state.historyErrors[contact.id]), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-notice", role: "status" }, copyResult?.id === contact.id && !copyResult.success ? t("copyError") : notice)))), contact.id && /* @__PURE__ */ import_react11.default.createElement("aside", { id: profileId, className: "ws-profile", "aria-label": t("profile") }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-head" }, /* @__PURE__ */ import_react11.default.createElement("h2", null, t("profile")), /* @__PURE__ */ import_react11.default.createElement("button", { type: "button", className: "ws-icon-button ws-profile-close", ref: closeProfileButton, "aria-label": t("closeProfile"), title: t("closeProfile"), onClick: () => setProfileVisibility("closed") }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "close", size: 17 }))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-person" }, /* @__PURE__ */ import_react11.default.createElement(WechatAvatar, { client: wechat, scope: JSON.stringify([selectedWorkspace, contact.wechat?.accountId]), owner: contact.wechat?.chatKey ?? contact.id, mediaId: contact.wechat?.avatarId, fallback: contact.initials, className: "ws-profile-avatar" }), /* @__PURE__ */ import_react11.default.createElement("h3", null, contact.name), /* @__PURE__ */ import_react11.default.createElement("p", null, contact.segment), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-tags" }, contact.tags.map((tag) => /* @__PURE__ */ import_react11.default.createElement("span", { key: tag }, tag)))), contact.wechat && bindWechat && /* @__PURE__ */ import_react11.default.createElement(CrmForm, { key: contact.id, contact, t, frozen, dirty: updateFormDirty, bind: (binding) => bindWechat(selectedWorkspace, contact.id, binding) }), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react11.default.createElement("h3", null, t("interest")), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-product" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "chat", size: 18 }), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("strong", null, contact.product), /* @__PURE__ */ import_react11.default.createElement("p", null, contact.wechat ? t("wxContext") : t("contextHint")))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-budget" }, /* @__PURE__ */ import_react11.default.createElement("span", null, t("budget")), /* @__PURE__ */ import_react11.default.createElement("strong", null, contact.budget))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-section" }, /* @__PURE__ */ import_react11.default.createElement("h3", null, t("facts")), /* @__PURE__ */ import_react11.default.createElement("dl", null, contact.facts.map((fact) => /* @__PURE__ */ import_react11.default.createElement("div", { key: fact.label }, /* @__PURE__ */ import_react11.default.createElement("dt", null, fact.label), /* @__PURE__ */ import_react11.default.createElement("dd", null, fact.value))))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "ws-profile-caption" }, /* @__PURE__ */ import_react11.default.createElement(Glyph, { name: "spark", size: 14 }), /* @__PURE__ */ import_react11.default.createElement("span", null, contact.wechat ? t("wxSources") : t("profileNote"))))));
12718
12842
  }
12719
12843
  var inject = ["slots", "layout", "locale", "connection", "remote", "remote.session"];
12720
12844
  function apply(ctx) {