@fv-ui/ai-chat 0.11.0 → 0.12.1

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/lib/index.js CHANGED
@@ -113,8 +113,8 @@
113
113
  function renderMarkdown(md, src) {
114
114
  const purify = getPurify();
115
115
  return purify.sanitize(md.render(src), {
116
- ADD_ATTR: ["target", "rel"],
117
- ADD_TAGS: ["semantics", "annotation"]
116
+ ADD_ATTR: ["target", "rel", "data-fv-code-lang", "data-fv-code-trigger", "data-fv-code-index", "type"],
117
+ ADD_TAGS: ["semantics", "annotation", "button"]
118
118
  });
119
119
  }
120
120
 
@@ -1542,6 +1542,249 @@
1542
1542
  }
1543
1543
  }
1544
1544
 
1545
+ const zhCN = {
1546
+ common: {
1547
+ copy: "\u590D\u5236",
1548
+ delete: "\u5220\u9664",
1549
+ confirm: "\u786E\u5B9A",
1550
+ cancel: "\u53D6\u6D88",
1551
+ retry: "\u91CD\u4F20",
1552
+ close: "\u5173\u95ED",
1553
+ preview: "\u9884\u89C8",
1554
+ clear: "\u6E05\u7A7A",
1555
+ stop: "\u505C\u6B62",
1556
+ send: "\u53D1\u9001",
1557
+ download: "\u4E0B\u8F7D",
1558
+ fullscreen: "\u5168\u5C4F",
1559
+ collapse: "\u6536\u8D77",
1560
+ expand: "\u5C55\u5F00"
1561
+ },
1562
+ thinking: {
1563
+ start: "\u5F00\u59CB\u601D\u8003",
1564
+ thinking: "\u601D\u8003\u4E2D...",
1565
+ end: "\u601D\u8003\u5B8C\u6210",
1566
+ error: "\u601D\u8003\u9047\u5230\u95EE\u9898"
1567
+ },
1568
+ sender: {
1569
+ clear: "\u6E05\u7A7A",
1570
+ stop: "\u505C\u6B62",
1571
+ send: "\u53D1\u9001",
1572
+ speech: "\u8BED\u97F3\u8F93\u5165",
1573
+ recordCancel: "\u53D6\u6D88\u5F55\u97F3",
1574
+ recordConfirm: "\u786E\u8BA4\u5F55\u97F3",
1575
+ micUnavailable: "\u65E0\u6CD5\u8BBF\u95EE\u9EA6\u514B\u98CE"
1576
+ },
1577
+ editorSender: {
1578
+ clear: "\u6E05\u7A7A",
1579
+ stop: "\u505C\u6B62",
1580
+ send: "\u53D1\u9001",
1581
+ inputPlaceholder: "\u8BF7\u8F93\u5165",
1582
+ selectTagTitle: "\u9009\u62E9\u6807\u7B7E",
1583
+ loading: "\u52A0\u8F7D\u4E2D\u2026",
1584
+ tagTip: "\u586B\u5199\u5185\u5BB9\u540E\u56DE\u8F66\u786E\u8BA4"
1585
+ },
1586
+ attachments: {
1587
+ add: "\u6DFB\u52A0\u9644\u4EF6",
1588
+ retry: "\u91CD\u4F20"
1589
+ },
1590
+ filesCard: {
1591
+ remove: "\u5220\u9664"
1592
+ },
1593
+ conversations: {
1594
+ menuLabel: "\u4F1A\u8BDD\u64CD\u4F5C",
1595
+ rename: "\u91CD\u547D\u540D",
1596
+ delete: "\u5220\u9664",
1597
+ renameTitle: "\u91CD\u547D\u540D\u4F1A\u8BDD",
1598
+ renamePrompt: "\u8BF7\u8F93\u5165\u65B0\u7684\u4F1A\u8BDD\u540D\u79F0",
1599
+ renamePlaceholder: "\u8BF7\u8F93\u5165\u540D\u79F0",
1600
+ deleteTitle: "\u5220\u9664\u4F1A\u8BDD",
1601
+ deleteConfirm: "\u786E\u5B9A\u5220\u9664\u4F1A\u8BDD\u300C{label}\u300D\u5417?\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002"
1602
+ },
1603
+ scroll: {
1604
+ toBottom: "\u6EDA\u52A8\u5230\u5E95\u90E8"
1605
+ },
1606
+ aiChat: {
1607
+ modelPlaceholder: "\u6A21\u578B",
1608
+ adapterMissing: "\u672A\u914D\u7F6E adapter \u6216 baseURL",
1609
+ generateFailed: "\u751F\u6210\u5931\u8D25",
1610
+ exportUser: "\u4F60",
1611
+ exportAssistant: "\u52A9\u624B"
1612
+ },
1613
+ aiMessage: {
1614
+ copy: "\u590D\u5236",
1615
+ regenerate: "\u91CD\u65B0\u751F\u6210",
1616
+ prevBranch: "\u4E0A\u4E00\u5206\u652F",
1617
+ nextBranch: "\u4E0B\u4E00\u5206\u652F",
1618
+ defaultUserName: "\u4F60",
1619
+ defaultAssistantName: "\u5C0F\u7EF4",
1620
+ querying: "\u6B63\u5728\u67E5\u8BE2",
1621
+ queried: "\u5DF2\u67E5\u8BE2",
1622
+ generateFailed: "\u751F\u6210\u5931\u8D25"
1623
+ },
1624
+ aiArtifacts: {
1625
+ copy: "\u590D\u5236",
1626
+ download: "\u4E0B\u8F7D",
1627
+ fullscreen: "\u5168\u5C4F",
1628
+ close: "\u5173\u95ED"
1629
+ },
1630
+ chat: {
1631
+ fileTag: "[\u9644\u4EF6] {name}",
1632
+ fileImageTag: "(\u56FE\u7247)",
1633
+ filesSystemPrompt: "\u7528\u6237\u968F\u6D88\u606F\u63D0\u4F9B\u4E86\u4EE5\u4E0B\u6587\u4EF6:\n{files}",
1634
+ toolDuration: "\u7528\u65F6 {s}",
1635
+ continuePrompt: "\u8BF7\u57FA\u4E8E\u4EE5\u4E0A\u5185\u5BB9\u7EE7\u7EED\u5B8C\u6210\u56DE\u7B54,\u4E0D\u8981\u91CD\u590D\u5DF2\u6709\u5185\u5BB9\u3002"
1636
+ },
1637
+ errors: {
1638
+ requestFailed: "\u8BF7\u6C42\u5931\u8D25",
1639
+ sessionIdMissing: "\u7F3A\u5C11 sessionId(\u4F1A\u8BDD\u672A\u521B\u5EFA\u6216\u672A\u9009\u4E2D)",
1640
+ noBody: "\u54CD\u5E94\u65E0 body",
1641
+ generateFailed: "\u751F\u6210\u5931\u8D25",
1642
+ recordUnsupported: "\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u97F3\u9891\u5F55\u5236",
1643
+ speechError: "\u8BED\u97F3\u8BC6\u522B\u9519\u8BEF: {error}"
1644
+ }
1645
+ };
1646
+
1647
+ const enUS = {
1648
+ common: {
1649
+ copy: "Copy",
1650
+ delete: "Delete",
1651
+ confirm: "OK",
1652
+ cancel: "Cancel",
1653
+ retry: "Retry",
1654
+ close: "Close",
1655
+ preview: "Preview",
1656
+ clear: "Clear",
1657
+ stop: "Stop",
1658
+ send: "Send",
1659
+ download: "Download",
1660
+ fullscreen: "Fullscreen",
1661
+ collapse: "Collapse",
1662
+ expand: "Expand"
1663
+ },
1664
+ thinking: {
1665
+ start: "Thinking",
1666
+ thinking: "Thinking...",
1667
+ end: "Thought complete",
1668
+ error: "Something went wrong"
1669
+ },
1670
+ sender: {
1671
+ clear: "Clear",
1672
+ stop: "Stop",
1673
+ send: "Send",
1674
+ speech: "Voice input",
1675
+ recordCancel: "Cancel recording",
1676
+ recordConfirm: "Confirm recording",
1677
+ micUnavailable: "Microphone unavailable"
1678
+ },
1679
+ editorSender: {
1680
+ clear: "Clear",
1681
+ stop: "Stop",
1682
+ send: "Send",
1683
+ inputPlaceholder: "Type something...",
1684
+ selectTagTitle: "Select a tag",
1685
+ loading: "Loading...",
1686
+ tagTip: "Type and press Enter to confirm"
1687
+ },
1688
+ attachments: {
1689
+ add: "Add attachment",
1690
+ retry: "Retry"
1691
+ },
1692
+ filesCard: {
1693
+ remove: "Remove"
1694
+ },
1695
+ conversations: {
1696
+ menuLabel: "Conversation actions",
1697
+ rename: "Rename",
1698
+ delete: "Delete",
1699
+ renameTitle: "Rename conversation",
1700
+ renamePrompt: "Enter a new conversation name",
1701
+ renamePlaceholder: "Enter a name",
1702
+ deleteTitle: "Delete conversation",
1703
+ deleteConfirm: 'Delete "{label}"? This cannot be undone.'
1704
+ },
1705
+ scroll: {
1706
+ toBottom: "Scroll to bottom"
1707
+ },
1708
+ aiChat: {
1709
+ modelPlaceholder: "Model",
1710
+ adapterMissing: "Neither adapter nor baseURL is configured",
1711
+ generateFailed: "Generation failed",
1712
+ exportUser: "You",
1713
+ exportAssistant: "Assistant"
1714
+ },
1715
+ aiMessage: {
1716
+ copy: "Copy",
1717
+ regenerate: "Regenerate",
1718
+ prevBranch: "Previous branch",
1719
+ nextBranch: "Next branch",
1720
+ defaultUserName: "You",
1721
+ defaultAssistantName: "Assistant",
1722
+ querying: "Querying ",
1723
+ queried: "Queried ",
1724
+ generateFailed: "Generation failed"
1725
+ },
1726
+ aiArtifacts: {
1727
+ copy: "Copy",
1728
+ download: "Download",
1729
+ fullscreen: "Fullscreen",
1730
+ close: "Close"
1731
+ },
1732
+ chat: {
1733
+ fileTag: "[File] {name}",
1734
+ fileImageTag: " (image)",
1735
+ filesSystemPrompt: "The user provided the following files with the message:\n{files}",
1736
+ toolDuration: "Took {s}",
1737
+ continuePrompt: "Continue completing the answer based on the above content. Do not repeat existing content."
1738
+ },
1739
+ errors: {
1740
+ requestFailed: "Request failed",
1741
+ sessionIdMissing: "sessionId is missing (session not created or selected)",
1742
+ noBody: "Response has no body",
1743
+ generateFailed: "Generation failed",
1744
+ recordUnsupported: "Audio recording is not supported in this environment",
1745
+ speechError: "Speech recognition error: {error}"
1746
+ }
1747
+ };
1748
+
1749
+ let current = zhCN;
1750
+ function getGlobalLocale() {
1751
+ return current;
1752
+ }
1753
+ function setGlobalLocale(m) {
1754
+ current = m;
1755
+ }
1756
+
1757
+ const PACKS = { "zh-CN": zhCN, "en-US": enUS };
1758
+ const tick = vue.shallowRef(0);
1759
+ function configureLocale(locale) {
1760
+ setGlobalLocale(typeof locale === "string" ? PACKS[locale] ?? zhCN : locale);
1761
+ tick.value++;
1762
+ }
1763
+ const LOCALE_KEY = Symbol("fv-locale");
1764
+ function provideLocale(dict) {
1765
+ vue.provide(LOCALE_KEY, dict);
1766
+ }
1767
+ function deepMerge(base, override) {
1768
+ if (!override) return base;
1769
+ const out = { ...base };
1770
+ for (const [k, v] of Object.entries(override)) {
1771
+ const bv = base[k];
1772
+ out[k] = v && typeof v === "object" && !Array.isArray(v) && bv && typeof bv === "object" && !Array.isArray(bv) ? deepMerge(bv, v) : v;
1773
+ }
1774
+ return out;
1775
+ }
1776
+ function useLocaleDict(getPropLocale) {
1777
+ const injected = vue.inject(LOCALE_KEY, void 0);
1778
+ return vue.computed(() => {
1779
+ void tick.value;
1780
+ const prop = getPropLocale?.();
1781
+ if (typeof prop === "string") return PACKS[prop] ?? injected?.value ?? getGlobalLocale();
1782
+ const base = injected?.value ?? getGlobalLocale();
1783
+ if (prop && typeof prop === "object") return deepMerge(base, prop);
1784
+ return base;
1785
+ });
1786
+ }
1787
+
1545
1788
  const _hoisted_1$i = ["innerHTML"];
1546
1789
  var _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
1547
1790
  ...{ name: "FvMarkdown" },
@@ -1550,13 +1793,27 @@
1550
1793
  content: { type: String, required: true },
1551
1794
  mdPlugins: { type: Array, required: false },
1552
1795
  highlight: { type: Function, required: false },
1553
- isTyping: { type: Boolean, required: false }
1796
+ isTyping: { type: Boolean, required: false },
1797
+ codeTriggerLangs: { type: Array, required: false },
1798
+ locale: { type: null, required: false }
1554
1799
  },
1555
1800
  setup(__props, { expose: __expose }) {
1556
1801
  const props = __props;
1802
+ const dict = useLocaleDict(() => props.locale);
1557
1803
  const md = vue.computed(
1558
1804
  () => createMarkdownInstance({
1559
- highlight: (str, lang) => props.highlight ? props.highlight(str, lang) : prismHighlight(str, lang),
1805
+ // highlight 包装:命中 codeTriggerLangs 的代码块返回完整 <pre>(markdown-it 约定:
1806
+ // 返回值以 <pre 开头则原样使用),pre 内追加触发按钮;未命中走原高亮输出。
1807
+ // 序号由消费方按 DOM 内出现次序推导(流式重建实例时闭包计数不稳定,不可用)
1808
+ highlight: (str, lang) => {
1809
+ const base = props.highlight ? props.highlight(str, lang) : prismHighlight(str, lang);
1810
+ const l = lang?.toLowerCase();
1811
+ if (l && props.codeTriggerLangs?.includes(l)) {
1812
+ const preview = dict.value.common.preview;
1813
+ return `<pre class="fv-md-code-pre" data-fv-code-lang="${l}"><code class="language-${l}">${base}</code><button type="button" class="fv-md-code-trigger" data-fv-code-trigger="${l}" aria-label="${preview}">${preview}</button></pre>`;
1814
+ }
1815
+ return base;
1816
+ },
1560
1817
  mdPlugins: props.mdPlugins
1561
1818
  })
1562
1819
  );
@@ -1586,7 +1843,9 @@
1586
1843
  content: { type: String, required: true },
1587
1844
  isMarkdown: { type: Boolean, required: false, default: false },
1588
1845
  isFog: { type: [Boolean, Object], required: false, default: false },
1589
- typing: { type: [Boolean, Object], required: false, default: false }
1846
+ typing: { type: [Boolean, Object], required: false, default: false },
1847
+ codeTriggerLangs: { type: Array, required: false },
1848
+ locale: { type: null, required: false }
1590
1849
  },
1591
1850
  emits: ["start", "finish", "writing"],
1592
1851
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -1674,8 +1933,10 @@
1674
1933
  __props.isMarkdown ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
1675
1934
  key: 0,
1676
1935
  content: renderedContent.value,
