wi-chat 0.6.1 → 0.7.0

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.
Files changed (107) hide show
  1. package/dist/core/index.cjs +1 -1
  2. package/dist/core/index.d.ts +12 -0
  3. package/dist/core/index.js +737 -322
  4. package/dist/core/useAnswerActions.d.ts +61 -0
  5. package/dist/core/useChat.d.ts +90 -15
  6. package/dist/core/useChatAuth.d.ts +96 -0
  7. package/dist/core/useChatRooms.d.ts +66 -0
  8. package/dist/core/useKeepAlive.d.ts +41 -0
  9. package/dist/core/useLlm.d.ts +73 -0
  10. package/dist/core/useRunningGroups.d.ts +58 -0
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.ts +4 -2
  13. package/dist/index.js +119 -108
  14. package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +8 -8
  15. package/dist/mobile-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  16. package/dist/mobile-ui/index.cjs +1 -1
  17. package/dist/mobile-ui/index.js +104 -104
  18. package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +6 -6
  19. package/dist/page-context/index.js +2 -4
  20. package/dist/parser/answerCom/actionExecute/actionProtocol.d.ts +1 -7
  21. package/dist/parser/answerCom/actionExecute/clarification.d.ts +15 -3
  22. package/dist/parser/answerCom/actionExecute/constants.d.ts +10 -0
  23. package/dist/parser/answerCom/actionExecute/parseCollectClarifications.d.ts +3 -2
  24. package/dist/parser/answerCom/actionExecute/parseHostAction.d.ts +3 -2
  25. package/dist/parser/answerCom/actionExecute/types.d.ts +3 -3
  26. package/dist/parser/answerCom/generic/parseGeneric.d.ts +52 -0
  27. package/dist/parser/answerCom/generic/types.d.ts +75 -0
  28. package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +7 -6
  29. package/dist/parser/answerCom/outputFile/types.d.ts +15 -5
  30. package/dist/parser/answerCom/presentFiles/parsePresentFiles.d.ts +58 -0
  31. package/dist/parser/answerCom/presentFiles/types.d.ts +27 -0
  32. package/dist/parser/answerMeta.d.ts +71 -0
  33. package/dist/parser/deepThinking/parseDeepThinking.d.ts +8 -0
  34. package/dist/parser/history/history.d.ts +9 -0
  35. package/dist/parser/history/index.d.ts +1 -1
  36. package/dist/parser/index.cjs +6 -2
  37. package/dist/parser/index.d.ts +13 -4
  38. package/dist/parser/index.js +640 -457
  39. package/dist/parser/message.d.ts +9 -0
  40. package/dist/parser/registry.d.ts +1 -1
  41. package/dist/parser/runTime.d.ts +29 -0
  42. package/dist/renderers/TextAnswer-BgKGvG_o.cjs +2 -0
  43. package/dist/renderers/TextAnswer-PQwV3K7v.js +5 -0
  44. package/dist/renderers/aiAnswer/AiAnswerBubble.vue.d.ts +4 -4
  45. package/dist/renderers/answerCard/AnswerCard.vue.d.ts +65 -0
  46. package/dist/renderers/answerCard/AnswerToolbar.vue.d.ts +42 -0
  47. package/dist/renderers/answerConfig.d.ts +33 -0
  48. package/dist/renderers/clarification/ClarificationCard.vue.d.ts +3 -3
  49. package/dist/renderers/deepThinking/DeepThinkingSteps.vue.d.ts +4 -4
  50. package/dist/renderers/deviceLastValue/DeviceLastValue.vue.d.ts +37 -0
  51. package/dist/renderers/hostAction/HostActionStatus.vue.d.ts +3 -3
  52. package/dist/renderers/iframePage/IframePage.vue.d.ts +3 -3
  53. package/dist/renderers/index.cjs +6 -1
  54. package/dist/renderers/index.d.ts +14 -0
  55. package/dist/renderers/index.js +1504 -607
  56. package/dist/renderers/knowledgeStream/KnowledgeStreamResult.vue.d.ts +3 -3
  57. package/dist/renderers/media/MediaAnswer.vue.d.ts +19 -0
  58. package/dist/renderers/outputFile/OutputFile.vue.d.ts +3 -3
  59. package/dist/renderers/outputFile/OutputFileLink.vue.d.ts +19 -0
  60. package/dist/renderers/outputFile/localFile.d.ts +46 -0
  61. package/dist/renderers/outputFile/useOutputFile.d.ts +32 -3
  62. package/dist/renderers/presentFiles/PresentFiles.vue.d.ts +19 -0
  63. package/dist/renderers/recordset/RecordsetView.vue.d.ts +19 -0
  64. package/dist/renderers/sqlQuery/SqlQuery.vue.d.ts +19 -0
  65. package/dist/renderers/style.css +1 -1
  66. package/dist/renderers/text/TextAnswer.vue.d.ts +19 -0
  67. package/dist/request/api.d.ts +121 -1
  68. package/dist/request/client.d.ts +6 -0
  69. package/dist/request/index.cjs +4 -2
  70. package/dist/request/index.d.ts +4 -2
  71. package/dist/request/index.js +754 -181
  72. package/dist/request/ws.d.ts +11 -86
  73. package/dist/request/wsCore.d.ts +104 -0
  74. package/dist/request/wsSession.d.ts +353 -0
  75. package/dist/right-panel/RightPanel.vue.d.ts +6 -6
  76. package/dist/right-panel/RightPanelIcon.vue.d.ts +4 -4
  77. package/dist/right-panel/RightPanelTabs.vue.d.ts +9 -5
  78. package/dist/right-panel/index.cjs +1 -1
  79. package/dist/right-panel/index.d.ts +1 -1
  80. package/dist/right-panel/index.js +617 -537
  81. package/dist/right-panel/panels/newtab/NewTabPanel.vue.d.ts +4 -4
  82. package/dist/right-panel/panels/web/WebPanel.vue.d.ts +3 -3
  83. package/dist/right-panel/shared/BrowserToolbar.vue.d.ts +3 -3
  84. package/dist/right-panel/shared/RightPanelToolList.vue.d.ts +5 -5
  85. package/dist/right-panel/style.css +1 -1
  86. package/dist/right-panel/types.d.ts +10 -0
  87. package/dist/theme/index.js +2 -4
  88. package/dist/tools/index.cjs +5 -5
  89. package/dist/tools/index.d.ts +2 -2
  90. package/dist/tools/index.js +323 -217
  91. package/dist/tools/markdown/MarkdownContent.vue.d.ts +5 -5
  92. package/dist/tools/markdown/index.d.ts +2 -0
  93. package/dist/tools/markdown/interactions.d.ts +39 -0
  94. package/dist/tools/markdown/sanitize.d.ts +6 -0
  95. package/dist/tools/style.css +1 -1
  96. package/dist/tools/useAutoScroll.d.ts +3 -3
  97. package/dist/web-ui/attach/AttachmentCard.vue.d.ts +6 -6
  98. package/dist/web-ui/attach/AttachmentList.vue.d.ts +6 -6
  99. package/dist/web-ui/chat/ChatContainer.vue.d.ts +10 -10
  100. package/dist/web-ui/chat/ChatMessagesView.vue.d.ts +6 -6
  101. package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +6 -6
  102. package/dist/web-ui/index.cjs +1 -1
  103. package/dist/web-ui/index.js +630 -635
  104. package/dist/web-ui/inputbox/Inputbox.vue.d.ts +11 -11
  105. package/dist/web-ui/recordset/RecordsetTable.vue.d.ts +4 -4
  106. package/dist/web-ui/style.css +1 -1
  107. package/package.json +2 -1