1677
- "is-typing": isTyping.value
1678
- }, null, 8, ["content", "is-typing"])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$h, [
1936
+ "is-typing": isTyping.value,
1937
+ "code-trigger-langs": __props.codeTriggerLangs,
1938
+ locale: __props.locale
1939
+ }, null, 8, ["content", "is-typing", "code-trigger-langs", "locale"])) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$h, [
1679
1940
  vue.createTextVNode(
1680
1941
  vue.toDisplayString(renderedContent.value),
1681
1942
  1
@@ -1719,15 +1980,15 @@
1719
1980
  key: 0,
1720
1981
  class: "fv-bubble-header"
1721
1982
  };
1722
- const _hoisted_4$d = {
1983
+ const _hoisted_4$c = {
1723
1984
  key: 0,
1724
1985
  class: "fv-bubble-loading"
1725
1986
  };
1726
- const _hoisted_5$8 = {
1987
+ const _hoisted_5$9 = {
1727
1988
  key: 4,
1728
1989
  class: "fv-bubble-text"
1729
1990
  };
1730
- const _hoisted_6$7 = {
1991
+ const _hoisted_6$8 = {
1731
1992
  key: 1,
1732
1993
  class: "fv-bubble-footer"
1733
1994
  };
@@ -1822,7 +2083,7 @@
1822
2083
  },
1823
2084
  [
1824
2085
  vue.createCommentVNode(" loading \u4F18\u5148:#loading \u63D2\u69FD\u4F18\u5148\u4E8E\u5185\u7F6E\u4E09\u70B9\u52A8\u753B "),
1825
- __props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$d, [
2086
+ __props.loading ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$c, [
1826
2087
  _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", {}, void 0, void 0, 0) : (vue.openBlock(), vue.createElementBlock(
1827
2088
  vue.Fragment,
1828
2089
  { key: 1 },
@@ -1875,7 +2136,7 @@
1875
2136
  content: __props.content
1876
2137
  }, null, 8, ["content"])) : (vue.openBlock(), vue.createElementBlock(
1877
2138
  "span",
1878
- _hoisted_5$8,
2139
+ _hoisted_5$9,
1879
2140
  vue.toDisplayString(__props.content),
1880
2141
  1
1881
2142
  /* TEXT */
@@ -1884,7 +2145,7 @@
1884
2145
  2
1885
2146
  /* CLASS */
1886
2147
  ),
1887
- _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$7, [
2148
+ _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$8, [
1888
2149
  vue.renderSlot(_ctx.$slots, "footer")
1889
2150
  ])) : vue.createCommentVNode("v-if", true)
1890
2151
  ])
@@ -1910,11 +2171,13 @@
1910
2171
  btnColor: { type: String, required: false, default: "" },
1911
2172
  backButtonPosition: { type: Object, required: false, default: () => ({}) },
1912
2173
  btnIconSize: { type: Number, required: false, default: 16 },
1913
- triggerIndices: { type: [String, Array], required: false, default: "only-last" }
2174
+ triggerIndices: { type: [String, Array], required: false, default: "only-last" },
2175
+ locale: { type: null, required: false, default: void 0 }
1914
2176
  },
1915
2177
  emits: ["complete"],
1916
2178
  setup(__props, { expose: __expose, emit: __emit }) {
1917
2179
  const props = __props;
2180
+ const dict = useLocaleDict(() => props.locale);
1918
2181
  const emit = __emit;
1919
2182
  const scrollRef = vue.ref(null);
1920
2183
  const bubbleRefs = vue.ref([]);
@@ -2091,7 +2354,7 @@
2091
2354
  circle: "",
2092
2355
  loading: __props.btnLoading,
2093
2356
  color: __props.btnColor || void 0,
2094
- "aria-label": "\u6EDA\u52A8\u5230\u5E95\u90E8",
2357
+ "aria-label": vue.unref(dict).scroll.toBottom,
2095
2358
  onClick: goBottom
2096
2359
  }, {
2097
2360
  default: vue.withCtx(() => [
@@ -2110,7 +2373,7 @@
2110
2373
  ]),
2111
2374
  _: 1
2112
2375
  /* STABLE */
2113
- }, 8, ["style", "loading", "color"])) : vue.createCommentVNode("v-if", true)
2376
+ }, 8, ["style", "loading", "color", "aria-label"])) : vue.createCommentVNode("v-if", true)
2114
2377
  ]),
2115
2378
  _: 1
2116
2379
  /* STABLE */
@@ -2184,7 +2447,7 @@
2184
2447
  chunks = [];
2185
2448
  revokeAudioUrl();
2186
2449
  if (typeof MediaRecorder === "undefined" || !navigator.mediaDevices?.getUserMedia) {
2187
- error.value = new Error("\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u97F3\u9891\u5F55\u5236");
2450
+ error.value = new Error(getGlobalLocale().errors.recordUnsupported);
2188
2451
  return;
2189
2452
  }
2190
2453
  try {
@@ -2221,7 +2484,7 @@
2221
2484
  text.value = finalText + interim;
2222
2485
  };
2223
2486
  recognition.onerror = (ev) => {
2224
- error.value = new Error(`\u8BED\u97F3\u8BC6\u522B\u9519\u8BEF: ${ev?.error ?? "unknown"}`);
2487
+ error.value = new Error(getGlobalLocale().errors.speechError.split("{error}").join(String(ev?.error ?? "unknown")));
2225
2488
  };
2226
2489
  recognition.start();
2227
2490
  } catch {
@@ -2262,16 +2525,16 @@
2262
2525
  key: 0,
2263
2526
  class: "fv-sender-body-top"
2264
2527
  };
2265
- const _hoisted_4$c = { class: "fv-sender-row" };
2266
- const _hoisted_5$7 = {
2528
+ const _hoisted_4$b = { class: "fv-sender-row" };
2529
+ const _hoisted_5$8 = {
2267
2530
  key: 0,
2268
2531
  class: "fv-sender-prefix"
2269
2532
  };
2270
- const _hoisted_6$6 = {
2533
+ const _hoisted_6$7 = {
2271
2534
  class: "fv-sender-recording-wave",
2272
2535
  "aria-hidden": "true"
2273
2536
  };
2274
- const _hoisted_7$4 = { class: "fv-sender-recording-duration" };
2537
+ const _hoisted_7$5 = { class: "fv-sender-recording-duration" };
2275
2538
  const _hoisted_8$3 = ["value", "placeholder", "disabled", "readonly"];
2276
2539
  const _hoisted_9$2 = {
2277
2540
  key: 3,
@@ -2324,11 +2587,13 @@
2324
2587
  triggerPopoverOffset: { type: Number, required: false, default: 0 },
2325
2588
  triggerPopoverPlacement: { type: null, required: false, default: "top-start" },
2326
2589
  allowSpeech: { type: Boolean, required: false, default: false },
2327
- allowEmptySubmit: { type: Boolean, required: false, default: false }
2590
+ allowEmptySubmit: { type: Boolean, required: false, default: false },
2591
+ locale: { type: null, required: false }
2328
2592
  },
2329
2593
  emits: ["update:modelValue", "submit", "cancel", "change", "trigger", "recording-change", "paste-file", "update:triggerPopoverVisible"],
2330
2594
  setup(__props, { expose: __expose, emit: __emit }) {
2331
2595
  const props = __props;
2596
+ const dict = useLocaleDict(() => props.locale);
2332
2597
  const emit = __emit;
2333
2598
  const innerValue = vue.ref(props.modelValue);
2334
2599
  vue.watch(() => props.modelValue, (v) => {
@@ -2506,7 +2771,7 @@
2506
2771
  if (isRecording.value) return;
2507
2772
  await startRecord();
2508
2773
  if (recordError.value) {
2509
- elementPlus.ElMessage.error(recordError.value.message || "\u65E0\u6CD5\u8BBF\u95EE\u9EA6\u514B\u98CE");
2774
+ elementPlus.ElMessage.error(recordError.value.message || dict.value.sender.micUnavailable);
2510
2775
  return;
2511
2776
  }
2512
2777
  emit("recording-change", true);
@@ -2636,9 +2901,9 @@
2636
2901
  vue.renderSlot(_ctx.$slots, "body-top")
2637
2902
  ])) : vue.createCommentVNode("v-if", true),
2638
2903
  vue.createCommentVNode(" \u4E3B\u4F53\u884C:\u524D\u7F00 + \u8F93\u5165 + \u64CD\u4F5C "),
2639
- vue.createElementVNode("div", _hoisted_4$c, [
2904
+ vue.createElementVNode("div", _hoisted_4$b, [
2640
2905
  vue.createCommentVNode(" \u524D\u7F00\u533A "),
2641
- _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$7, [
2906
+ _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$8, [
2642
2907
  vue.renderSlot(_ctx.$slots, "prefix")
2643
2908
  ])) : vue.createCommentVNode("v-if", true),
2644
2909
  vue.createCommentVNode(" \u8BED\u97F3\u5F55\u97F3\u4E2D:\u8F93\u5165\u533A\u539F\u4F4D\u66FF\u6362\u4E3A\u5F55\u97F3\u6761(\u53D6\u6D88/\u6CE2\u5F62+\u65F6\u957F/\u786E\u8BA4);Esc \u53D6\u6D88 "),
@@ -2655,7 +2920,7 @@
2655
2920
  class: "fv-sender-recording-cancel",
2656
2921
  text: "",
2657
2922
  circle: "",
2658
- "aria-label": "\u53D6\u6D88\u5F55\u97F3",
2923
+ "aria-label": vue.unref(dict).sender.recordCancel,
2659
2924
  onClick: onRecordCancel
2660
2925
  }, {
2661
2926
  default: vue.withCtx(() => [
@@ -2669,8 +2934,8 @@
2669
2934
  ]),
2670
2935
  _: 1
2671
2936
  /* STABLE */
2672
- }),
2673
- vue.createElementVNode("div", _hoisted_6$6, [
2937
+ }, 8, ["aria-label"]),
2938
+ vue.createElementVNode("div", _hoisted_6$7, [
2674
2939
  (vue.openBlock(true), vue.createElementBlock(
2675
2940
  vue.Fragment,
2676
2941
  null,
@@ -2693,7 +2958,7 @@
2693
2958
  ]),
2694
2959
  vue.createElementVNode(
2695
2960
  "span",
2696
- _hoisted_7$4,
2961
+ _hoisted_7$5,
2697
2962
  vue.toDisplayString(recordDuration.value),
2698
2963
  1
2699
2964
  /* TEXT */
@@ -2702,7 +2967,7 @@
2702
2967
  class: "fv-sender-recording-confirm",
2703
2968
  type: "primary",
2704
2969
  circle: "",
2705
- "aria-label": "\u786E\u8BA4\u5F55\u97F3",
2970
+ "aria-label": vue.unref(dict).sender.recordConfirm,
2706
2971
  onClick: onRecordConfirm
2707
2972
  }, {
2708
2973
  default: vue.withCtx(() => [
@@ -2716,7 +2981,7 @@
2716
2981
  ]),
2717
2982
  _: 1
2718
2983
  /* STABLE */
2719
- })
2984
+ }, 8, ["aria-label"])
2720
2985
  ],
2721
2986
  32
2722
2987
  /* NEED_HYDRATION */
@@ -2787,7 +3052,7 @@
2787
3052
  class: "fv-sender-clear",
2788
3053
  text: "",
2789
3054
  disabled: __props.disabled,
2790
- "aria-label": "\u6E05\u7A7A",
3055
+ "aria-label": vue.unref(dict).sender.clear,
2791
3056
  onClick: clear
2792
3057
  }, {
2793
3058
  default: vue.withCtx(() => [
@@ -2801,13 +3066,13 @@
2801
3066
  ]),
2802
3067
  _: 1
2803
3068
  /* STABLE */
2804
- }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
3069
+ }, 8, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
2805
3070
  __props.allowSpeech && !vue.unref(isRecording) ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
2806
3071
  key: 2,
2807
3072
  class: "fv-sender-speech",
2808
3073
  text: "",
2809
3074
  disabled: __props.disabled,
2810
- "aria-label": "\u8BED\u97F3\u8F93\u5165",
3075
+ "aria-label": vue.unref(dict).sender.speech,
2811
3076
  onClick: onSpeechClick
2812
3077
  }, {
2813
3078
  default: vue.withCtx(() => [
@@ -2821,14 +3086,14 @@
2821
3086
  ]),
2822
3087
  _: 1
2823
3088
  /* STABLE */
2824
- }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
3089
+ }, 8, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
2825
3090
  vue.createCommentVNode(" loading \u2192 \u505C\u6B62\u6309\u94AE:SVG \u5149\u5E26\u6CBF\u8FB9\u6846\u5300\u901F\u6D41\u8F6C,\u65B9/\u5706\u6309\u94AE\u5747\u9002\u7528 "),
2826
3091
  __props.loading ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
2827
3092
  key: 3,
2828
3093
  class: "fv-sender-stop",
2829
3094
  type: "primary",
2830
3095
  circle: __props.round,
2831
- "aria-label": "\u505C\u6B62",
3096
+ "aria-label": vue.unref(dict).sender.stop,
2832
3097
  onClick: cancel
2833
3098
  }, {
2834
3099
  default: vue.withCtx(() => [
@@ -2860,13 +3125,13 @@
2860
3125
  ]),
2861
3126
  _: 1
2862
3127
  /* STABLE */
2863
- }, 8, ["circle"])) : (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
3128
+ }, 8, ["circle", "aria-label"])) : (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
2864
3129
  key: 4,
2865
3130
  class: "fv-sender-submit",
2866
3131
  type: "primary",
2867
3132
  circle: __props.round,
2868
3133
  disabled: !submitable(),
2869
- "aria-label": "\u53D1\u9001",
3134
+ "aria-label": vue.unref(dict).sender.send,
2870
3135
  onClick: doSubmit
2871
3136
  }, {
2872
3137
  default: vue.withCtx(() => [
@@ -2880,7 +3145,7 @@
2880
3145
  ]),
2881
3146
  _: 1
2882
3147
  /* STABLE */
2883
- }, 8, ["circle", "disabled"]))
3148
+ }, 8, ["circle", "disabled", "aria-label"]))
2884
3149
  ]))
2885
3150
  ]),
2886
3151
  vue.createCommentVNode(" /fv-sender-row ")
@@ -2906,10 +3171,10 @@
2906
3171
  key: 1,
2907
3172
  class: "fv-mention-loading"
2908
3173
  };
2909
- const _hoisted_4$b = ["onMouseenter", "onClick"];
2910
- const _hoisted_5$6 = { class: "fv-mention-avatar" };
2911
- const _hoisted_6$5 = ["src", "alt"];
2912
- const _hoisted_7$3 = { class: "fv-mention-name" };
3174
+ const _hoisted_4$a = ["onMouseenter", "onClick"];
3175
+ const _hoisted_5$7 = { class: "fv-mention-avatar" };
3176
+ const _hoisted_6$6 = ["src", "alt"];
3177
+ const _hoisted_7$4 = { class: "fv-mention-name" };
2913
3178
  const CHAR_WIDTH$1 = 8;
2914
3179
  var _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
2915
3180
  ...{ name: "FvMentionSender", inheritAttrs: false },
@@ -2918,11 +3183,13 @@
2918
3183
  modelValue: { type: String, required: false, default: "" },
2919
3184
  userList: { type: Array, required: false, default: () => [] },
2920
3185
  customTrigger: { type: Array, required: false, default: () => [] },
2921
- asyncMatchFun: { type: Function, required: false, default: void 0 }
3186
+ asyncMatchFun: { type: Function, required: false, default: void 0 },
3187
+ locale: { type: null, required: false, default: void 0 }
2922
3188
  },
2923
3189
  emits: ["update:modelValue", "change", "submit", "cancel", "trigger", "recording-change", "paste-file", "update:triggerPopoverVisible", "show-at-dialog"],
2924
3190
  setup(__props, { expose: __expose, emit: __emit }) {
2925
3191
  const props = __props;
3192
+ const dict = useLocaleDict(() => props.locale);
2926
3193
  const emit = __emit;
2927
3194
  const innerValue = vue.ref(props.modelValue);
2928
3195
  vue.watch(() => props.modelValue, (v) => {
@@ -3270,7 +3537,13 @@
3270
3537
  1
3271
3538
  /* TEXT */
3272
3539
  )) : vue.createCommentVNode("v-if", true),
3273
- asyncLoading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$c, "\u52A0\u8F7D\u4E2D\u2026")) : (vue.openBlock(true), vue.createElementBlock(
3540
+ asyncLoading.value ? (vue.openBlock(), vue.createElementBlock(
3541
+ "div",
3542
+ _hoisted_3$c,
3543
+ vue.toDisplayString(vue.unref(dict).editorSender.loading),
3544
+ 1
3545
+ /* TEXT */
3546
+ )) : (vue.openBlock(true), vue.createElementBlock(
3274
3547
  vue.Fragment,
3275
3548
  { key: 2 },
3276
3549
  vue.renderList(candidates.value, (item, index) => {
@@ -3280,12 +3553,12 @@
3280
3553
  onMouseenter: ($event) => activeIndex.value = index,
3281
3554
  onClick: ($event) => confirmItem(item)
3282
3555
  }, [
3283
- vue.createElementVNode("span", _hoisted_5$6, [
3556
+ vue.createElementVNode("span", _hoisted_5$7, [
3284
3557
  item.avatar ? (vue.openBlock(), vue.createElementBlock("img", {
3285
3558
  key: 0,
3286
3559
  src: item.avatar,
3287
3560
  alt: item.name
3288
- }, null, 8, _hoisted_6$5)) : (vue.openBlock(), vue.createElementBlock(
3561
+ }, null, 8, _hoisted_6$6)) : (vue.openBlock(), vue.createElementBlock(
3289
3562
  vue.Fragment,
3290
3563
  { key: 1 },
3291
3564
  [
@@ -3301,12 +3574,12 @@
3301
3574
  ]),
3302
3575
  vue.createElementVNode(
3303
3576
  "span",
3304
- _hoisted_7$3,
3577
+ _hoisted_7$4,
3305
3578
  vue.toDisplayString(item.name),
3306
3579
  1
3307
3580
  /* TEXT */
3308
3581
  )
3309
- ], 42, _hoisted_4$b);
3582
+ ], 42, _hoisted_4$a);
3310
3583
  }),
3311
3584
  128
3312
3585
  /* KEYED_FRAGMENT */
@@ -3333,10 +3606,10 @@
3333
3606
  key: 0,
3334
3607
  class: "fv-editor-prefix"
3335
3608
  };
3336
- const _hoisted_4$a = { class: "fv-editor-input" };
3337
- const _hoisted_5$5 = ["contenteditable", "data-placeholder"];
3338
- const _hoisted_6$4 = { class: "fv-editor-mention-panel" };
3339
- const _hoisted_7$2 = {
3609
+ const _hoisted_4$9 = { class: "fv-editor-input" };
3610
+ const _hoisted_5$6 = ["contenteditable", "data-placeholder"];
3611
+ const _hoisted_6$5 = { class: "fv-editor-mention-panel" };
3612
+ const _hoisted_7$3 = {
3340
3613
  key: 0,
3341
3614
  class: "fv-editor-mention-title"
3342
3615
  };
@@ -3387,11 +3660,13 @@
3387
3660
  clearable: { type: Boolean, required: false, default: false },
3388
3661
  headerAnimationTimer: { type: Number, required: false, default: 300 },
3389
3662
  asyncMatchFun: { type: Function, required: false, default: void 0 },
3390
- customDialog: { type: Boolean, required: false, default: false }
3663
+ customDialog: { type: Boolean, required: false, default: false },
3664
+ locale: { type: null, required: false }
3391
3665
  },
3392
3666
  emits: ["submit", "change", "cancel", "show-at-dialog", "show-select-dialog", "show-tag-dialog"],
3393
3667
  setup(__props, { expose: __expose, emit: __emit }) {
3394
3668
  const props = __props;
3669
+ const dict = useLocaleDict(() => props.locale);
3395
3670
  const emit = __emit;
3396
3671
  let uid = 0;
3397
3672
  function genId() {
@@ -3483,7 +3758,7 @@
3483
3758
  const input = document.createElement("input");
3484
3759
  input.className = "fv-editor-tag-input";
3485
3760
  input.value = node.value?.name ?? "";
3486
- input.setAttribute("placeholder", node.meta?.placeholder ?? "\u8BF7\u8F93\u5165");
3761
+ input.setAttribute("placeholder", node.meta?.placeholder ?? dict.value.editorSender.inputPlaceholder);
3487
3762
  input.addEventListener("input", (ev) => {
3488
3763
  node.value = { ...node.value ?? {}, name: ev.target.value };
3489
3764
  ev.stopPropagation();
@@ -4110,7 +4385,7 @@
4110
4385
  _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$b, [
4111
4386
  vue.renderSlot(_ctx.$slots, "prefix")
4112
4387
  ])) : vue.createCommentVNode("v-if", true),
4113
- vue.createElementVNode("div", _hoisted_4$a, [
4388
+ vue.createElementVNode("div", _hoisted_4$9, [
4114
4389
  vue.createCommentVNode(" \u6807\u7B7E\u7F16\u8F91\u533A:contenteditable,\u5185\u5BB9\u7531\u547D\u4EE4\u5F0F\u6E32\u67D3(nodes \u2192 DOM) "),
4115
4390
  vue.createElementVNode("div", {
4116
4391
  ref_key: "editorRef",
@@ -4125,7 +4400,7 @@
4125
4400
  onPaste,
4126
4401
  onFocus: onEditorFocus,
4127
4402
  onBlur: onEditorBlur
4128
- }, null, 40, _hoisted_5$5),
4403
+ }, null, 40, _hoisted_5$6),
4129
4404
  vue.createCommentVNode(" at \u5F39\u5C42\u951A\u70B9:\u4E0D\u53EF\u89C1,\u4EC5\u627F\u8F7D el-popover \u5B9A\u4F4D(\u5728 ElPopover #reference \u5185) "),
4130
4405
  vue.createCommentVNode(" @\u5F39\u5C42:v-if \u6574\u4F53\u5378\u8F7D(el-popover \u5173\u95ED\u4EC5 display:none \u4F1A\u6B8B\u7559 DOM) "),
4131
4406
  mentionVisible.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElPopover), {
@@ -4151,15 +4426,21 @@
4151
4426
  )
4152
4427
  ]),
4153
4428
  default: vue.withCtx(() => [
4154
- vue.createElementVNode("div", _hoisted_6$4, [
4429
+ vue.createElementVNode("div", _hoisted_6$5, [
4155
4430
  panelTitle.value ? (vue.openBlock(), vue.createElementBlock(
4156
4431
  "div",
4157
- _hoisted_7$2,
4432
+ _hoisted_7$3,
4158
4433
  vue.toDisplayString(panelTitle.value),
4159
4434
  1
4160
4435
  /* TEXT */
4161
4436
  )) : vue.createCommentVNode("v-if", true),
4162
- asyncLoading.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$2, "\u52A0\u8F7D\u4E2D\u2026")) : (vue.openBlock(true), vue.createElementBlock(
4437
+ asyncLoading.value ? (vue.openBlock(), vue.createElementBlock(
4438
+ "div",
4439
+ _hoisted_8$2,
4440
+ vue.toDisplayString(vue.unref(dict).editorSender.loading),
4441
+ 1
4442
+ /* TEXT */
4443
+ )) : (vue.openBlock(true), vue.createElementBlock(
4163
4444
  vue.Fragment,
4164
4445
  { key: 2 },
4165
4446
  vue.renderList(candidates.value, (item, index) => {
@@ -4228,13 +4509,13 @@
4228
4509
  default: vue.withCtx(() => [
4229
4510
  vue.createElementVNode("div", _hoisted_13$1, [
4230
4511
  vue.renderSlot(_ctx.$slots, "tag-tip", { nodeId: tipTargetId.value }, () => [
4231
- _cache[5] || (_cache[5] = vue.createElementVNode(
4512
+ vue.createElementVNode(
4232
4513
  "span",
4233
4514
  null,
4234
- "\u586B\u5199\u5185\u5BB9\u540E\u56DE\u8F66\u786E\u8BA4",
4235
- -1
4236
- /* CACHED */
4237
- ))
4515
+ vue.toDisplayString(vue.unref(dict).editorSender.tagTip),
4516
+ 1
4517
+ /* TEXT */
4518
+ )
4238
4519
  ])
4239
4520
  ])
4240
4521
  ]),
@@ -4251,7 +4532,7 @@
4251
4532
  class: "fv-editor-clear",
4252
4533
  text: "",
4253
4534
  disabled: __props.disabled,
4254
- "aria-label": "\u6E05\u7A7A",
4535
+ "aria-label": vue.unref(dict).editorSender.clear,
4255
4536
  onClick: clear
4256
4537
  }, {
4257
4538
  default: vue.withCtx(() => [
@@ -4265,13 +4546,13 @@
4265
4546
  ]),
4266
4547
  _: 1
4267
4548
  /* STABLE */
4268
- }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
4549
+ }, 8, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
4269
4550
  vue.createCommentVNode(" loading \u2192 \u505C\u6B62\u6309\u94AE;\u5426\u5219\u53D1\u9001\u6309\u94AE "),
4270
4551
  __props.loading ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
4271
4552
  key: 1,
4272
4553
  class: "fv-editor-stop",
4273
4554
  type: "primary",
4274
- "aria-label": "\u505C\u6B62",
4555
+ "aria-label": vue.unref(dict).editorSender.stop,
4275
4556
  onClick: _cache[2] || (_cache[2] = ($event) => emit("cancel"))
4276
4557
  }, {
4277
4558
  default: vue.withCtx(() => [
@@ -4285,12 +4566,12 @@
4285
4566
  ]),
4286
4567
  _: 1
4287
4568
  /* STABLE */
4288
- })) : (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
4569
+ }, 8, ["aria-label"])) : (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElButton), {
4289
4570
  key: 2,
4290
4571
  class: "fv-editor-submit",
4291
4572
  type: "primary",
4292
4573
  disabled: !canSubmit.value,
4293
- "aria-label": "\u53D1\u9001",
4574
+ "aria-label": vue.unref(dict).editorSender.send,
4294
4575
  onClick: doSubmit
4295
4576
  }, {
4296
4577
  default: vue.withCtx(() => [
@@ -4304,7 +4585,7 @@
4304
4585
  ]),
4305
4586
  _: 1
4306
4587
  /* STABLE */
4307
- }, 8, ["disabled"]))
4588
+ }, 8, ["disabled", "aria-label"]))
4308
4589
  ]))
4309
4590
  ]),
4310
4591
  vue.createCommentVNode(" \u5E95\u90E8 "),
@@ -4315,7 +4596,7 @@
4315
4596
  selectVisible.value && !__props.customDialog ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElDialog), {
4316
4597
  key: 2,
4317
4598
  "model-value": selectVisible.value,
4318
- title: "\u9009\u62E9\u6807\u7B7E",
4599
+ title: vue.unref(dict).editorSender.selectTagTitle,
4319
4600
  width: "560px",
4320
4601
  "append-to-body": false,
4321
4602
  "onUpdate:modelValue": _cache[3] || (_cache[3] = (v) => {
@@ -4378,7 +4659,7 @@
4378
4659
  ]),
4379
4660
  _: 1
4380
4661
  /* STABLE */
4381
- }, 8, ["model-value"])) : vue.createCommentVNode("v-if", true)
4662
+ }, 8, ["model-value", "title"])) : vue.createCommentVNode("v-if", true)
4382
4663
  ],
4383
4664
  6
4384
4665
  /* CLASS, STYLE */
@@ -4393,7 +4674,7 @@
4393
4674
  class: "fv-thinking-dot"
4394
4675
  };
4395
4676
  const _hoisted_3$a = { class: "fv-thinking-label" };
4396
- const _hoisted_4$9 = ["hidden"];
4677
+ const _hoisted_4$8 = ["hidden"];
4397
4678
  var _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
4398
4679
  ...{ name: "FvThinking" },
4399
4680
  __name: "index",
@@ -4406,24 +4687,28 @@
4406
4687
  buttonWidth: { type: String, required: false, default: "" },
4407
4688
  maxWidth: { type: String, required: false, default: "" },
4408
4689
  color: { type: String, required: false, default: "" },
4409
- backgroundColor: { type: String, required: false, default: "" }
4690
+ backgroundColor: { type: String, required: false, default: "" },
4691
+ locale: { type: null, required: false }
4410
4692
  },
4411
4693
  emits: ["update:modelValue"],
4412
4694
  setup(__props, { expose: __expose, emit: __emit }) {
4413
4695
  const props = __props;
4414
4696
  const emit = __emit;
4415
- const statusTextMap = {
4416
- start: "\u5F00\u59CB\u601D\u8003",
4417
- thinking: "\u601D\u8003\u4E2D...",
4418
- end: "\u601D\u8003\u5B8C\u6210",
4419
- error: "\u601D\u8003\u9047\u5230\u95EE\u9898"
4420
- };
4421
4697
  const modelValue = vue.ref(props.modelValue);
4422
4698
  vue.watch(() => props.modelValue, (v) => {
4423
4699
  if (v !== modelValue.value) modelValue.value = v;
4424
4700
  });
4425
4701
  vue.watch(modelValue, (v) => emit("update:modelValue", v));
4426
- const statusText = vue.computed(() => statusTextMap[props.status]);
4702
+ const dict = useLocaleDict(() => props.locale);
4703
+ const statusText = vue.computed(() => {
4704
+ const m = {
4705
+ start: dict.value.thinking.start,
4706
+ thinking: dict.value.thinking.thinking,
4707
+ end: dict.value.thinking.end,
4708
+ error: dict.value.thinking.error
4709
+ };
4710
+ return m[props.status];
4711
+ });
4427
4712
  function toggle() {
4428
4713
  if (props.disabled) return;
4429
4714
  if (props.status === "start") return;
@@ -4534,7 +4819,7 @@
4534
4819
  /* TEXT */
4535
4820
  )
4536
4821
  ], void 0, 1)
4537
- ], 12, _hoisted_4$9)) : vue.createCommentVNode("v-if", true)
4822
+ ], 12, _hoisted_4$8)) : vue.createCommentVNode("v-if", true)
4538
4823
  ],
4539
4824
  6
4540
4825
  /* CLASS, STYLE */
@@ -4549,15 +4834,22 @@
4549
4834
  class: "fv-chain-dot"
4550
4835
  };
4551
4836
  const _hoisted_3$9 = { class: "fv-chain-main" };