@@ -1,9 +1,9 @@
1
- import { provideOutputFileConfig as q, createAnswerContentMap as $, DeepThinkingSteps as x, AiAnswerBubble as P } from "wi-chat/renderers";
2
- import { AiAnswerBubble as ke, ClarificationCard as ve, DeepThinkingSteps as Ce, HostActionStatus as Te, IframePage as Ie, KnowledgeStreamResult as Se, OutputFile as Be, createAnswerContentMap as Ee, injectIframeResizerChild as Ve, provideIframePageConfig as Ae, provideOutputFileConfig as Fe, resolveIframePlaceholders as Oe, useIframePage as De } from "wi-chat/renderers";
3
- import { defineComponent as C, openBlock as i, createElementBlock as n, createVNode as f, unref as c, withKeys as U, withModifiers as K, withCtx as O, createTextVNode as N, toDisplayString as y, ref as z, computed as L, watch as V, createElementVNode as _, createCommentVNode as k, Fragment as v, renderList as A, Transition as R, pushScopeId as j, popScopeId as H, renderSlot as F } from "vue";
4
- import { Field as W, Button as G } from "vant";
5
- import { useAutoScroll as J } from "wi-chat/tools";
6
- const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
1
+ import { provideOutputFileConfig as M, createAnswerContentMap as q, DeepThinkingSteps as $, AiAnswerBubble as P } from "wi-chat/renderers";
2
+ import { AiAnswerBubble as he, ClarificationCard as ye, DeepThinkingSteps as we, HostActionStatus as ke, IframePage as ve, KnowledgeStreamResult as xe, OutputFile as Ce, createAnswerContentMap as Te, injectIframeResizerChild as Be, provideIframePageConfig as Ie, provideOutputFileConfig as Se, resolveIframePlaceholders as Ee, useIframePage as _e } from "wi-chat/renderers";
3
+ import { defineComponent as C, openBlock as n, createElementBlock as i, createVNode as f, unref as p, withKeys as U, withModifiers as K, withCtx as F, createTextVNode as N, toDisplayString as w, ref as z, computed as L, watch as _, createElementVNode as y, createCommentVNode as v, Fragment as x, renderList as V, Transition as R, renderSlot as A } from "vue";
4
+ import { Field as j, Button as H } from "vant";
5
+ import { useAutoScroll as W } from "wi-chat/tools";
6
+ const G = { class: "wi-mobile-inputbox" }, J = /* @__PURE__ */ C({
7
7
  __name: "Inputbox",
8
8
  props: {
9
9
  modelValue: { default: "" },
@@ -17,62 +17,62 @@ const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
17
17
  buttonType: { default: "primary" }
18
18
  },
19
19
  emits: ["update:modelValue", "submit", "stop"],
20
- setup(l, { emit: u }) {
21
- const o = l, t = u, r = () => {
22
- if (o.talking) {
20
+ setup(e, { emit: u }) {
21
+ const a = e, t = u, l = () => {
22
+ if (a.talking) {
23
23
  t("stop");
24
24
  return;
25
25
  }
26
- o.disabled || o.disabledSend || t("submit");
27
- }, g = (e) => {
28
- e.isComposing || e.keyCode === 229 || !o.enterExact || o.talking || (e.preventDefault(), r());
26
+ a.disabled || a.disabledSend || t("submit");
27
+ }, g = (d) => {
28
+ d.isComposing || d.keyCode === 229 || !a.enterExact || a.talking || (d.preventDefault(), l());
29
29
  };
30
- return (e, a) => (i(), n("div", Q, [
31
- f(c(W), {
30
+ return (d, o) => (n(), i("div", G, [
31
+ f(p(j), {
32
32
  "model-value": e.modelValue,
33
33
  type: "textarea",
34
34
  rows: "2",
35
35
  autosize: "",
36
36
  placeholder: e.placeholder,
37
37
  disabled: e.disabled,
38
- "onUpdate:modelValue": a[0] || (a[0] = (p) => t("update:modelValue", String(p ?? ""))),
38
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => t("update:modelValue", String(r ?? ""))),
39
39
  onKeydown: U(K(g, ["exact"]), ["enter"])
40
40
  }, null, 8, ["model-value", "placeholder", "disabled", "onKeydown"]),
41
- f(c(G), {
41
+ f(p(H), {
42
42
  class: "wi-mobile-inputbox__btn",
43
43
  type: e.talking ? "danger" : e.buttonType,
44
44
  size: "small",
45
45
  disabled: e.disabled,
46
- onClick: r
46
+ onClick: l
47
47
  }, {
48
- default: O(() => [
49
- N(y(e.talking ? e.stopText : e.submitText), 1)
48
+ default: F(() => [
49
+ N(w(e.talking ? e.stopText : e.submitText), 1)
50
50
  ]),
51
51
  _: 1
52
52
  }, 8, ["type", "disabled"])
53
53
  ]));
54
54
  }
55
- }), T = (l, u) => {
56
- const o = l.__vccOpts || l;
57
- for (const [t, r] of u)
58
- o[t] = r;
59
- return o;
60
- }, Y = /* @__PURE__ */ T(X, [["__scopeId", "data-v-02f9c6a0"]]), Z = (l) => (j("data-v-04e966f6"), l = l(), H(), l), ee = {
55
+ }), T = (e, u) => {
56
+ const a = e.__vccOpts || e;
57
+ for (const [t, l] of u)
58
+ a[t] = l;
59
+ return a;
60
+ }, Q = /* @__PURE__ */ T(J, [["__scopeId", "data-v-02f9c6a0"]]), X = {
61
61
  key: 0,
62
62
  class: "wi-mobile-chat-messages__loading"
63
- }, te = {
63
+ }, Y = {
64
64
  key: 1,
65
65
  class: "wi-mobile-chat-messages__empty"
66
- }, se = /* @__PURE__ */ Z(() => /* @__PURE__ */ _("div", { class: "wi-mobile-chat-messages__empty-logo" }, "WI", -1)), oe = { class: "wi-mobile-chat-messages__empty-title" }, ae = { class: "wi-mobile-chat-messages__empty-description" }, ie = {
66
+ }, Z = { class: "wi-mobile-chat-messages__empty-title" }, ee = { class: "wi-mobile-chat-messages__empty-description" }, te = {
67
67
  key: 0,
68
68
  class: "wi-mobile-chat-messages__user"
69
- }, ne = { class: "wi-mobile-chat-messages__user-wrapper" }, le = {
69
+ }, se = { class: "wi-mobile-chat-messages__user-wrapper" }, ae = {
70
70
  key: 0,
71
71
  class: "wi-mobile-chat-messages__attachments"
72
- }, de = { class: "wi-mobile-chat-messages__user-bubble" }, re = {
72
+ }, oe = { class: "wi-mobile-chat-messages__user-bubble" }, ne = {
73
73
  key: 1,
74
74
  class: "wi-mobile-chat-messages__assistant"
75
- }, pe = /* @__PURE__ */ C({
75
+ }, ie = /* @__PURE__ */ C({
76
76
  __name: "ChatMessagesView",
77
77
  props: {
78
78
  messages: { default: () => [] },
@@ -83,86 +83,86 @@ const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
83
83
  emptyDescription: { default: "回答内容由共享渲染层统一分发" }
84
84
  },
85
85
  emits: ["loadOlder", "updateThinkingExpanded"],
86
- setup(l, { expose: u, emit: o }) {
87
- var B, E;
88
- const t = l, r = o;
89
- q(t.outputFileConfig ?? {});
90
- const g = z(), { showScrollToBottom: e, forceScrollToBottom: a, requestScrollToBottom: p, resetScrollState: w, onReachTop: D } = J(g), M = L(() => $(t.parsers));
91
- V(
86
+ setup(e, { expose: u, emit: a }) {
87
+ var S, E;
88
+ const t = e, l = a;
89
+ M(t.outputFileConfig ?? {});
90
+ const g = z(), { showScrollToBottom: d, forceScrollToBottom: o, requestScrollToBottom: r, resetScrollState: k, onReachTop: O } = W(g), D = L(() => q(t.parsers));
91
+ _(
92
92
  () => t.messages.length === 0,
93
- (d) => {
94
- d && w();
93
+ (b) => {
94
+ b && k();
95
95
  }
96
96
  );
97
- let I = ((B = t.messages[0]) == null ? void 0 : B.id) ?? "", S = ((E = t.messages[t.messages.length - 1]) == null ? void 0 : E.id) ?? "";
98
- return V(
97
+ let B = ((S = t.messages[0]) == null ? void 0 : S.id) ?? "", I = ((E = t.messages[t.messages.length - 1]) == null ? void 0 : E.id) ?? "";
98
+ return _(
99
99
  () => t.messages,
100
100
  () => {
101
- var b, m;
102
- const d = ((b = t.messages[0]) == null ? void 0 : b.id) ?? "", h = ((m = t.messages[t.messages.length - 1]) == null ? void 0 : m.id) ?? "", s = d !== I && h === S;
103
- I = d, S = h, !s && p();
101
+ var h, c;
102
+ const b = ((h = t.messages[0]) == null ? void 0 : h.id) ?? "", m = ((c = t.messages[t.messages.length - 1]) == null ? void 0 : c.id) ?? "", s = b !== B && m === I;
103
+ B = b, I = m, !s && r();
104
104
  },
105
105
  { deep: !0 }
106
- ), D(() => r("loadOlder")), u({
106
+ ), O(() => l("loadOlder")), u({
107
107
  /** 强制滚动到底部 */
108
- forceScrollToBottom: a,
108
+ forceScrollToBottom: o,
109
109
  /** 自动滚动开启时请求滚动到底部 */
110
- requestScrollToBottom: p
111
- }), (d, h) => (i(), n("div", {
110
+ requestScrollToBottom: r
111
+ }), (b, m) => (n(), i("div", {
112
112
  ref_key: "scrollEl",
113
113
  ref: g,
114
114
  class: "wi-mobile-chat-messages"
115
115
  }, [
116
- d.loading ? (i(), n("div", ee, "历史加载中...")) : d.messages.length === 0 ? (i(), n("div", te, [
117
- se,
118
- _("div", oe, y(d.emptyTitle), 1),
119
- _("div", ae, y(d.emptyDescription), 1)
120
- ])) : k("", !0),
121
- (i(!0), n(v, null, A(d.messages, (s) => {
122
- var b;
123
- return i(), n(v, {
116
+ e.loading ? (n(), i("div", X, "历史加载中...")) : e.messages.length === 0 ? (n(), i("div", Y, [
117
+ m[1] || (m[1] = y("div", { class: "wi-mobile-chat-messages__empty-logo" }, "WI", -1)),
118
+ y("div", Z, w(e.emptyTitle), 1),
119
+ y("div", ee, w(e.emptyDescription), 1)
120
+ ])) : v("", !0),
121
+ (n(!0), i(x, null, V(e.messages, (s) => {
122
+ var h;
123
+ return n(), i(x, {
124
124
  key: s.id
125
125
  }, [
126
- s.role === "user" ? (i(), n("div", ie, [
127
- _("div", ne, [
128
- (b = s.attachments) != null && b.length ? (i(), n("div", le, [
129
- (i(!0), n(v, null, A(s.attachments, (m) => (i(), n("span", {
130
- key: m.name,
126
+ s.role === "user" ? (n(), i("div", te, [
127
+ y("div", se, [
128
+ (h = s.attachments) != null && h.length ? (n(), i("div", ae, [
129
+ (n(!0), i(x, null, V(s.attachments, (c) => (n(), i("span", {
130
+ key: c.name,
131
131
  class: "wi-mobile-chat-messages__attachment"
132
- }, y(m.name), 1))), 128))
133
- ])) : k("", !0),
134
- _("div", de, y(s.content), 1)
132
+ }, w(c.name), 1))), 128))
133
+ ])) : v("", !0),
134
+ y("div", oe, w(s.content), 1)
135
135
  ])
136
- ])) : (i(), n("div", re, [
137
- f(c(x), {
136
+ ])) : (n(), i("div", ne, [
137
+ f(p($), {
138
138
  steps: s.thinking.steps,
139
139
  expanded: s.thinking.expanded,
140
- "onUpdate:expanded": (m) => r("updateThinkingExpanded", s, m)
140
+ "onUpdate:expanded": (c) => l("updateThinkingExpanded", s, c)
141
141
  }, null, 8, ["steps", "expanded", "onUpdate:expanded"]),
142
- f(c(P), {
142
+ f(p(P), {
143
143
  answer: s.answer,
144
144
  error: s.error,
145
145
  stopped: s.stopped,
146
- "content-map": M.value
146
+ "content-map": D.value
147
147
  }, null, 8, ["answer", "error", "stopped", "content-map"])
148
148
  ]))
149
149
  ], 64);
150
150
  }), 128)),
151
151
  f(R, { name: "wi-mobile-chat-messages-fade" }, {
152
- default: O(() => [
153
- c(e) ? (i(), n("button", {
152
+ default: F(() => [
153
+ p(d) ? (n(), i("button", {
154
154
  key: 0,
155
155
  type: "button",
156
156
  class: "wi-mobile-chat-messages__bottom",
157
- onClick: h[0] || (h[0] = //@ts-ignore
158
- (...s) => c(a) && c(a)(...s))
159
- }, " 回到底部 ")) : k("", !0)
157
+ onClick: m[0] || (m[0] = //@ts-ignore
158
+ (...s) => p(o) && p(o)(...s))
159
+ }, " 回到底部 ")) : v("", !0)
160
160
  ]),
161
161
  _: 1
162
162
  })
163
163
  ], 512));
164
164
  }
165
- }), ue = /* @__PURE__ */ T(pe, [["__scopeId", "data-v-04e966f6"]]), me = { class: "wi-mobile-chat-container" }, ce = /* @__PURE__ */ C({
165
+ }), le = /* @__PURE__ */ T(ie, [["__scopeId", "data-v-04e966f6"]]), de = { class: "wi-mobile-chat-container" }, re = /* @__PURE__ */ C({
166
166
  __name: "ChatContainer",
167
167
  props: {
168
168
  messages: { default: () => [] },
@@ -179,55 +179,55 @@ const Q = { class: "wi-mobile-inputbox" }, X = /* @__PURE__ */ C({
179
179
  disabled: { type: Boolean, default: !1 }
180
180
  },
181
181
  emits: ["update:question", "submit", "stop", "loadOlder", "updateThinkingExpanded"],
182
- setup(l, { emit: u }) {
183
- const o = l, t = u, r = () => {
184
- o.hasMore && t("loadOlder");
182
+ setup(e, { emit: u }) {
183
+ const a = e, t = u, l = () => {
184
+ a.hasMore && t("loadOlder");
185
185
  }, g = () => {
186
- t("submit", { text: o.question });
186
+ t("submit", { text: a.question });
187
187
  };
188
- return (e, a) => (i(), n("section", me, [
189
- F(e.$slots, "messages", {}, () => [
190
- f(ue, {
188
+ return (d, o) => (n(), i("section", de, [
189
+ A(d.$slots, "messages", {}, () => [
190
+ f(le, {
191
191
  messages: e.messages,
192
192
  parsers: e.parsers,
193
193
  "output-file-config": e.outputFileConfig,
194
194
  loading: e.loading,
195
195
  "empty-title": e.emptyTitle,
196
196
  "empty-description": e.emptyDescription,
197
- onLoadOlder: r,
198
- onUpdateThinkingExpanded: a[0] || (a[0] = (p, w) => t("updateThinkingExpanded", p, w))
197
+ onLoadOlder: l,
198
+ onUpdateThinkingExpanded: o[0] || (o[0] = (r, k) => t("updateThinkingExpanded", r, k))
199
199
  }, null, 8, ["messages", "parsers", "output-file-config", "loading", "empty-title", "empty-description"])
200
200
  ], !0),
201
- F(e.$slots, "above-input", {}, void 0, !0),
202
- f(Y, {
201
+ A(d.$slots, "above-input", {}, void 0, !0),
202
+ f(Q, {
203
203
  "model-value": e.question,
204
204
  placeholder: e.placeholder,
205
205
  disabled: e.disabled || !e.session,
206
206
  "disabled-send": !e.question.trim(),
207
207
  talking: e.talking,
208
- "onUpdate:modelValue": a[1] || (a[1] = (p) => t("update:question", p)),
208
+ "onUpdate:modelValue": o[1] || (o[1] = (r) => t("update:question", r)),
209
209
  onSubmit: g,
210
- onStop: a[2] || (a[2] = (p) => t("stop"))
210
+ onStop: o[2] || (o[2] = (r) => t("stop"))
211
211
  }, null, 8, ["model-value", "placeholder", "disabled", "disabled-send", "talking"])
212
212
  ]));
213
213
  }
214
- }), ye = /* @__PURE__ */ T(ce, [["__scopeId", "data-v-9bd22d00"]]);
214
+ }), fe = /* @__PURE__ */ T(re, [["__scopeId", "data-v-9bd22d00"]]);
215
215
  export {
216
- ke as AiAnswerBubble,
217
- ye as ChatContainer,
218
- ue as ChatMessagesView,
219
- ve as ClarificationCard,
220
- Ce as DeepThinkingSteps,
221
- Te as HostActionStatus,
222
- Ie as IframePage,
223
- Y as Inputbox,
224
- Se as KnowledgeStreamResult,
225
- Be as OutputFile,
226
- Ee as createAnswerContentMap,
227
- Ve as injectIframeResizerChild,
228
- Ae as provideIframePageConfig,
229
- Fe as provideOutputFileConfig,
230
- Oe as resolveIframePlaceholders,
231
- De as useIframePage
216
+ he as AiAnswerBubble,
217
+ fe as ChatContainer,
218
+ le as ChatMessagesView,
219
+ ye as ClarificationCard,
220
+ we as DeepThinkingSteps,
221
+ ke as HostActionStatus,
222
+ ve as IframePage,
223
+ Q as Inputbox,
224
+ xe as KnowledgeStreamResult,
225
+ Ce as OutputFile,
226
+ Te as createAnswerContentMap,
227
+ Be as injectIframeResizerChild,
228
+ Ie as provideIframePageConfig,
229
+ Se as provideOutputFileConfig,
230
+ Ee as resolveIframePlaceholders,
231
+ _e as useIframePage
232
232
  };
233
233
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
2
  /** 输入框当前文本内容(v-model) */
3
3
  modelValue?: string;
4
4
  /** 占位符文本 */
@@ -27,7 +27,7 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
27
27
  stopText: string;
28
28
  talking: boolean;
29
29
  buttonType: string;
30
- }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
31
31
  "update:modelValue": (value: string) => void;
32
32
  submit: () => void;
33
33
  stop: () => void;
@@ -60,21 +60,21 @@ declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_T
60
60
  stopText: string;
61
61
  talking: boolean;
62
62
  buttonType: string;
63
- }>>> & {
63
+ }>>> & Readonly<{
64
64
  onSubmit?: () => any;
65
65
  onStop?: () => any;
66
66
  "onUpdate:modelValue"?: (value: string) => any;
67
- }, {
67
+ }>, {
68
68
  placeholder: string;
69
69
  disabled: boolean;
70
+ talking: boolean;
70
71
  modelValue: string;
71
72
  disabledSend: boolean;
72
73
  enterExact: boolean;
73
74
  submitText: string;
74
75
  stopText: string;
75
- talking: boolean;
76
76
  buttonType: 'primary' | 'danger' | 'success';
77
- }, {}>;
77
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
78
78
  export default _default;
79
79
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
80
80
  type __VLS_TypePropsToRuntimeProps<T> = {
@@ -12,8 +12,7 @@ const i = 100, n = (e = []) => e.map((t) => ({
12
12
  }), A = (e) => ({
13
13
  [r]: JSON.stringify(e)
14
14
  }), s = (e) => {
15
- if (!e || typeof e != "object" || Array.isArray(e))
16
- return !1;
15
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
17
16
  const t = e;
18
17
  return typeof t.schemaVersion == "string" && !!t.navigation && typeof t.navigation == "object" && Array.isArray(t.state) && Array.isArray(t.actions);
19
18
  }, g = (e) => {
@@ -24,8 +23,7 @@ const i = 100, n = (e = []) => e.map((t) => ({
24
23
  } catch {
25
24
  return;
26
25
  }
27
- if (!t || typeof t != "object" || Array.isArray(t))
28
- return;
26
+ if (!t || typeof t != "object" || Array.isArray(t)) return;
29
27
  let a = t[r];
30
28
  if (typeof a == "string")
31
29
  try {
@@ -1,5 +1,5 @@
1
1
  import { StreamChunk } from '../../sse';
2
- import { ActionExecuteCommand, ActionResult, ActionDefinition } from './types';
2
+ import { ActionExecuteCommand, ActionResult } from './types';
3
3
 
4
4
  /**
5
5
  * 创建失败结果
@@ -31,12 +31,6 @@ export declare const normalizeActionResult: (value: unknown, invalidMessage?: st
31
31
  * @returns 统一执行结果
32
32
  */
33
33
  export declare const wrapActionFrame: (frame: unknown) => ActionResult;
34
- /**
35
- * 归一化 Action 定义(外部可能传入任意对象,这里只保留 name / arguments)
36
- * @param action 原始 Action
37
- * @returns 仅含 name / arguments 的 Action
38
- */
39
- export declare const normalizeActionDefinition: (action: ActionDefinition) => ActionDefinition;
40
34
  /**
41
35
  * front_reply 帧内 action_execute 指令的读取结果(三态,供各 parser 精确分流):
42
36
  * - `ignored`:不是本协议(mode 不是 front_reply / type 不是 action_execute)→ parser 应 `return false`;
@@ -60,8 +60,20 @@ export declare const submitClarification: (requestId: string, answers: Clarifica
60
60
  */
61
61
  export declare const cancelClarification: (requestId: string) => boolean;
62
62
  /**
63
- * 清空全部在途请求(切换分组 / 停止回答时调用):
64
- * 先把仍在等待回答的卡片标为已失效,再清理登记表,避免卡片停留在「等待回答」却无法提交。
63
+ * 清理在途请求(切换分组 / 停止回答时调用):
64
+ * 先把仍在等待回答的卡片标为已失效,再从登记表移除,避免卡片停留在「等待回答」却无法提交。
65
+ *
66
+ * 登记表是模块级单例(跨 useChat 实例 / 跨连接共享),因此默认支持按回包通道收窄:
67
+ * 传 `reply` 时只处理该通道登记的请求,不影响其它实例 / 其它连接的卡片;
68
+ * 不传时全量清理(等价旧行为,仅建议在所有连接都已失效的收尾场景使用)。
69
+ * @param reply 该通道的 reply 函数(`registerClarification` 登记时的同一引用);缺省为全量清理
65
70
  */
66
- export declare const clearPendingClarifications: () => void;
71
+ export declare const clearPendingClarifications: (reply?: (payload: WaitReplyPayload) => boolean | void) => void;
72
+ /**
73
+ * 让某个回包通道(一次提问连接)关联的在途确认项失效。
74
+ * 连接关闭后这些卡片已无法回包:置为已失效并从登记表移除,避免停留在「等待回答」。
75
+ * 只处理该通道登记过的请求,不影响其它连接 / 其它 useChat 实例。
76
+ * @param reply 该通道的 reply 函数(registerClarification 登记时的同一引用)
77
+ */
78
+ export declare const expirePendingClarificationsForReply: (reply: (payload: WaitReplyPayload) => boolean | void) => void;
67
79
  export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * action_execute 相关 answer_type 常量
3
+ *
4
+ * 单独成文件:`clarification.ts`(在途确认项登记表)需要按 answer_type 精确定位报告,
5
+ * 而两个解析器又都依赖 `clarification.ts`;常量放在这里避免互相 import 形成循环依赖。
6
+ */
7
+ /** 确认卡片的回答类型(front_reply + action_execute + executor=agent + collect_clarifications) */
8
+ export declare const COLLECT_CLARIFICATIONS_ANSWER_TYPE = "collect_clarifications";
9
+ /** 宿主执行过程的回答类型(front_reply + action_execute + executor=host) */
10
+ export declare const HOST_ACTION_ANSWER_TYPE = "host_action";
@@ -1,10 +1,11 @@
1
1
  import { AiAnswerReport } from '../../answer';
2
2
  import { AnswerParser, AnswerParseOptions } from '../../registry';
3
3
  import { StreamChunk } from '../../sse';
4
+ import { COLLECT_CLARIFICATIONS_ANSWER_TYPE } from './constants';
4
5
  import { ClarificationViewModel } from './types';
5
6
 
6
- /** 确认卡片的回答类型(也是历史 report 的分发键) */
7
- export declare const COLLECT_CLARIFICATIONS_ANSWER_TYPE = "collect_clarifications";
7
+ /** 确认卡片的回答类型(也是历史 report 的分发键),常量定义见 ./constants */
8
+ export { COLLECT_CLARIFICATIONS_ANSWER_TYPE };
8
9
  /**
9
10
  * 处理实时流中的确认项指令
10
11
  * @param chunk 流式数据块
@@ -1,10 +1,11 @@
1
1
  import { AiAnswerReport } from '../../answer';
2
2
  import { AnswerParser, AnswerParseOptions } from '../../registry';
3
3
  import { StreamChunk } from '../../sse';
4
+ import { HOST_ACTION_ANSWER_TYPE } from './constants';
4
5
  import { HostActionValue } from './types';
5
6
 
6
- /** 宿主执行过程的回答类型(也是历史 report 的分发键) */
7
- export declare const HOST_ACTION_ANSWER_TYPE = "host_action";
7
+ /** 宿主执行过程的回答类型(也是历史 report 的分发键),常量定义见 ./constants */
8
+ export { HOST_ACTION_ANSWER_TYPE };
8
9
  /**
9
10
  * 处理实时流中的宿主执行指令
10
11
  * @param chunk 流式数据块
@@ -51,15 +51,15 @@ export interface WaitReplyPayload {
51
51
  export interface ActionExecuteOptions {
52
52
  /**
53
53
  * 宿主执行器:`executor === 'host'` 的 action 由宿主执行。
54
- * 未提供时一律回失败帧(避免后端一直等待 wait_reply)。
54
+ * 未提供时不产出执行过程卡片(只回一帧失败结果,避免后端一直等待 wait_reply)。
55
55
  * @param action 待执行的 Action(name + arguments)
56
56
  * @returns 统一执行结果(同步或异步均可)
57
57
  */
58
58
  execute?: (action: ActionDefinition) => ActionResult | Promise<ActionResult>;
59
59
  /**
60
- * wait_reply 回传通道(useChat 内部注入 sendWsMessage,宿主一般不用传)。
60
+ * wait_reply 回传通道(useChat 内部注入“本次提问连接专用”的 reply,宿主一般不用传)。
61
61
  * @param payload wait_reply 载荷
62
- * @returns false 表示当前无在途连接(连接已关闭),回包失败
62
+ * @returns false 表示当前连接已关闭 / 无在途会话,回包未发出
63
63
  */
64
64
  reply?: (payload: WaitReplyPayload) => boolean | void;
65
65
  /**
@@ -0,0 +1,52 @@
1
+ import { AnswerParser } from '../../registry';
2
+ import { CameraValue, DeviceLastValueValue, ScriptValue, SqlQueryValue, VideoValue, WavValue } from './types';
3
+
4
+ /**
5
+ * 取载荷的有效回答类型(`type` 存在时覆盖 `answer_type`,与后端 result 帧语义一致)
6
+ * @param value result 帧载荷或历史 report
7
+ * @returns 有效类型(取不到为空串)
8
+ */
9
+ export declare const getEffectiveAnswerType: (value: any) => string;
10
+ /**
11
+ * 默认载荷读取:`values` 存在即用;否则把顶层业务字段收拢成对象(空对象视为无载荷)
12
+ * @param value result 帧载荷或历史 report
13
+ * @returns 业务载荷;取不到时 undefined
14
+ */
15
+ export declare const readDefaultPayload: (value: any) => any;
16
+ /** 通用透传 parser 的构造参数 */
17
+ export interface PassThroughParserOptions<T> {
18
+ /** 回答类型(同时作为 parser id 与历史分发键) */
19
+ answerType: string;
20
+ /**
21
+ * 载荷读取(实时与历史共用),缺省 `readDefaultPayload`
22
+ * @param value result 帧载荷或历史 report
23
+ * @returns 归一后的 values;undefined 表示无内容(实时不产出报告、历史不改写)
24
+ */
25
+ readPayload?: (value: any) => T | undefined;
26
+ }
27
+ /**
28
+ * 构造一个「result 整包下发、无流式累积」的回答类型 parser
29
+ * @param options 回答类型与载荷读取方式
30
+ * @returns 可注册进 registry 的 AnswerParser
31
+ */
32
+ export declare const createPassThroughParser: <T = any>(options: PassThroughParserOptions<T>) => AnswerParser<T>;
33
+ /**
34
+ * text:Markdown 纯文本回答(`values` 或 `answer` 字段为字符串)
35
+ */
36
+ export declare const textParser: AnswerParser<string>;
37
+ /**
38
+ * sql_query:可执行 SQL(`values` 或旧字段 `sql_query` 中的 `{ sql, ds_id }`)
39
+ */
40
+ export declare const sqlQueryParser: AnswerParser<SqlQueryValue>;
41
+ /** device_last_value:设备最新值矩阵(rows × values) */
42
+ export declare const deviceLastValueParser: AnswerParser<DeviceLastValueValue>;
43
+ /** camera:监控画面(res_id + cameras[]) */
44
+ export declare const cameraParser: AnswerParser<CameraValue>;
45
+ /** video:录像文件(model_id + file_id) */
46
+ export declare const videoParser: AnswerParser<VideoValue>;
47
+ /** wav:声音(噪声)分析(noise_id,可选 file_id) */
48
+ export declare const wavParser: AnswerParser<WavValue>;
49
+ /** script:脚本模式(values 收拢复用默认规则,幂等:重复 normalize 不会嵌套) */
50
+ export declare const scriptParser: AnswerParser<ScriptValue>;
51
+ /** 本模块提供的全部内置透传 parser(registry 按此顺序注册) */
52
+ export declare const GENERIC_PARSERS: AnswerParser[];
@@ -0,0 +1,75 @@
1
+ /**
2
+ * 通用透传型回答类型的 values 结构定义(text / sql_query / device_last_value / camera / video / wav / script)
3
+ */
4
+ /** sql_query 的 values */
5
+ export interface SqlQueryValue {
6
+ /** 待执行的 SQL 文本 */
7
+ sql: string;
8
+ /** 数据源 id(执行时回传给后端) */
9
+ ds_id?: string;
10
+ }
11
+ /** device_last_value 的行定义(一行 = 一个监测指标) */
12
+ export interface DeviceLastValueRow {
13
+ /** 指标键:在 values 每项中以该键取 `{ OVALUE }` */
14
+ id: string;
15
+ /** 指标标题 */
16
+ title: string;
17
+ /** 单位(可选) */
18
+ unit?: string;
19
+ [key: string]: any;
20
+ }
21
+ /** device_last_value 的单个设备列 */
22
+ export interface DeviceLastValueItem {
23
+ /** 设备类型 */
24
+ OTYPE?: string;
25
+ /** 设备编号 */
26
+ ONAME?: string;
27
+ /** 设备标题(列头) */
28
+ OTITLE?: string;
29
+ /** 数据时间 */
30
+ OTIME?: string;
31
+ /** 其余字段:以 row.id 为键,值形如 `{ OVALUE }` */
32
+ [key: string]: any;
33
+ }
34
+ /** device_last_value 的 values */
35
+ export interface DeviceLastValueValue {
36
+ /** 表格标题 */
37
+ title?: string;
38
+ /** 指标行 */
39
+ rows: DeviceLastValueRow[];
40
+ /** 设备列 */
41
+ values: DeviceLastValueItem[];
42
+ }
43
+ /** camera 的单个摄像头 */
44
+ export interface CameraItem {
45
+ /** 资源 id */
46
+ res_id?: string;
47
+ /** 抓拍 / 截图文件 id */
48
+ file_id?: string;
49
+ /** 摄像头名称 */
50
+ name?: string;
51
+ [key: string]: any;
52
+ }
53
+ /** camera 的 values */
54
+ export interface CameraValue {
55
+ /** 资源 id(多个以逗号分隔) */
56
+ res_id?: string;
57
+ /** 摄像头列表 */
58
+ cameras: CameraItem[];
59
+ }
60
+ /** video 的 values */
61
+ export interface VideoValue {
62
+ /** 视频模型 / 资源 id */
63
+ model_id?: string;
64
+ /** 视频文件 id */
65
+ file_id?: string;
66
+ }
67
+ /** wav 的 values */
68
+ export interface WavValue {
69
+ /** 噪声分析记录 id */
70
+ noise_id?: string;
71
+ /** 音频文件 id */
72
+ file_id?: string;
73
+ }
74
+ /** script 的 values(整份回答对象原样保留) */
75
+ export type ScriptValue = Record<string, any>;