4552
- const _hoisted_4$8 = {
4837
+ const _hoisted_4$7 = {
4553
4838
  key: 1,
4554
4839
  class: "fv-chain-title-text"
4555
4840
  };
4556
- const _hoisted_5$4 = ["aria-label", "onClick"];
4557
- const _hoisted_6$3 = {
4841
+ const _hoisted_5$5 = {
4842
+ key: 2,
4843
+ class: "fv-chain-title-text"
4844
+ };
4845
+ const _hoisted_6$4 = ["aria-label", "onClick"];
4846
+ const _hoisted_7$2 = {
4558
4847
  key: 0,
4559
4848
  class: "fv-chain-description"
4560
4849
  };
4850
+ const HOLD_DELAY = 200;
4851
+ const HOLD_MIN_CHARS = 16;
4852
+ const HOLD_WINDOW = 600;
4561
4853
  const TITLE_LINE_HEIGHT = 22;
4562
4854
  const TITLE_MAX_LINES = 3;
4563
4855
  const ELLIPSIS = "\u2026";
@@ -4568,11 +4860,13 @@
4568
4860
  props: {
4569
4861
  items: { type: Array, required: true, default: () => [] },
4570
4862
  direction: { type: String, required: false, default: "vertical" },
4571
- collapsible: { type: Boolean, required: false, default: false }
4863
+ collapsible: { type: Boolean, required: false, default: false },
4864
+ locale: { type: null, required: false }
4572
4865
  },
4573
4866
  emits: ["typing"],
4574
4867
  setup(__props, { emit: __emit }) {
4575
4868
  const props = __props;
4869
+ const dict = useLocaleDict(() => props.locale);
4576
4870
  const emit = __emit;
4577
4871
  function statusClass(status) {
4578
4872
  return status ? `status-${status}` : "status-pending";
@@ -4583,7 +4877,38 @@
4583
4877
  }
4584
4878
  const typedKeys = vue.ref(/* @__PURE__ */ new Set());
4585
4879
  const doneKeys = vue.ref(/* @__PURE__ */ new Set());
4880
+ const flushedKeys = vue.ref(/* @__PURE__ */ new Set());
4586
4881
  const typingConfigs = vue.ref(/* @__PURE__ */ new Map());
4882
+ const holdTimers = /* @__PURE__ */ new Map();
4883
+ const holdingKeys = vue.ref(/* @__PURE__ */ new Set());
4884
+ function stopHold(key) {
4885
+ const t = holdTimers.get(key);
4886
+ if (t) {
4887
+ clearTimeout(t);
4888
+ holdTimers.delete(key);
4889
+ }
4890
+ if (holdingKeys.value.has(key)) {
4891
+ const next = new Set(holdingKeys.value);
4892
+ next.delete(key);
4893
+ holdingKeys.value = next;
4894
+ }
4895
+ }
4896
+ function clearAllHolds() {
4897
+ holdTimers.forEach((t) => clearTimeout(t));
4898
+ holdTimers.clear();
4899
+ }
4900
+ vue.onBeforeUnmount(clearAllHolds);
4901
+ function holdItem(key) {
4902
+ if (holdingKeys.value.has(key)) return;
4903
+ holdingKeys.value = new Set(holdingKeys.value).add(key);
4904
+ holdTimers.set(key, setTimeout(() => {
4905
+ holdTimers.delete(key);
4906
+ if (!holdingKeys.value.has(key)) return;
4907
+ const next = new Set(holdingKeys.value);
4908
+ next.delete(key);
4909
+ holdingKeys.value = next;
4910
+ }, HOLD_DELAY));
4911
+ }
4587
4912
  function markTyped(key, typing) {
4588
4913
  if (!typedKeys.value.has(key)) typedKeys.value = new Set(typedKeys.value).add(key);
4589
4914
  if (typing) {
@@ -4595,16 +4920,56 @@
4595
4920
  function markDone(key) {
4596
4921
  if (!doneKeys.value.has(key)) doneKeys.value = new Set(doneKeys.value).add(key);
4597
4922
  }
4923
+ function flushStep(item) {
4924
+ flushedKeys.value = new Set(flushedKeys.value).add(item.key);
4925
+ doneKeys.value = new Set(doneKeys.value).add(item.key);
4926
+ stopHold(item.key);
4927
+ void vue.nextTick(measure);
4928
+ return normalizeTitle(item.title).length;
4929
+ }
4930
+ let lastFlushAt = 0;
4931
+ let lastFlushChars = 0;
4598
4932
  vue.watch(() => props.items, (items) => {
4599
- for (const it of items) if (it.typing) markTyped(it.key, it.typing);
4933
+ const now = Date.now();
4934
+ let flushedChars = 0;
4935
+ const flushCounting = (it) => {
4936
+ if (!isTypingItem(it) || flushedKeys.value.has(it.key)) return;
4937
+ const counted = !doneKeys.value.has(it.key);
4938
+ const chars = flushStep(it);
4939
+ if (counted) flushedChars += chars;
4940
+ };
4941
+ const preRegistered = new Set(typedKeys.value);
4942
+ const fresh = [];
4943
+ for (const it of items) {
4944
+ if (it.typing && !typedKeys.value.has(it.key)) {
4945
+ markTyped(it.key, it.typing);
4946
+ fresh.push(it);
4947
+ }
4948
+ }
4949
+ if (fresh.length) {
4950
+ const freshKeys = new Set(fresh.map((f) => f.key));
4951
+ for (const it of items) {
4952
+ if (!freshKeys.has(it.key)) flushCounting(it);
4953
+ }
4954
+ }
4955
+ for (const it of items) {
4956
+ if (it.typing && it.closed && preRegistered.has(it.key)) flushCounting(it);
4957
+ }
4958
+ if (flushedChars > 0) {
4959
+ lastFlushAt = now;
4960
+ lastFlushChars = flushedChars;
4961
+ }
4962
+ if (fresh.length && now - lastFlushAt < HOLD_WINDOW && lastFlushChars >= HOLD_MIN_CHARS) {
4963
+ for (const f of fresh) holdItem(f.key);
4964
+ }
4600
4965
  }, { immediate: true, deep: true });
4601
4966
  function typingOf(item) {
4602
4967
  return typingConfigs.value.get(item.key) ?? true;
4603
4968
  }
4604
4969
  function isTypingItem(item) {
4605
- if (item.typing) {
4606
- return !(item.closed && doneKeys.value.has(item.key));
4607
- }
4970
+ if (flushedKeys.value.has(item.key)) return false;
4971
+ if (holdingKeys.value.has(item.key)) return true;
4972
+ if (item.typing) return true;
4608
4973
  return typedKeys.value.has(item.key) && !doneKeys.value.has(item.key);
4609
4974
  }
4610
4975
  function onTypeFinish(key) {
@@ -4696,7 +5061,7 @@
4696
5061
  }
4697
5062
  function isTypingKey(key) {
4698
5063
  const item = props.items.find((i) => i.key === key);
4699
- return !!item && isTypingItem(item);
5064
+ return !!item && (isTypingItem(item) || holdingKeys.value.has(key));
4700
5065
  }
4701
5066
  function showToggle(key) {
4702
5067
  return overflowKeys.value.has(key) || expandedKeys.value.has(key);
@@ -4810,25 +5175,25 @@
4810
5175
  class: vue.normalizeClass(["fv-chain-title", { "is-clamped": __props.collapsible && showToggle(item.key) && !expandedKeys.value.has(item.key) }])
4811
5176
  },
4812
5177
  [
4813
- vue.createCommentVNode(" \u622A\u65AD\u7531 JS \u6D4B\u91CF(displayTitle \u524D\u7F00\u539F\u6587):\u6309\u94AE\u4E3A\u5185\u8054\u5143\u7D20\u81EA\u7136\u7D27\u8DDF\r\n \u7B2C\u4E09\u884C\u6587\u5B57\u672B(\u6536\u8D77)/\u5168\u91CF\u672B\u5B57(\u5C55\u5F00);\u65E0\u5E03\u5C40\u73AF\u5883\u4E0D\u88C1\u4E0D\u663E\u6309\u94AE "),
4814
- isTypingItem(item) ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
5178
+ vue.createCommentVNode(" \u622A\u65AD\u7531 JS \u6D4B\u91CF(displayTitle \u524D\u7F00\u539F\u6587):\u6309\u94AE\u4E3A\u5185\u8054\u5143\u7D20\u81EA\u7136\u7D27\u8DDF\r\n \u7B2C\u4E09\u884C\u6587\u5B57\u672B(\u6536\u8D77)/\u5168\u91CF\u672B\u5B57(\u5C55\u5F00);\u65E0\u5E03\u5C40\u73AF\u5883\u4E0D\u88C1\u4E0D\u663E\u6309\u94AE;\r\n \u5EF6\u8FDF\u5F00\u6253\u7B49\u5F85\u671F(holding)\u6E32\u67D3\u7A7A\u5360\u4F4D,\u5230\u70B9\u518D\u6302\u6253\u5B57\u673A "),
5179
+ isTypingItem(item) && !holdingKeys.value.has(item.key) ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
4815
5180
  key: 0,
4816
5181
  content: normalizeTitle(item.title),
4817
5182
  typing: typingOf(item),
4818
5183
  onWriting: _cache[0] || (_cache[0] = ($event) => emit("typing")),
4819
5184
  onFinish: ($event) => onTypeFinish(item.key)
4820
- }, null, 8, ["content", "typing", "onFinish"])) : (vue.openBlock(), vue.createElementBlock(
5185
+ }, null, 8, ["content", "typing", "onFinish"])) : holdingKeys.value.has(item.key) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$7)) : (vue.openBlock(), vue.createElementBlock(
4821
5186
  "span",
4822
- _hoisted_4$8,
5187
+ _hoisted_5$5,
4823
5188
  vue.toDisplayString(displayTitle(item.title, item.key)),
4824
5189
  1
4825
5190
  /* TEXT */
4826
5191
  )),
4827
5192
  __props.collapsible && showToggle(item.key) ? (vue.openBlock(), vue.createElementBlock("button", {
4828
- key: 2,
5193
+ key: 3,
4829
5194
  type: "button",
4830
5195
  class: "fv-chain-expand",
4831
- "aria-label": expandedKeys.value.has(item.key) ? "\u6536\u8D77" : "\u5C55\u5F00",
5196
+ "aria-label": expandedKeys.value.has(item.key) ? vue.unref(dict).common.collapse : vue.unref(dict).common.expand,
4832
5197
  onClick: ($event) => toggleExpand(item.key)
4833
5198
  }, [
4834
5199
  vue.createVNode(
@@ -4844,14 +5209,14 @@
4844
5209
  1024
4845
5210
  /* DYNAMIC_SLOTS */
4846
5211
  )
4847
- ], 8, _hoisted_5$4)) : vue.createCommentVNode("v-if", true)
5212
+ ], 8, _hoisted_6$4)) : vue.createCommentVNode("v-if", true)
4848
5213
  ],
4849
5214
  2
4850
5215
  /* CLASS */
4851
5216
  ),
4852
5217
  item.description ? (vue.openBlock(), vue.createElementBlock(
4853
5218
  "div",
4854
- _hoisted_6$3,
5219
+ _hoisted_7$2,
4855
5220
  vue.toDisplayString(item.description),
4856
5221
  1
4857
5222
  /* TEXT */
@@ -4880,7 +5245,7 @@
4880
5245
  key: 0,
4881
5246
  class: "fv-welcome-name"
4882
5247
  };
4883
- const _hoisted_4$7 = {
5248
+ const _hoisted_4$6 = {
4884
5249
  key: 1,
4885
5250
  class: "fv-welcome-description"
4886
5251
  };
@@ -4933,7 +5298,7 @@
4933
5298
  ])
4934
5299
  ])) : vue.createCommentVNode("v-if", true),
4935
5300
  vue.createCommentVNode(" #description \u63D2\u69FD\u8986\u76D6\u63CF\u8FF0 "),
4936
- _ctx.$slots.description || __props.description ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_4$7, [
5301
+ _ctx.$slots.description || __props.description ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_4$6, [
4937
5302
  vue.renderSlot(_ctx.$slots, "description", {}, () => [
4938
5303
  vue.createTextVNode(
4939
5304
  vue.toDisplayString(__props.description),
@@ -4953,9 +5318,9 @@
4953
5318
  class: "fv-prompts-title"
4954
5319
  };
4955
5320
  const _hoisted_3$7 = { class: "fv-prompts-list" };
4956
- const _hoisted_4$6 = ["role", "tabindex", "onClick"];
4957
- const _hoisted_5$3 = { class: "fv-prompt-item-main" };
4958
- const _hoisted_6$2 = { class: "fv-prompt-item-text" };
5321
+ const _hoisted_4$5 = ["role", "tabindex", "onClick"];
5322
+ const _hoisted_5$4 = { class: "fv-prompt-item-main" };
5323
+ const _hoisted_6$3 = { class: "fv-prompt-item-text" };
4959
5324
  const _hoisted_7$1 = {
4960
5325
  key: 0,
4961
5326
  class: "fv-prompt-item-label"
@@ -5012,7 +5377,7 @@
5012
5377
  item,
5013
5378
  index
5014
5379
  }, () => [
5015
- vue.createElementVNode("div", _hoisted_5$3, [
5380
+ vue.createElementVNode("div", _hoisted_5$4, [
5016
5381
  resolvedIcons.value[index] ? (vue.openBlock(), vue.createBlock(
5017
5382
  vue.unref(elementPlus.ElIcon),
5018
5383
  {
@@ -5029,7 +5394,7 @@
5029
5394
  1024
5030
5395
  /* DYNAMIC_SLOTS */
5031
5396
  )) : vue.createCommentVNode("v-if", true),
5032
- vue.createElementVNode("div", _hoisted_6$2, [
5397
+ vue.createElementVNode("div", _hoisted_6$3, [
5033
5398
  item.label ? (vue.openBlock(), vue.createElementBlock(
5034
5399
  "div",
5035
5400
  _hoisted_7$1,
@@ -5047,7 +5412,7 @@
5047
5412
  ])
5048
5413
  ])
5049
5414
  ])
5050
- ], 10, _hoisted_4$6);
5415
+ ], 10, _hoisted_4$5);
5051
5416
  }),
5052
5417
  128
5053
5418
  /* KEYED_FRAGMENT */
@@ -5061,14 +5426,15 @@
5061
5426
  const _hoisted_1$6 = ["src", "alt"];
5062
5427
  const _hoisted_2$6 = { class: "fv-files-card-info" };
5063
5428
  const _hoisted_3$6 = ["title"];
5064
- const _hoisted_4$5 = {
5429
+ const _hoisted_4$4 = {
5065
5430
  key: 0,
5066
5431
  class: "fv-files-card-size"
5067
5432
  };
5068
- const _hoisted_5$2 = {
5433
+ const _hoisted_5$3 = {
5069
5434
  key: 2,
5070
5435
  class: "fv-files-card-status"
5071
5436
  };
5437
+ const _hoisted_6$2 = ["aria-label"];
5072
5438
  const KB = 1024;
5073
5439
  const MB = 1024 * 1024;
5074
5440
  var _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
@@ -5081,7 +5447,8 @@
5081
5447
  url: { type: String, required: false, default: "" },
5082
5448
  status: { type: String, required: false, default: "success" },
5083
5449
  imageSize: { type: String, required: false, default: "" },
5084
- onDelete: { type: Function, required: false, default: void 0 }
5450
+ onDelete: { type: Function, required: false, default: void 0 },
5451
+ locale: { type: null, required: false, default: void 0 }
5085
5452
  },
5086
5453
  setup(__props) {
5087
5454
  const EXT_ICON = {
@@ -5121,6 +5488,7 @@
5121
5488
  dll: ElementPlusIconsVue.Cpu
5122
5489
  };
5123
5490
  const props = __props;
5491
+ const dict = useLocaleDict(() => props.locale);
5124
5492
  const sizeText = vue.computed(() => {
5125
5493
  if (props.size === void 0 || props.size === null || props.size === "" || props.size === 0) return "";
5126
5494
  if (typeof props.size === "string") return props.size;
@@ -5205,14 +5573,14 @@
5205
5573
  }, vue.toDisplayString(__props.name), 9, _hoisted_3$6),
5206
5574
  sizeText.value ? (vue.openBlock(), vue.createElementBlock(
5207
5575
  "div",
5208
- _hoisted_4$5,
5576
+ _hoisted_4$4,
5209
5577
  vue.toDisplayString(sizeText.value),
5210
5578
  1
5211
5579
  /* TEXT */
5212
5580
  )) : vue.createCommentVNode("v-if", true)
5213
5581
  ]),
5214
5582
  vue.createCommentVNode(" \u72B6\u6001\u89D2\u6807:loading spinner;error \u65E0\u89D2\u6807(\u7EA2\u8FB9\u6837\u5F0F) "),
5215
- __props.status === "loading" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$2, [
5583
+ __props.status === "loading" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$3, [
5216
5584
  vue.createVNode(vue.unref(elementPlus.ElIcon), { class: "fv-files-card-loading" }, {
5217
5585
  default: vue.withCtx(() => [
5218
5586
  vue.createVNode(vue.unref(ElementPlusIconsVue.Loading))
@@ -5225,7 +5593,7 @@
5225
5593
  vue.createElementVNode("button", {
5226
5594
  type: "button",
5227
5595
  class: "fv-files-card-remove",
5228
- "aria-label": "\u5220\u9664",
5596
+ "aria-label": vue.unref(dict).filesCard.remove,
5229
5597
  onClick: onDeleteClick
5230
5598
  }, [
5231
5599
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
@@ -5235,7 +5603,7 @@
5235
5603
  _: 1
5236
5604
  /* STABLE */
5237
5605
  })
5238
- ])
5606
+ ], 8, _hoisted_6$2)
5239
5607
  ],
5240
5608
  2
5241
5609
  /* CLASS */
@@ -5246,12 +5614,12 @@
5246
5614
 
5247
5615
  const _hoisted_1$5 = { class: "fv-attachments" };
5248
5616
  const _hoisted_2$5 = ["accept"];
5249
- const _hoisted_3$5 = ["disabled"];
5250
- const _hoisted_4$4 = {
5617
+ const _hoisted_3$5 = ["disabled", "aria-label"];
5618
+ const _hoisted_4$3 = {
5251
5619
  key: 1,
5252
5620
  class: "fv-attachments-list"
5253
5621
  };
5254
- const _hoisted_5$1 = ["onClick"];
5622
+ const _hoisted_5$2 = ["aria-label", "onClick"];
5255
5623
  const _hoisted_6$1 = {
5256
5624
  key: 2,
5257
5625
  class: "fv-attachments-tip"
@@ -5265,11 +5633,13 @@
5265
5633
  tip: { type: String, required: false, default: "" },
5266
5634
  count: { type: Number, required: false, default: 0 },
5267
5635
  beforeUpload: { type: Function, required: false, default: void 0 },
5268
- layout: { type: String, required: false, default: "inline" }
5636
+ layout: { type: String, required: false, default: "inline" },
5637
+ locale: { type: null, required: false, default: void 0 }
5269
5638
  },
5270
5639
  emits: ["update:modelValue", "change", "exceed", "delete"],
5271
5640
  setup(__props, { expose: __expose, emit: __emit }) {
5272
5641
  const props = __props;
5642
+ const dict = useLocaleDict(() => props.locale);
5273
5643
  const emit = __emit;
5274
5644
  const innerList = vue.ref(props.modelValue ? [...props.modelValue] : []);
5275
5645
  vue.watch(() => props.modelValue, (v) => {
@@ -5378,7 +5748,7 @@
5378
5748
  type: "button",
5379
5749
  class: vue.normalizeClass(["fv-attachments-trigger", { "is-full": full.value }]),
5380
5750
  disabled: full.value,
5381
- "aria-label": "\u6DFB\u52A0\u9644\u4EF6",
5751
+ "aria-label": vue.unref(dict).attachments.add,
5382
5752
  onClick: openSelect
5383
5753
  }, [
5384
5754
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
@@ -5390,7 +5760,7 @@
5390
5760
  })
5391
5761
  ], 10, _hoisted_3$5)) : vue.createCommentVNode("v-if", true),
5392
5762
  vue.createCommentVNode(" \u6587\u4EF6\u5217\u8868:FilesCard;#list-thumb/#list-item \u8986\u76D6\u9879\u6E32\u67D3(triggerOnly \u5E03\u5C40\u4E0D\u6E32\u67D3) "),
5393
- list.value.length && __props.layout !== "triggerOnly" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$4, [
5763
+ list.value.length && __props.layout !== "triggerOnly" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$3, [
5394
5764
  (vue.openBlock(true), vue.createElementBlock(
5395
5765
  vue.Fragment,
5396
5766
  null,
@@ -5430,7 +5800,7 @@
5430
5800
  key: 0,
5431
5801
  type: "button",
5432
5802
  class: "fv-attachments-retry",
5433
- "aria-label": "\u91CD\u4F20",
5803
+ "aria-label": vue.unref(dict).attachments.retry,
5434
5804
  onClick: ($event) => retry(item)
5435
5805
  }, [
5436
5806
  vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
@@ -5440,7 +5810,7 @@
5440
5810
  _: 1
5441
5811
  /* STABLE */
5442
5812
  })
5443
- ], 8, _hoisted_5$1)) : vue.createCommentVNode("v-if", true)
5813
+ ], 8, _hoisted_5$2)) : vue.createCommentVNode("v-if", true)
5444
5814
  ])
5445
5815
  ]);
5446
5816
  }),
@@ -5467,7 +5837,8 @@
5467
5837
  };
5468
5838
  const _hoisted_2$4 = ["onClick"];
5469
5839
  const _hoisted_3$4 = { class: "fv-conversations-item-content" };
5470
- const _hoisted_4$3 = ["title"];
5840
+ const _hoisted_4$2 = ["title"];
5841
+ const _hoisted_5$1 = ["aria-label"];
5471
5842
  var _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
5472
5843
  ...{ name: "FvConversations" },
5473
5844
  __name: "index",
@@ -5477,11 +5848,13 @@
5477
5848
  showBuiltInMenuType: { type: String, required: false, default: "hover" },
5478
5849
  groupable: { type: Function, required: false, default: void 0 },
5479
5850
  loading: { type: Boolean, required: false, default: false },
5480
- hasMore: { type: Boolean, required: false, default: false }
5851
+ hasMore: { type: Boolean, required: false, default: false },
5852
+ locale: { type: null, required: false, default: void 0 }
5481
5853
  },
5482
5854
  emits: ["update:active", "change", "menu-command", "load-more"],
5483
5855
  setup(__props, { expose: __expose, emit: __emit }) {
5484
5856
  const props = __props;
5857
+ const dict = useLocaleDict(() => props.locale);
5485
5858
  const emit = __emit;
5486
5859
  const innerActive = vue.ref(props.active);
5487
5860
  vue.watch(() => props.active, (v) => {
@@ -5534,11 +5907,11 @@
5534
5907
  const item = props.items.find((i) => i.key === key);
5535
5908
  if (!item) return;
5536
5909
  try {
5537
- const { value } = await elementPlus.ElMessageBox.prompt("\u8BF7\u8F93\u5165\u65B0\u7684\u4F1A\u8BDD\u540D\u79F0", "\u91CD\u547D\u540D\u4F1A\u8BDD", {
5538
- confirmButtonText: "\u786E\u5B9A",
5539
- cancelButtonText: "\u53D6\u6D88",
5910
+ const { value } = await elementPlus.ElMessageBox.prompt(dict.value.conversations.renamePrompt, dict.value.conversations.renameTitle, {
5911
+ confirmButtonText: dict.value.common.confirm,
5912
+ cancelButtonText: dict.value.common.cancel,
5540
5913
  inputValue: item.label,
5541
- inputPlaceholder: "\u8BF7\u8F93\u5165\u540D\u79F0"
5914
+ inputPlaceholder: dict.value.conversations.renamePlaceholder
5542
5915
  });
5543
5916
  if (value && value.trim()) emit("menu-command", { item, command: "rename", value: value.trim() });
5544
5917
  } catch {
@@ -5548,11 +5921,15 @@
5548
5921
  const item = props.items.find((i) => i.key === key);
5549
5922
  if (!item) return;
5550
5923
  try {
5551
- await elementPlus.ElMessageBox.confirm(`\u786E\u5B9A\u5220\u9664\u4F1A\u8BDD\u300C${item.label}\u300D\u5417?\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002`, "\u5220\u9664\u4F1A\u8BDD", {
5552
- confirmButtonText: "\u5220\u9664",
5553
- cancelButtonText: "\u53D6\u6D88",
5554
- type: "warning"
5555
- });
5924
+ await elementPlus.ElMessageBox.confirm(
5925
+ dict.value.conversations.deleteConfirm.split("{label}").join(item.label),
5926
+ dict.value.conversations.deleteTitle,
5927
+ {
5928
+ confirmButtonText: dict.value.conversations.delete,
5929
+ cancelButtonText: dict.value.common.cancel,
5930
+ type: "warning"
5931
+ }
5932
+ );
5556
5933
  emit("menu-command", { item, command: "delete" });
5557
5934
  } catch {
5558
5935
  }
@@ -5606,7 +5983,7 @@
5606
5983
  vue.createElementVNode("span", {
5607
5984
  class: "fv-conversations-item-label",
5608
5985
  title: item.label
5609
- }, vue.toDisplayString(item.label), 9, _hoisted_4$3)
5986
+ }, vue.toDisplayString(item.label), 9, _hoisted_4$2)
5610
5987
  ])
5611
5988
  ]),
5612
5989
  vue.createCommentVNode(" \u5185\u7F6E\u83DC\u5355:hover \u663E\u793A\u6309\u94AE \u2192 el-dropdown(\u91CD\u547D\u540D/\u5220\u9664);#menu \u8986\u76D6\u83DC\u5355\u5217\u8868 "),
@@ -5624,24 +6001,24 @@
5624
6001
  default: vue.withCtx(() => [
5625
6002
  vue.renderSlot(_ctx.$slots, "menu", { item }, () => [
5626
6003
  vue.createVNode(vue.unref(elementPlus.ElDropdownItem), { command: "rename" }, {
5627
- default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
6004
+ default: vue.withCtx(() => [
5628
6005
  vue.createTextVNode(
5629
- "\u91CD\u547D\u540D",
5630
- -1
5631
- /* CACHED */
6006
+ vue.toDisplayString(vue.unref(dict).conversations.rename),
6007
+ 1
6008
+ /* TEXT */
5632
6009
  )
5633
- ])]),
6010
+ ]),
5634
6011
  _: 1
5635
6012
  /* STABLE */
5636
6013
  }),
5637
6014
  vue.createVNode(vue.unref(elementPlus.ElDropdownItem), { command: "delete" }, {
5638
- default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
6015
+ default: vue.withCtx(() => [
5639
6016
  vue.createTextVNode(
5640
- "\u5220\u9664",
5641
- -1
5642
- /* CACHED */
6017
+ vue.toDisplayString(vue.unref(dict).conversations.delete),
6018
+ 1
6019
+ /* TEXT */
5643
6020
  )
5644
- ])]),
6021
+ ]),
5645
6022
  _: 1
5646
6023
  /* STABLE */
5647
6024
  })
@@ -5658,7 +6035,7 @@
5658
6035
  vue.createElementVNode("button", {
5659
6036
  type: "button",
5660
6037
  class: "fv-conversations-menu-btn",
5661
- "aria-label": "\u4F1A\u8BDD\u64CD\u4F5C",
6038
+ "aria-label": vue.unref(dict).conversations.menuLabel,
5662
6039
  onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
5663
6040
  }, ["stop"]))
5664
6041
  }, [
@@ -5669,7 +6046,7 @@
5669
6046
  _: 1
5670
6047
  /* STABLE */
5671
6048
  })
5672
- ])
6049
+ ], 8, _hoisted_5$1)
5673
6050
  ]),
5674
6051
  _: 2
5675
6052
  /* DYNAMIC */
@@ -5776,7 +6153,7 @@
5776
6153
  return;
5777
6154
  }
5778
6155
  if (!res.body) {
5779
- handlers.onError(new Error("\u54CD\u5E94\u65E0 body"));
6156
+ handlers.onError(new Error(getGlobalLocale().errors.noBody));
5780
6157
  return;
5781
6158
  }
5782
6159
  const parser = createSSEParser((ev) => {
@@ -6080,6 +6457,7 @@
6080
6457
  return void 0;
6081
6458
  }
6082
6459
  function useChat(options) {
6460
+ const dict = () => options.locale ? options.locale() : getGlobalLocale();
6083
6461
  function resolveModels() {
6084
6462
  if (!options.models) return [""];
6085
6463
  return typeof options.models === "function" ? options.models() : options.models;
@@ -6097,11 +6475,10 @@
6097
6475
  const fileParts = [];
6098
6476
  for (const m of chain) {
6099
6477
  if (m.files?.length) {
6100
- fileParts.push(m.files.map((f) => `[\u9644\u4EF6] ${f.name}${f.type === "image" ? "(\u56FE\u7247)" : ""}`).join("\n"));
6478
+ fileParts.push(m.files.map((f) => dict().chat.fileTag.split("{name}").join(f.name) + (f.type === "image" ? dict().chat.fileImageTag : "")).join("\n"));
6101
6479
  }
6102
6480
  }
6103
- if (fileParts.length) out.push({ role: "system", content: `\u7528\u6237\u968F\u6D88\u606F\u63D0\u4F9B\u4E86\u4EE5\u4E0B\u6587\u4EF6:
6104
- ${fileParts.join("\n")}` });
6481
+ if (fileParts.length) out.push({ role: "system", content: dict().chat.filesSystemPrompt.split("{files}").join(fileParts.join("\n")) });
6105
6482
  if (extraSystem) out.push({ role: "system", content: extraSystem });
6106
6483
  for (const m of chain) {
6107
6484
  if (m.role === "assistant" && !m.content) continue;
@@ -6173,7 +6550,7 @@ ${fileParts.join("\n")}` });
6173
6550
  ...steps[i],
6174
6551
  status: "success",
6175
6552
  // 用时回写 description(历史回放同款);丢 start 的补 done 步无起点,保持原 description
6176
- description: typeof startedAt === "number" ? `\u7528\u65F6 ${((Date.now() - startedAt) / 1e3).toFixed(1)}s` : steps[i].description
6553
+ description: typeof startedAt === "number" ? dict().chat.toolDuration.split("{s}").join(`${((Date.now() - startedAt) / 1e3).toFixed(1)}s`) : steps[i].description
6177
6554
  };
6178
6555
  }
6179
6556
  msgs.edit(assistantId, { toolSteps: steps });
@@ -6259,7 +6636,7 @@ ${fileParts.join("\n")}` });
6259
6636
  msgs.setCurrent(target.id);
6260
6637
  isLoading.value = true;
6261
6638
  try {
6262
- const req = buildRequestMessages("\u8BF7\u57FA\u4E8E\u4EE5\u4E0A\u5185\u5BB9\u7EE7\u7EED\u5B8C\u6210\u56DE\u7B54,\u4E0D\u8981\u91CD\u590D\u5DF2\u6709\u5185\u5BB9\u3002");
6639
+ const req = buildRequestMessages(dict().chat.continuePrompt);
6263
6640
  await generateInto(target.id, req, target.model);
6264
6641
  } finally {
6265
6642
  isLoading.value = false;
@@ -6293,7 +6670,7 @@ ${fileParts.join("\n")}` });
6293
6670
  class: "fv-msg-avatar"
6294
6671
  };
6295
6672
  const _hoisted_3$3 = ["src"];
6296
- const _hoisted_4$2 = ["src"];
6673
+ const _hoisted_4$1 = ["src"];
6297
6674
  const _hoisted_5 = { class: "fv-msg-main" };
6298
6675
  const _hoisted_6 = {
6299
6676
  key: 0,
@@ -6352,11 +6729,14 @@ ${fileParts.join("\n")}` });
6352
6729
  assistantName: { type: String, required: false, default: "" },
6353
6730
  autoCollapse: { type: Boolean, required: false, default: true },
6354
6731
  typing: { type: [Boolean, Object], required: false, default: false },
6355
- collapsible: { type: Boolean, required: false, default: false }
6732
+ collapsible: { type: Boolean, required: false, default: false },
6733
+ codeTriggerLangs: { type: Array, required: false },
6734
+ locale: { type: null, required: false }
6356
6735
  },
6357
6736
  emits: ["copy", "regenerate", "branch-change", "typing"],
6358
6737
  setup(__props, { expose: __expose, emit: __emit }) {
6359
6738
  const props = __props;
6739
+ const dict = useLocaleDict(() => props.locale);
6360
6740
  const emit = __emit;
6361
6741
  const isUser = vue.computed(() => props.message.role === "user");
6362
6742
  const thinkingStatus = vue.computed(() => {
@@ -6404,10 +6784,10 @@ ${fileParts.join("\n")}` });
6404
6784
  }
6405
6785
  if (running) {
6406
6786
  const loading = s.status !== "error" && s.status !== "success";
6407
- return loading ? { ...s, status: "loading", title: `\u6B63\u5728\u67E5\u8BE2${s.title ?? ""}` } : { ...s, icon: toolStepIcon, title: `\u5DF2\u67E5\u8BE2${s.title ?? ""}` };
6787
+ return loading ? { ...s, status: "loading", title: dict.value.aiMessage.querying + (s.title ?? "") } : { ...s, icon: toolStepIcon, title: dict.value.aiMessage.queried + (s.title ?? "") };
6408
6788
  }
6409
6789
  const settled = s.status === "success" || s.status === "error" ? s.status : props.message.status === "error" ? "error" : "success";
6410
- return { ...s, status: settled, icon: toolStepIcon, title: `\u5DF2\u67E5\u8BE2${s.title ?? ""}` };
6790
+ return { ...s, status: settled, icon: toolStepIcon, title: dict.value.aiMessage.queried + (s.title ?? "") };
6411
6791
  });
6412
6792
  });
6413
6793
  const modelLabel = vue.computed(() => props.message.model ?? "");
@@ -6426,7 +6806,7 @@ ${fileParts.join("\n")}` });
6426
6806
  class: vue.normalizeClass(["fv-msg", [`is-${__props.message.role}`, { "is-error": __props.message.status === "error", "is-user": isUser.value }]]),
6427
6807
  "data-message-id": __props.message.id
6428
6808
  }, [
6429
- vue.createCommentVNode(" \u5934\u50CF:user \u53F3\u4FA7(\u81EA\u8EAB),assistant \u5DE6\u4FA7;\u663E\u9690\u5F00\u5173\u5173\u95ED\u65F6\u4E0D\u6E32\u67D3;\n \u4F18\u5148\u7EA7:message-avatar \u6574\u4F53\u63D2\u69FD > user-avatar/assistant-avatar \u7EC6\u5206\u63D2\u69FD > props \u56FE\u7247 > \u5185\u7F6E\u56FE\u6807 "),
6809
+ vue.createCommentVNode(" \u5934\u50CF:user \u53F3\u4FA7(\u81EA\u8EAB),assistant \u5DE6\u4FA7;\u663E\u9690\u5F00\u5173\u5173\u95ED\u65F6\u4E0D\u6E32\u67D3;\r\n \u4F18\u5148\u7EA7:message-avatar \u6574\u4F53\u63D2\u69FD > user-avatar/assistant-avatar \u7EC6\u5206\u63D2\u69FD > props \u56FE\u7247 > \u5185\u7F6E\u56FE\u6807 "),
6430
6810
  (isUser.value ? __props.showUserAvatar : __props.showAssistantAvatar) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$3, [
6431
6811
  vue.renderSlot(_ctx.$slots, "message-avatar", { message: __props.message }, () => [
6432
6812
  isUser.value ? vue.renderSlot(_ctx.$slots, "user-avatar", {}, () => [
@@ -6453,7 +6833,7 @@ ${fileParts.join("\n")}` });
6453
6833
  class: "fv-msg-avatar-img",
6454
6834
  src: __props.assistantAvatar || vue.unref(defaultAssistantAvatar),
6455
6835
  alt: ""
6456
- }, null, 8, _hoisted_4$2)
6836
+ }, null, 8, _hoisted_4$1)
6457
6837
  ], void 0, 1)
6458
6838
  ])
6459
6839
  ])) : vue.createCommentVNode("v-if", true),
@@ -6462,13 +6842,13 @@ ${fileParts.join("\n")}` });
6462
6842
  (isUser.value ? __props.showUserName : __props.showAssistantName) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
6463
6843
  isUser.value ? vue.renderSlot(_ctx.$slots, "user-name", { message: __props.message }, () => [
6464
6844
  vue.createTextVNode(
6465
- vue.toDisplayString(__props.userName || "\u4F60"),
6845
+ vue.toDisplayString(__props.userName || vue.unref(dict).aiMessage.defaultUserName),
6466
6846
  1
6467
6847
  /* TEXT */
6468
6848
  )
6469
6849
  ], void 0, 0) : vue.renderSlot(_ctx.$slots, "assistant-name", { message: __props.message }, () => [
6470
6850
  vue.createTextVNode(
6471
- vue.toDisplayString(__props.assistantName || "\u5C0F\u7EF4"),
6851
+ vue.toDisplayString(__props.assistantName || vue.unref(dict).aiMessage.defaultAssistantName),
6472
6852
  1
6473
6853
  /* TEXT */
6474
6854
  )
@@ -6520,7 +6900,7 @@ ${fileParts.join("\n")}` });
6520
6900
  ))
6521
6901
  ])
6522
6902
  ])) : vue.createCommentVNode("v-if", true),
6523
- vue.createCommentVNode(" \u601D\u8003\u94FE(assistant \u542B toolSteps/reasoning \u65F6):Thinking \u6298\u53E0\u5934\u627F\u8F7D\u72B6\u6001\u6587\u6848\u4E0E\n \u6536\u8D77/\u5C55\u5F00(\u6D41\u5F0F\u9ED8\u8BA4\u5C55\u5F00\u770B\u8FDB\u5EA6,\u843D\u5B9A/\u5386\u53F2\u6536\u8D77,\u70B9\u51FB\u56DE\u770B);\u601D\u8003\u6BB5\u6B65\u4E0E\u5DE5\u5177\u6B65\n \u7ECF ThoughtChain \u7EB5\u5411\u6B65\u9AA4\u94FE\u6309\u53D1\u751F\u987A\u5E8F\u6DF7\u6392(\u601D\u8003\u6587\u672C\u7EC7\u5165\u94FE\u4E0A text \u6B65),\u6B63\u6587\u4E4B\u4E0A;\n \u4EC5 reasoning \u65E0 toolSteps \u65F6(\u7EAF\u601D\u8003\u6D88\u606F)\u56DE\u843D\u94FE\u4E0B Markdown \u6E32\u67D3 "),
6903
+ vue.createCommentVNode(" \u601D\u8003\u94FE(assistant \u542B toolSteps/reasoning \u65F6):Thinking \u6298\u53E0\u5934\u627F\u8F7D\u72B6\u6001\u6587\u6848\u4E0E\r\n \u6536\u8D77/\u5C55\u5F00(\u6D41\u5F0F\u9ED8\u8BA4\u5C55\u5F00\u770B\u8FDB\u5EA6,\u843D\u5B9A/\u5386\u53F2\u6536\u8D77,\u70B9\u51FB\u56DE\u770B);\u601D\u8003\u6BB5\u6B65\u4E0E\u5DE5\u5177\u6B65\r\n \u7ECF ThoughtChain \u7EB5\u5411\u6B65\u9AA4\u94FE\u6309\u53D1\u751F\u987A\u5E8F\u6DF7\u6392(\u601D\u8003\u6587\u672C\u7EC7\u5165\u94FE\u4E0A text \u6B65),\u6B63\u6587\u4E4B\u4E0A;\r\n \u4EC5 reasoning \u65E0 toolSteps \u65F6(\u7EAF\u601D\u8003\u6D88\u606F)\u56DE\u843D\u94FE\u4E0B Markdown \u6E32\u67D3 "),
6524
6904
  !isUser.value && (hasToolSteps.value || hasReasoning.value) ? (vue.openBlock(), vue.createBlock(_sfc_main$a, {
6525
6905
  key: 2,
6526
6906
  modelValue: toolsExpanded.value,
@@ -6554,7 +6934,7 @@ ${fileParts.join("\n")}` });
6554
6934
  __props.message.status === "error" ? (vue.openBlock(), vue.createElementBlock(
6555
6935
  "span",
6556
6936
  _hoisted_12,
6557
- vue.toDisplayString(__props.message.error || "\u751F\u6210\u5931\u8D25"),
6937
+ vue.toDisplayString(__props.message.error || vue.unref(dict).aiMessage.generateFailed),
6558
6938
  1
6559
6939
  /* TEXT */
6560
6940
  )) : useTypewriter.value && __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$h, {
@@ -6562,11 +6942,13 @@ ${fileParts.join("\n")}` });
6562
6942
  content: __props.message.content,
6563
6943
  "is-markdown": "",
6564
6944
  typing: __props.typing,
6945
+ "code-trigger-langs": __props.codeTriggerLangs,
6565
6946
  onWriting: _cache[3] || (_cache[3] = ($event) => emit("typing"))
6566
- }, null, 8, ["content", "typing"])) : __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
6947
+ }, null, 8, ["content", "typing", "code-trigger-langs"])) : __props.message.content ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
6567
6948
  key: 2,
6568
- content: __props.message.content
6569
- }, null, 8, ["content"])) : (__props.message.status === "pending" || __props.message.status === "streaming") && !hasToolSteps.value ? (vue.openBlock(), vue.createElementBlock(
6949
+ content: __props.message.content,
6950
+ "code-trigger-langs": __props.codeTriggerLangs
6951
+ }, null, 8, ["content", "code-trigger-langs"])) : (__props.message.status === "pending" || __props.message.status === "streaming") && !hasToolSteps.value ? (vue.openBlock(), vue.createElementBlock(
6570
6952
  vue.Fragment,
6571
6953
  { key: 3 },
6572
6954
  [
@@ -6608,7 +6990,7 @@ ${fileParts.join("\n")}` });
6608
6990
  vue.renderSlot(_ctx.$slots, "message-actions", { message: __props.message }, () => [
6609
6991
  __props.showActions && isUser.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
6610
6992
  key: 0,
6611
- content: "\u590D\u5236",
6993
+ content: vue.unref(dict).aiMessage.copy,
6612
6994
  placement: "top"
6613
6995
  }, {
6614
6996
  default: vue.withCtx(() => [
@@ -6616,7 +6998,7 @@ ${fileParts.join("\n")}` });
6616
6998
  text: "",
6617
6999
  size: "small",
6618
7000
  class: "fv-msg-action",
6619
- "aria-label": "\u590D\u5236",
7001
+ "aria-label": vue.unref(dict).aiMessage.copy,
6620
7002
  onClick: onCopy
6621
7003
  }, {
6622
7004
  default: vue.withCtx(() => [
@@ -6630,14 +7012,14 @@ ${fileParts.join("\n")}` });
6630
7012
  ]),
6631
7013
  _: 1
6632
7014
  /* STABLE */
6633
- })
7015
+ }, 8, ["aria-label"])
6634
7016
  ]),
6635
7017
  _: 1
6636
7018
  /* STABLE */
6637
- })) : vue.createCommentVNode("v-if", true),
7019
+ }, 8, ["content"])) : vue.createCommentVNode("v-if", true),
6638
7020
  __props.showActions && !isUser.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
6639
7021
  key: 1,
6640
- content: "\u590D\u5236",
7022
+ content: vue.unref(dict).aiMessage.copy,
6641
7023
  placement: "top"
6642
7024
  }, {
6643
7025
  default: vue.withCtx(() => [
@@ -6645,7 +7027,7 @@ ${fileParts.join("\n")}` });
6645
7027
  text: "",
6646
7028
  size: "small",
6647
7029
  class: "fv-msg-action",
6648
- "aria-label": "\u590D\u5236",
7030
+ "aria-label": vue.unref(dict).aiMessage.copy,
6649
7031
  onClick: onCopy
6650
7032
  }, {
6651
7033
  default: vue.withCtx(() => [
@@ -6659,14 +7041,14 @@ ${fileParts.join("\n")}` });
6659
7041
  ]),
6660
7042
  _: 1
6661
7043
  /* STABLE */
6662
- })
7044
+ }, 8, ["aria-label"])
6663
7045
  ]),
6664
7046
  _: 1
6665
7047
  /* STABLE */
6666
- })) : vue.createCommentVNode("v-if", true),
7048
+ }, 8, ["content"])) : vue.createCommentVNode("v-if", true),
6667
7049
  __props.showActions && !isUser.value ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
6668
7050
  key: 2,
6669
- content: "\u91CD\u65B0\u751F\u6210",
7051
+ content: vue.unref(dict).aiMessage.regenerate,
6670
7052
  placement: "top"
6671
7053
  }, {
6672
7054
  default: vue.withCtx(() => [
@@ -6674,7 +7056,7 @@ ${fileParts.join("\n")}` });
6674
7056
  text: "",
6675
7057
  size: "small",
6676
7058
  class: "fv-msg-action",
6677
- "aria-label": "\u91CD\u65B0\u751F\u6210",
7059
+ "aria-label": vue.unref(dict).aiMessage.regenerate,
6678
7060
  onClick: onRegenerate
6679
7061
  }, {
6680
7062
  default: vue.withCtx(() => [
@@ -6688,11 +7070,11 @@ ${fileParts.join("\n")}` });
6688
7070
  ]),
6689
7071
  _: 1
6690
7072
  /* STABLE */
6691
- })
7073
+ }, 8, ["aria-label"])
6692
7074
  ]),
6693
7075
  _: 1
6694
7076
  /* STABLE */
6695
- })) : vue.createCommentVNode("v-if", true)
7077
+ }, 8, ["content"])) : vue.createCommentVNode("v-if", true)
6696
7078
  ]),
6697
7079
  vue.createCommentVNode(" \u5206\u652F\u5207\u6362:\u5144\u5F1F\u5206\u652F > 1 \u65F6 "),
6698
7080
  __props.showBranchSwitch && __props.branch && __props.branch.count > 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_16, [
@@ -6701,7 +7083,7 @@ ${fileParts.join("\n")}` });
6701
7083
  size: "small",
6702
7084
  class: "fv-msg-action",
6703
7085
  disabled: __props.branch.index <= 1,
6704
- "aria-label": "\u4E0A\u4E00\u5206\u652F",
7086
+ "aria-label": vue.unref(dict).aiMessage.prevBranch,
6705
7087
  onClick: _cache[4] || (_cache[4] = ($event) => onBranch("prev"))
6706
7088
  }, {
6707
7089
  default: vue.withCtx(() => [
@@ -6715,7 +7097,7 @@ ${fileParts.join("\n")}` });
6715
7097
  ]),
6716
7098
  _: 1
6717
7099
  /* STABLE */
6718
- }, 8, ["disabled"]),
7100
+ }, 8, ["disabled", "aria-label"]),
6719
7101
  vue.createElementVNode(
6720
7102
  "span",
6721
7103
  _hoisted_17,
@@ -6728,7 +7110,7 @@ ${fileParts.join("\n")}` });
6728
7110
  size: "small",
6729
7111
  class: "fv-msg-action",
6730
7112
  disabled: __props.branch.index >= __props.branch.count,
6731
- "aria-label": "\u4E0B\u4E00\u5206\u652F",
7113
+ "aria-label": vue.unref(dict).aiMessage.nextBranch,
6732
7114
  onClick: _cache[5] || (_cache[5] = ($event) => onBranch("next"))
6733
7115
  }, {
6734
7116
  default: vue.withCtx(() => [
@@ -6742,7 +7124,7 @@ ${fileParts.join("\n")}` });
6742
7124
  ]),
6743
7125
  _: 1
6744
7126
  /* STABLE */
6745
- }, 8, ["disabled"])
7127
+ }, 8, ["disabled", "aria-label"])
6746
7128
  ])) : vue.createCommentVNode("v-if", true)
6747
7129
  ])) : vue.createCommentVNode("v-if", true)
6748
7130
  ])
@@ -6782,11 +7164,14 @@ ${fileParts.join("\n")}` });
6782
7164
  userName: { type: String, required: false, default: "" },
6783
7165
  assistantName: { type: String, required: false, default: "" },
6784
7166
  typing: { type: [Boolean, Object], required: false, default: false },
6785
- collapsible: { type: Boolean, required: false, default: false }
7167
+ collapsible: { type: Boolean, required: false, default: false },
7168
+ codeTriggerLangs: { type: Array, required: false },
7169
+ locale: { type: null, required: false }
6786
7170
  },
6787
7171
  emits: ["select", "copy", "regenerate", "branch-change"],
6788
7172
  setup(__props, { expose: __expose, emit: __emit }) {
6789
7173
  const props = __props;
7174
+ const dict = useLocaleDict(() => props.locale);
6790
7175
  const emit = __emit;
6791
7176
  function onChildTyping() {
6792
7177
  followIfPinned();
@@ -6940,6 +7325,7 @@ ${fileParts.join("\n")}` });
6940
7325
  "assistant-name": __props.assistantName,
6941
7326
  typing: __props.typing,
6942
7327
  collapsible: __props.collapsible,
7328
+ "code-trigger-langs": __props.codeTriggerLangs,
6943
7329
  onTyping: onChildTyping,
6944
7330
  onCopy,
6945
7331
  onRegenerate,
@@ -6990,7 +7376,7 @@ ${fileParts.join("\n")}` });
6990
7376
  ]),
6991
7377
  key: "5"
6992
7378
  } : void 0
6993
- ]), 1032, ["message", "branch", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "user-name", "assistant-name", "typing", "collapsible"]);
7379
+ ]), 1032, ["message", "branch", "show-actions", "show-branch-switch", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "user-name", "assistant-name", "typing", "collapsible", "code-trigger-langs"]);
6994
7380
  }),
6995
7381
  128
6996
7382
  /* KEYED_FRAGMENT */
@@ -7006,7 +7392,7 @@ ${fileParts.join("\n")}` });
7006
7392
  key: 0,
7007
7393
  class: "fv-messages-back",
7008
7394
  circle: "",
7009
- "aria-label": "\u6EDA\u52A8\u5230\u5E95\u90E8",
7395
+ "aria-label": vue.unref(dict).scroll.toBottom,
7010
7396
  onClick: _cache[0] || (_cache[0] = ($event) => scrollToBottom())
7011
7397
  }, {
7012
7398
  default: vue.withCtx(() => [
@@ -7022,7 +7408,7 @@ ${fileParts.join("\n")}` });
7022
7408
  ]),
7023
7409
  _: 3
7024
7410
  /* FORWARDED */
7025
- })) : vue.createCommentVNode("v-if", true)
7411
+ }, 8, ["aria-label"])) : vue.createCommentVNode("v-if", true)
7026
7412
  ])
7027
7413
  ]),
7028
7414
  _: 3
@@ -7042,13 +7428,9 @@ ${fileParts.join("\n")}` });
7042
7428
  }
7043
7429
  });
7044
7430
 
7045
- const _hoisted_1$1 = {
7046
- key: 0,
7047
- class: "fv-artifacts"
7048
- };
7049
- const _hoisted_2$1 = { class: "fv-artifacts-tabs" };
7050
- const _hoisted_3$1 = ["onClick"];
7051
- const _hoisted_4$1 = ["srcdoc"];
7431
+ const _hoisted_1$1 = { class: "fv-artifacts-tabs" };
7432
+ const _hoisted_2$1 = ["onClick"];
7433
+ const _hoisted_3$1 = ["srcdoc"];
7052
7434
  const NAV_SCRIPT = `<script>(function(){
7053
7435
  document.addEventListener('click',function(e){
7054
7436
  var t=e.target&&e.target.closest?e.target.closest('a'):null;
@@ -7061,11 +7443,16 @@ ${fileParts.join("\n")}` });
7061
7443
  __name: "index",
7062
7444
  props: {
7063
7445
  artifacts: { type: Array, required: true, default: () => [] },
7064
- activeKey: { type: String, required: false, default: "" }
7446
+ activeKey: { type: String, required: false, default: "" },
7447
+ width: { type: String, required: false, default: "420px" },
7448
+ minWidth: { type: String, required: false, default: "360px" },
7449
+ maxWidth: { type: String, required: false, default: "60%" },
7450
+ locale: { type: null, required: false }
7065
7451
  },
7066
7452
  emits: ["close", "change", "navigate"],
7067
7453
  setup(__props, { expose: __expose, emit: __emit }) {
7068
7454
  const props = __props;
7455
+ const dict = useLocaleDict(() => props.locale);
7069
7456
  const emit = __emit;
7070
7457
  const visible = vue.ref(props.activeKey !== "");
7071
7458
  vue.watch(() => props.activeKey, (k) => {
@@ -7151,143 +7538,157 @@ ${fileParts.join("\n")}` });
7151
7538
  vue.Fragment,
7152
7539
  null,
7153
7540
  [
7154
- vue.createCommentVNode(" activeKey \u4E3A\u7A7A\u65F6\u4E0D\u6E32\u67D3\u9762\u677F "),
7155
- visible.value && current.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
7156
- vue.createCommentVNode(" tab \u5207\u6362\u680F "),
7157
- vue.createElementVNode("div", _hoisted_2$1, [
7158
- (vue.openBlock(true), vue.createElementBlock(
7159
- vue.Fragment,
7160
- null,
7161
- vue.renderList(__props.artifacts, (a) => {
7162
- return vue.openBlock(), vue.createElementBlock("button", {
7163
- key: a.key,
7164
- type: "button",
7165
- class: vue.normalizeClass(["fv-artifact-tab", { "is-active": a.key === currentKey.value }]),
7166
- onClick: ($event) => select(a.key)
7167
- }, vue.toDisplayString(a.title || a.key), 11, _hoisted_3$1);
7168
- }),
7169
- 128
7170
- /* KEYED_FRAGMENT */
7171
- )),
7172
- _cache[0] || (_cache[0] = vue.createElementVNode(
7173
- "span",
7174
- { class: "fv-artifacts-spacer" },
7175
- null,
7176
- -1
7177
- /* CACHED */
7178
- )),
7179
- vue.createVNode(vue.unref(elementPlus.ElTooltip), {
7180
- content: "\u590D\u5236",
7181
- placement: "top"
7182
- }, {
7183
- default: vue.withCtx(() => [
7184
- vue.createVNode(vue.unref(elementPlus.ElButton), {
7185
- text: "",
7186
- size: "small",
7187
- "aria-label": "\u590D\u5236",
7188
- onClick: onCopy
7189
- }, {
7190
- default: vue.withCtx(() => [
7191
- vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7192
- default: vue.withCtx(() => [
7193
- vue.createVNode(vue.unref(ElementPlusIconsVue.CopyDocument))
7194
- ]),
7195
- _: 1
7196
- /* STABLE */
7197
- })
7198
- ]),
7199
- _: 1
7200
- /* STABLE */
7201
- })
7202
- ]),
7203
- _: 1
7204
- /* STABLE */
7205
- }),
7206
- vue.createVNode(vue.unref(elementPlus.ElTooltip), {
7207
- content: "\u4E0B\u8F7D",
7208
- placement: "top"
7209
- }, {
7210
- default: vue.withCtx(() => [
7211
- vue.createVNode(vue.unref(elementPlus.ElButton), {
7212
- text: "",
7213
- size: "small",
7214
- "aria-label": "\u4E0B\u8F7D",
7215
- onClick: onDownload
7216
- }, {
7217
- default: vue.withCtx(() => [
7218
- vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7219
- default: vue.withCtx(() => [
7220
- vue.createVNode(vue.unref(ElementPlusIconsVue.Download))
7221
- ]),
7222
- _: 1
7223
- /* STABLE */
7224
- })
7225
- ]),
7226
- _: 1
7227
- /* STABLE */
7228
- })
7229
- ]),
7230
- _: 1
7231
- /* STABLE */
7232
- }),
7233
- current.value?.type === "html" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
7234
- key: 0,
7235
- content: "\u5168\u5C4F",
7236
- placement: "top"
7237
- }, {
7238
- default: vue.withCtx(() => [
7239
- vue.createVNode(vue.unref(elementPlus.ElButton), {
7240
- text: "",
7241
- size: "small",
7242
- "aria-label": "\u5168\u5C4F",
7243
- onClick: onFullscreen
7244
- }, {
7245
- default: vue.withCtx(() => [
7246
- vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7247
- default: vue.withCtx(() => [
7248
- vue.createVNode(vue.unref(ElementPlusIconsVue.FullScreen))
7249
- ]),
7250
- _: 1
7251
- /* STABLE */
7252
- })
7253
- ]),
7254
- _: 1
7255
- /* STABLE */
7256
- })
7257
- ]),
7258
- _: 1
7259
- /* STABLE */
7260
- })) : vue.createCommentVNode("v-if", true),
7261
- vue.createVNode(vue.unref(elementPlus.ElButton), {
7262
- text: "",
7263
- size: "small",
7264
- class: "fv-artifacts-close",
7265
- "aria-label": "\u5173\u95ED",
7266
- onClick: onClose
7267
- }, {
7268
- default: vue.withCtx(() => [
7269
- vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7270
- default: vue.withCtx(() => [
7271
- vue.createVNode(vue.unref(ElementPlusIconsVue.Close))
7272
- ]),
7273
- _: 1
7274
- /* STABLE */
7275
- })
7276
- ]),
7277
- _: 1
7278
- /* STABLE */
7541
+ vue.createCommentVNode(" activeKey \u4E3A\u7A7A\u65F6\u4E0D\u6E32\u67D3\u9762\u677F;\u5BBD\u5EA6\u7ECF CSS \u53D8\u91CF\u843D\u5730(width/min/max),\u6D88\u8D39\u65B9\u4EA6\u53EF\u7528\r\n --fv-artifacts-width \u7B49\u53D8\u91CF\u6574\u4F53\u8986\u76D6 "),
7542
+ visible.value && current.value ? (vue.openBlock(), vue.createElementBlock(
7543
+ "div",
7544
+ {
7545
+ key: 0,
7546
+ class: "fv-artifacts",
7547
+ style: vue.normalizeStyle({
7548
+ "--fv-artifacts-width": __props.width,
7549
+ "--fv-artifacts-min-width": __props.minWidth,
7550
+ "--fv-artifacts-max-width": __props.maxWidth
7279
7551
  })
7280
- ]),
7281
- vue.createCommentVNode(" iframe \u6C99\u7BB1\u9884\u89C8 "),
7282
- vue.createElementVNode("iframe", {
7283
- ref_key: "iframeRef",
7284
- ref: iframeRef,
7285
- class: "fv-artifacts-frame",
7286
- srcdoc: srcdoc.value,
7287
- sandbox: "allow-scripts allow-downloads",
7288
- title: "artifact-preview"
7289
- }, null, 8, _hoisted_4$1)
7290
- ])) : vue.createCommentVNode("v-if", true)
7552
+ },
7553
+ [
7554
+ vue.createCommentVNode(" tab \u5207\u6362\u680F "),
7555
+ vue.createElementVNode("div", _hoisted_1$1, [
7556
+ (vue.openBlock(true), vue.createElementBlock(
7557
+ vue.Fragment,
7558
+ null,
7559
+ vue.renderList(__props.artifacts, (a) => {
7560
+ return vue.openBlock(), vue.createElementBlock("button", {
7561
+ key: a.key,
7562
+ type: "button",
7563
+ class: vue.normalizeClass(["fv-artifact-tab", { "is-active": a.key === currentKey.value }]),
7564
+ onClick: ($event) => select(a.key)
7565
+ }, vue.toDisplayString(a.title || a.key), 11, _hoisted_2$1);
7566
+ }),
7567
+ 128
7568
+ /* KEYED_FRAGMENT */
7569
+ )),
7570
+ _cache[0] || (_cache[0] = vue.createElementVNode(
7571
+ "span",
7572
+ { class: "fv-artifacts-spacer" },
7573
+ null,
7574
+ -1
7575
+ /* CACHED */
7576
+ )),
7577
+ vue.createVNode(vue.unref(elementPlus.ElTooltip), {
7578
+ content: vue.unref(dict).aiArtifacts.copy,
7579
+ placement: "top"
7580
+ }, {
7581
+ default: vue.withCtx(() => [
7582
+ vue.createVNode(vue.unref(elementPlus.ElButton), {
7583
+ text: "",
7584
+ size: "small",
7585
+ "aria-label": vue.unref(dict).aiArtifacts.copy,
7586
+ onClick: onCopy
7587
+ }, {
7588
+ default: vue.withCtx(() => [
7589
+ vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7590
+ default: vue.withCtx(() => [
7591
+ vue.createVNode(vue.unref(ElementPlusIconsVue.CopyDocument))
7592
+ ]),
7593
+ _: 1
7594
+ /* STABLE */
7595
+ })
7596
+ ]),
7597
+ _: 1
7598
+ /* STABLE */
7599
+ }, 8, ["aria-label"])
7600
+ ]),
7601
+ _: 1
7602
+ /* STABLE */
7603
+ }, 8, ["content"]),
7604
+ vue.createVNode(vue.unref(elementPlus.ElTooltip), {
7605
+ content: vue.unref(dict).aiArtifacts.download,
7606
+ placement: "top"
7607
+ }, {
7608
+ default: vue.withCtx(() => [
7609
+ vue.createVNode(vue.unref(elementPlus.ElButton), {
7610
+ text: "",
7611
+ size: "small",
7612
+ "aria-label": vue.unref(dict).aiArtifacts.download,
7613
+ onClick: onDownload
7614
+ }, {
7615
+ default: vue.withCtx(() => [
7616
+ vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7617
+ default: vue.withCtx(() => [
7618
+ vue.createVNode(vue.unref(ElementPlusIconsVue.Download))
7619
+ ]),
7620
+ _: 1
7621
+ /* STABLE */
7622
+ })
7623
+ ]),
7624
+ _: 1
7625
+ /* STABLE */
7626
+ }, 8, ["aria-label"])
7627
+ ]),
7628
+ _: 1
7629
+ /* STABLE */
7630
+ }, 8, ["content"]),
7631
+ current.value?.type === "html" ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElTooltip), {
7632
+ key: 0,
7633
+ content: vue.unref(dict).aiArtifacts.fullscreen,
7634
+ placement: "top"
7635
+ }, {
7636
+ default: vue.withCtx(() => [
7637
+ vue.createVNode(vue.unref(elementPlus.ElButton), {
7638
+ text: "",
7639
+ size: "small",
7640
+ "aria-label": vue.unref(dict).aiArtifacts.fullscreen,
7641
+ onClick: onFullscreen
7642
+ }, {
7643
+ default: vue.withCtx(() => [
7644
+ vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7645
+ default: vue.withCtx(() => [
7646
+ vue.createVNode(vue.unref(ElementPlusIconsVue.FullScreen))
7647
+ ]),
7648
+ _: 1
7649
+ /* STABLE */
7650
+ })
7651
+ ]),
7652
+ _: 1
7653
+ /* STABLE */
7654
+ }, 8, ["aria-label"])
7655
+ ]),
7656
+ _: 1
7657
+ /* STABLE */
7658
+ }, 8, ["content"])) : vue.createCommentVNode("v-if", true),
7659
+ vue.createVNode(vue.unref(elementPlus.ElButton), {
7660
+ text: "",
7661
+ size: "small",
7662
+ class: "fv-artifacts-close",
7663
+ "aria-label": vue.unref(dict).aiArtifacts.close,
7664
+ onClick: onClose
7665
+ }, {
7666
+ default: vue.withCtx(() => [
7667
+ vue.createVNode(vue.unref(elementPlus.ElIcon), null, {
7668
+ default: vue.withCtx(() => [
7669
+ vue.createVNode(vue.unref(ElementPlusIconsVue.Close))
7670
+ ]),
7671
+ _: 1
7672
+ /* STABLE */
7673
+ })
7674
+ ]),
7675
+ _: 1
7676
+ /* STABLE */
7677
+ }, 8, ["aria-label"])
7678
+ ]),
7679
+ vue.createCommentVNode(" iframe \u6C99\u7BB1\u9884\u89C8 "),
7680
+ vue.createElementVNode("iframe", {
7681
+ ref_key: "iframeRef",
7682
+ ref: iframeRef,
7683
+ class: "fv-artifacts-frame",
7684
+ srcdoc: srcdoc.value,
7685
+ sandbox: "allow-scripts allow-downloads",
7686
+ title: "artifact-preview"
7687
+ }, null, 8, _hoisted_3$1)
7688
+ ],
7689
+ 4
7690
+ /* STYLE */
7691
+ )) : vue.createCommentVNode("v-if", true)
7291
7692
  ],
7292
7693
  2112
7293
7694
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -7337,11 +7738,14 @@ ${fileParts.join("\n")}` });
7337
7738
  allowAttachments: { type: Boolean, required: false, default: false },
7338
7739
  accept: { type: String, required: false, default: "" },
7339
7740
  attachmentLimit: { type: Number, required: false, default: 0 },
7340
- theme: { type: String, required: false, default: "light" }
7741
+ theme: { type: String, required: false, default: "light" },
7742
+ locale: { type: null, required: false }
7341
7743
  },
7342
7744
  emits: ["update:messages", "send", "message-complete", "error", "branch-change", "attachment-exceed", "tool-event"],
7343
7745
  setup(__props, { expose: __expose, emit: __emit }) {
7344
7746
  const props = __props;
7747
+ const dict = useLocaleDict(() => props.locale);
7748
+ provideLocale(dict);
7345
7749
  const emit = __emit;
7346
7750
  function resolveAdapter() {
7347
7751
  if (props.adapter) return props.adapter;
@@ -7350,7 +7754,7 @@ ${fileParts.join("\n")}` });
7350
7754
  }
7351
7755
  return {
7352
7756
  async send(_req, handlers) {
7353
- handlers.onError(new Error("\u672A\u914D\u7F6E adapter \u6216 baseURL"));
7757
+ handlers.onError(new Error(dict.value.aiChat.adapterMissing));
7354
7758
  },
7355
7759
  abort() {
7356
7760
  }
@@ -7364,8 +7768,19 @@ ${fileParts.join("\n")}` });
7364
7768
  let initialId = null;
7365
7769
  if (props.messages?.length) {
7366
7770
  const table = {};
7771
+ let prevId = null;
7367
7772
  for (const m of props.messages) {
7368
- table[m.id] = JSON.parse(JSON.stringify(m));
7773
+ const node = JSON.parse(JSON.stringify(m));
7774
+ if (node.parentId === void 0) node.parentId = prevId;
7775
+ if (!Array.isArray(node.childrenIds)) node.childrenIds = [];
7776
+ table[node.id] = node;
7777
+ prevId = node.id;
7778
+ }
7779
+ for (const node of Object.values(table)) {
7780
+ if (node.parentId !== null) {
7781
+ const parent = table[node.parentId];
7782
+ if (parent && !parent.childrenIds.includes(node.id)) parent.childrenIds.push(node.id);
7783
+ }
7369
7784
  }
7370
7785
  initialTable = table;
7371
7786
  initialId = props.messages[props.messages.length - 1]?.id ?? null;
@@ -7377,7 +7792,8 @@ ${fileParts.join("\n")}` });
7377
7792
  // 与 adapter/models 同语义按工厂惰性取用:options 在 setup 构造一次,
7378
7793
  // 按值快照会把父组件运行期更换的函数 prop 冻在旧引用上(换了映射不生效)
7379
7794
  toolStepLabel: (name) => props.toolStepLabel ? props.toolStepLabel(name) : name,
7380
- onToolEvent: (ev) => emit("tool-event", ev)
7795
+ onToolEvent: (ev) => emit("tool-event", ev),
7796
+ locale: () => dict.value
7381
7797
  });
7382
7798
  const { send, stop: stopChat, regenerate: regenerateChat, msgs, isLoading } = chat;
7383
7799
  const nodeTable = chat.messages;
@@ -7396,7 +7812,7 @@ ${fileParts.join("\n")}` });
7396
7812
  if (stopped) return;
7397
7813
  const last = chain.value[chain.value.length - 1];
7398
7814
  if (!last || last.role !== "assistant") return;
7399
- if (last.status === "error") emit("error", new Error(last.error || "\u751F\u6210\u5931\u8D25"), last);
7815
+ if (last.status === "error") emit("error", new Error(last.error || dict.value.aiChat.generateFailed), last);
7400
7816
  else if (last.content) emit("message-complete", last);
7401
7817
  }
7402
7818
  function finishRun() {
@@ -7472,8 +7888,14 @@ ${fileParts.join("\n")}` });
7472
7888
  for (const id of Object.keys(nodeTable.value)) msgs.remove(id);
7473
7889
  }
7474
7890
  function exportTxt() {
7475
- return chain.value.map((m) => `${m.role === "user" ? "\u4F60" : "\u52A9\u624B"}: ${m.content}`).join("\n\n");
7891
+ return chain.value.map((m) => `${m.role === "user" ? dict.value.aiChat.exportUser : dict.value.aiChat.exportAssistant}: ${m.content}`).join("\n\n");
7476
7892
  }
7893
+ const artifactsOn = vue.computed(() => !!props.features?.artifacts);
7894
+ const artifactsOpts = vue.computed(
7895
+ () => typeof props.features?.artifacts === "object" ? props.features.artifacts : {}
7896
+ );
7897
+ const artifactsAutoOpen = vue.computed(() => artifactsOpts.value.autoOpen !== false);
7898
+ const artifactsCodeTrigger = vue.computed(() => artifactsOpts.value.codeBlockTrigger !== false);
7477
7899
  const CODE_BLOCK_RE = /```(html|svg)\s*\n([\s\S]*?)```/gi;
7478
7900
  function extractArtifacts(m) {
7479
7901
  const out = [];
@@ -7493,7 +7915,7 @@ ${fileParts.join("\n")}` });
7493
7915
  return out;
7494
7916
  }
7495
7917
  const artifacts = vue.computed(() => {
7496
- if (!props.features?.artifacts) return [];
7918
+ if (!artifactsOn.value) return [];
7497
7919
  return chain.value.flatMap((m) => extractArtifacts(m));
7498
7920
  });
7499
7921
  const artifactActiveKey = vue.ref("");
@@ -7512,9 +7934,29 @@ ${fileParts.join("\n")}` });
7512
7934
  artifactUserClosed = false;
7513
7935
  }
7514
7936
  vue.watch(artifacts, (list) => {
7937
+ if (!artifactsAutoOpen.value) return;
7515
7938
  if (artifactUserClosed) return;
7516
7939
  if (list.length && !artifactActiveKey.value) artifactActiveKey.value = list[0].key;
7517
- });
7940
+ }, { immediate: true });
7941
+ function onBodyClick(e) {
7942
+ if (!artifactsOn.value || !artifactsCodeTrigger.value) return;
7943
+ const target = e.target;
7944
+ const btn = target?.closest?.("[data-fv-code-trigger]");
7945
+ if (!btn) return;
7946
+ e.preventDefault();
7947
+ const lang = btn.getAttribute("data-fv-code-trigger") ?? "";
7948
+ const msgEl = btn.closest(".fv-msg");
7949
+ const msgId = msgEl?.getAttribute("data-message-id") ?? "";
7950
+ if (!lang || !msgId || !msgEl) return;
7951
+ const pres = Array.from(msgEl.querySelectorAll("pre[data-fv-code-lang]"));
7952
+ const pre = btn.closest("pre");
7953
+ const idx = pre ? pres.indexOf(pre) : -1;
7954
+ if (idx < 0) return;
7955
+ const key = `${msgId}:${idx}:${lang}`;
7956
+ if (!artifacts.value.some((a) => a.key === key)) return;
7957
+ artifactUserClosed = false;
7958
+ artifactActiveKey.value = key;
7959
+ }
7518
7960
  vue.watch(artifacts, (list) => {
7519
7961
  if (artifactActiveKey.value && !list.some((a) => a.key === artifactActiveKey.value)) {
7520
7962
  artifactActiveKey.value = "";
@@ -7531,12 +7973,15 @@ ${fileParts.join("\n")}` });
7531
7973
  document.documentElement.classList.toggle("dark", isDark.value);
7532
7974
  }
7533
7975
  vue.watch(isDark, applyTheme, { immediate: true });
7976
+ const rootEl = vue.ref(null);
7534
7977
  vue.onMounted(() => {
7535
7978
  media?.addEventListener("change", onMediaChange);
7536
7979
  applyTheme();
7980
+ rootEl.value?.addEventListener("click", onBodyClick);
7537
7981
  });
7538
7982
  vue.onBeforeUnmount(() => {
7539
7983
  media?.removeEventListener("change", onMediaChange);
7984
+ rootEl.value?.removeEventListener("click", onBodyClick);
7540
7985
  if (typeof document !== "undefined") document.documentElement.classList.remove("dark");
7541
7986
  if (flushTimer) {
7542
7987
  clearTimeout(flushTimer);
@@ -7548,6 +7993,8 @@ ${fileParts.join("\n")}` });
7548
7993
  return vue.openBlock(), vue.createElementBlock(
7549
7994
  "div",
7550
7995
  {
7996
+ ref_key: "rootEl",
7997
+ ref: rootEl,
7551
7998
  class: vue.normalizeClass(["fv-ai-chat", { "is-dark": isDark.value, "is-center-welcome": isCenterWelcome.value }])
7552
7999
  },
7553
8000
  [
@@ -7567,7 +8014,7 @@ ${fileParts.join("\n")}` });
7567
8014
  class: "fv-ai-chat-models",
7568
8015
  multiple: "",
7569
8016
  "collapse-tags": "",
7570
- placeholder: "\u6A21\u578B",
8017
+ placeholder: vue.unref(dict).aiChat.modelPlaceholder,
7571
8018
  size: "small"
7572
8019
  }, {
7573
8020
  default: vue.withCtx(() => [
@@ -7587,7 +8034,7 @@ ${fileParts.join("\n")}` });
7587
8034
  ]),
7588
8035
  _: 1
7589
8036
  /* STABLE */
7590
- }, 8, ["modelValue"])) : vue.createCommentVNode("v-if", true)
8037
+ }, 8, ["modelValue", "placeholder"])) : vue.createCommentVNode("v-if", true)
7591
8038
  ])) : vue.createCommentVNode("v-if", true),
7592
8039
  vue.createCommentVNode(" \u6D88\u606F\u533A:\u7A7A\u65F6 Welcome + Prompts(AiMessages \u5185\u7F6E);\u5F00\u542F artifacts \u65F6\u53F3\u4FA7\u62FC\u9884\u89C8\u9762\u677F "),
7593
8040
  vue.createElementVNode("div", _hoisted_3, [
@@ -7609,6 +8056,7 @@ ${fileParts.join("\n")}` });
7609
8056
  "assistant-name": __props.assistantName,
7610
8057
  typing: __props.typing,
7611
8058
  collapsible: __props.collapsible,
8059
+ "code-trigger-langs": artifactsOn.value && artifactsCodeTrigger.value ? ["html", "svg"] : void 0,
7612
8060
  onSelect: onSelectSuggestion,
7613
8061
  onCopy,
7614
8062
  onRegenerate,
@@ -7680,14 +8128,17 @@ ${fileParts.join("\n")}` });
7680
8128
  ]),
7681
8129
  key: "8"
7682
8130
  } : void 0
7683
- ]), 1032, ["messages", "nodes", "name", "suggestions", "show-scroll-button", "scroll-button-threshold", "scroll-threshold", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "user-name", "assistant-name", "typing", "collapsible"]),
7684
- __props.features?.artifacts && artifacts.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$1, {
8131
+ ]), 1032, ["messages", "nodes", "name", "suggestions", "show-scroll-button", "scroll-button-threshold", "scroll-threshold", "show-user-avatar", "show-user-name", "show-assistant-avatar", "show-assistant-name", "user-avatar", "assistant-avatar", "user-name", "assistant-name", "typing", "collapsible", "code-trigger-langs"]),
8132
+ artifactsOn.value && artifacts.value.length ? (vue.openBlock(), vue.createBlock(_sfc_main$1, {
7685
8133
  key: 0,
7686
8134
  artifacts: artifacts.value,
7687
8135
  "active-key": artifactActiveKey.value,
8136
+ width: artifactsOpts.value.width,
8137
+ "min-width": artifactsOpts.value.minWidth,
8138
+ "max-width": artifactsOpts.value.maxWidth,
7688
8139
  onClose: onArtifactClose,
7689
8140
  onChange: onArtifactChange
7690
- }, null, 8, ["artifacts", "active-key"])) : vue.createCommentVNode("v-if", true)
8141
+ }, null, 8, ["artifacts", "active-key", "width", "min-width", "max-width"])) : vue.createCommentVNode("v-if", true)
7691
8142
  ]),
7692
8143
  vue.createCommentVNode(" \u8F93\u5165\u533A:Sender(\u4E0D\u4F20 allowSpeech,Task 15 \u6869\u4E0D\u63A5\u7EBF);\r\n allowAttachments \u5F00\u542F\u65F6:\u56DE\u5F62\u9488\u5728\u64CD\u4F5C\u680F\u5DE6\u4FA7(#action-left,\u4E0E\u63D0\u4EA4\u6309\u94AE\u540C\u884C),\r\n \u5DF2\u9009\u9644\u4EF6\u5217\u8868\u5728 fv-sender-body \u5185\u8F93\u5165\u884C\u4E0A\u65B9(#body-top,body-top:empty \u81EA\u52A8\u9690\u85CF) "),
7693
8144
  vue.createElementVNode("div", _hoisted_4, [
@@ -7895,7 +8346,7 @@ ${fileParts.join("\n")}` });
7895
8346
  function toError(code, message) {
7896
8347
  const c = typeof code === "number" ? code : void 0;
7897
8348
  const mapped = c !== void 0 ? errorMessages?.[c] : void 0;
7898
- return new FvCommonError(mapped ?? String(message ?? "\u8BF7\u6C42\u5931\u8D25"), c ?? code);
8349
+ return new FvCommonError(mapped ?? String(message ?? getGlobalLocale().errors.requestFailed), c ?? code);
7899
8350
  }
7900
8351
  return {
7901
8352
  async send(req, handlers) {
@@ -7905,7 +8356,7 @@ ${fileParts.join("\n")}` });
7905
8356
  try {
7906
8357
  const sid = resolve(sessionId);
7907
8358
  if (!sid) {
7908
- handlers.onError(new FvCommonError("\u7F3A\u5C11 sessionId(\u4F1A\u8BDD\u672A\u521B\u5EFA\u6216\u672A\u9009\u4E2D)"));
8359
+ handlers.onError(new FvCommonError(getGlobalLocale().errors.sessionIdMissing));
7909
8360
  return;
7910
8361
  }
7911
8362
  const res = await fetch(`${baseURL.replace(/\/+$/, "")}/ai-chat/message/send`, {
@@ -7928,7 +8379,7 @@ ${fileParts.join("\n")}` });
7928
8379
  return;
7929
8380
  }
7930
8381
  if (!res.body) {
7931
- handlers.onError(new FvCommonError("\u54CD\u5E94\u65E0 body"));
8382
+ handlers.onError(new FvCommonError(getGlobalLocale().errors.noBody));
7932
8383
  return;
7933
8384
  }
7934
8385
  let errored = false;
@@ -7967,7 +8418,7 @@ ${fileParts.join("\n")}` });
7967
8418
  }
7968
8419
  case "error": {
7969
8420
  errored = true;
7970
- handlers.onError(new FvCommonError(String(j.message ?? "\u751F\u6210\u5931\u8D25"), j.code));
8421
+ handlers.onError(new FvCommonError(String(j.message ?? getGlobalLocale().errors.generateFailed), j.code));
7971
8422
  break;
7972
8423
  }
7973
8424
  }
@@ -8090,15 +8541,18 @@ ${fileParts.join("\n")}` });
8090
8541
  exports.FvWelcome = _sfc_main$8;
8091
8542
  exports.OpenAIAdapter = OpenAIAdapter;
8092
8543
  exports.XRequest = XRequest;
8544
+ exports.configureLocale = configureLocale;
8093
8545
  exports.createLocalStorageAdapter = createLocalStorageAdapter;
8094
8546
  exports.createMemoryAdapter = createMemoryAdapter;
8095
8547
  exports.createMessageTree = createMessageTree;
8096
8548
  exports.createSSEParser = createSSEParser;
8549
+ exports.enUS = enUS;
8097
8550
  exports.useChat = useChat;
8098
8551
  exports.useMessages = useMessages;
8099
8552
  exports.useRecord = useRecord;
8100
8553
  exports.useSend = useSend;
8101
8554
  exports.useXStream = useXStream;
8102
8555
  exports.version = version;
8556
+ exports.zhCN = zhCN;
8103
8557
 
8104
8558
  }));