@glodon-aiot/agent-cli-ui 3.3.5-alpha.21 → 3.3.5-alpha.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.mjs CHANGED
@@ -1,49 +1,49 @@
1
1
  var ie = Object.defineProperty, te = Object.defineProperties;
2
2
  var se = Object.getOwnPropertyDescriptors;
3
- var Z = Object.getOwnPropertySymbols;
3
+ var Y = Object.getOwnPropertySymbols;
4
4
  var oe = Object.prototype.hasOwnProperty, ne = Object.prototype.propertyIsEnumerable;
5
- var S = (p, i, n) => i in p ? ie(p, i, { enumerable: !0, configurable: !0, writable: !0, value: n }) : p[i] = n, r = (p, i) => {
6
- for (var n in i || (i = {}))
7
- oe.call(i, n) && S(p, n, i[n]);
8
- if (Z)
9
- for (var n of Z(i))
10
- ne.call(i, n) && S(p, n, i[n]);
11
- return p;
12
- }, w = (p, i) => te(p, se(i));
13
- var l = (p, i, n) => (S(p, typeof i != "symbol" ? i + "" : i, n), n);
14
- var k = (p, i, n) => new Promise((g, f) => {
15
- var c = (h) => {
5
+ var _ = (d, t, o) => t in d ? ie(d, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : d[t] = o, r = (d, t) => {
6
+ for (var o in t || (t = {}))
7
+ oe.call(t, o) && _(d, o, t[o]);
8
+ if (Y)
9
+ for (var o of Y(t))
10
+ ne.call(t, o) && _(d, o, t[o]);
11
+ return d;
12
+ }, C = (d, t) => te(d, se(t));
13
+ var l = (d, t, o) => (_(d, typeof t != "symbol" ? t + "" : t, o), o);
14
+ var y = (d, t, o) => new Promise((h, g) => {
15
+ var u = (a) => {
16
16
  try {
17
- C(n.next(h));
18
- } catch (d) {
19
- f(d);
17
+ p(o.next(a));
18
+ } catch (f) {
19
+ g(f);
20
20
  }
21
- }, u = (h) => {
21
+ }, c = (a) => {
22
22
  try {
23
- C(n.throw(h));
24
- } catch (d) {
25
- f(d);
23
+ p(o.throw(a));
24
+ } catch (f) {
25
+ g(f);
26
26
  }
27
- }, C = (h) => h.done ? g(h.value) : Promise.resolve(h.value).then(c, u);
28
- C((n = n.apply(p, i)).next());
27
+ }, p = (a) => a.done ? h(a.value) : Promise.resolve(a.value).then(u, c);
28
+ p((o = o.apply(d, t)).next());
29
29
  });
30
- import { jsx as U, Fragment as re } from "react/jsx-runtime";
30
+ import { jsx as k, Fragment as re } from "react/jsx-runtime";
31
31
  import ae from "react";
32
32
  import b from "lodash/merge";
33
- import x from "react-dom";
33
+ import I from "react-dom";
34
34
  import he from "./AgentClientUI.mjs";
35
- import { notification as B } from "antd";
36
- import ge from "axios";
37
- import le from "./packages/agent-cli-ui/package.json.mjs";
38
- import { defaultUIConfig as fe, defaultApiUrl as de, defaultDovViewerUrl as ue } from "./constant.mjs";
39
- import { ApiUrl as ce } from "./types.mjs";
40
- /* empty css */import { BotClientApi as pe, ApplicationTypes as q } from "@glodon-aiot/apis";
35
+ import { notification as S } from "antd";
36
+ import le from "axios";
37
+ import ge from "./packages/agent-cli-ui/package.json.mjs";
38
+ import { defaultUIConfig as fe, defaultApiUrl as ce, defaultDovViewerUrl as de } from "./constant.mjs";
39
+ import { ApiUrl as ue } from "./types.mjs";
40
+ /* empty css */import { BotClientApi as pe, ApplicationTypes as Z } from "@glodon-aiot/apis";
41
41
  import { JWT as me, isExpired as Ce } from "./utils/index.mjs";
42
- import { configuration as be, configure as ee, BotClient as ve } from "@glodon-aiot/bot-client-sdk";
42
+ import { configuration as be, configure as q, BotClient as ve } from "@glodon-aiot/bot-client-sdk";
43
43
  import we from "./ReactTextGenerationUI/index.mjs";
44
- const I = {};
45
- class Ne {
46
- constructor(i) {
44
+ const U = {};
45
+ class Te {
46
+ constructor(t) {
47
47
  l(this, "_token");
48
48
  l(this, "_activeSession", null);
49
49
  l(this, "_applicationId");
@@ -62,107 +62,86 @@ class Ne {
62
62
  l(this, "errorHandlers", {});
63
63
  l(this, "wrapper", document.createElement("div"));
64
64
  l(this, "botClient", null);
65
- var H, z, M, V, E, R, A, N, T, D, j, F, P, W, $, O, J, K, Q, G, X, Y;
65
+ var B, H, E, M, V, A, N, R, T, z, j, D, F, P, O, $, W, J, K, Q, G, X;
66
66
  const {
67
- env: n,
68
- token: g,
69
- mode: f = "float",
70
- triggerButton: c,
71
- size: u,
72
- apiUrl: C,
73
- docViewerUrl: h,
74
- errorHandlers: d,
67
+ env: o,
68
+ token: h,
69
+ mode: g = "float",
70
+ triggerButton: u,
71
+ size: c,
72
+ apiUrl: p,
73
+ docViewerUrl: a,
74
+ errorHandlers: f,
75
75
  features: e,
76
- sessionId: o,
77
- icon: t,
78
- logo: s,
79
- stream: a
80
- } = i;
81
- this.uiConfig.icon = t || this.uiConfig.icon, this.uiConfig.logo = s || this.uiConfig.logo, (e == null ? void 0 : e.greeting) !== void 0 && (typeof e.greeting == "object" ? this.uiConfig.features = w(r({}, this.uiConfig.features), {
82
- greeting: r(r({}, typeof ((H = this.uiConfig.features) == null ? void 0 : H.greeting) != "object" ? {} : (z = this.uiConfig.features) == null ? void 0 : z.greeting), e.greeting)
83
- }) : this.uiConfig.features = w(r({}, this.uiConfig.features), {
76
+ sessionId: i,
77
+ icon: s,
78
+ logo: n,
79
+ stream: m
80
+ } = t;
81
+ this.uiConfig.icon = s || this.uiConfig.icon, this.uiConfig.logo = n || this.uiConfig.logo, (e == null ? void 0 : e.greeting) !== void 0 && (typeof e.greeting == "object" ? this.uiConfig.features = C(r({}, this.uiConfig.features), {
82
+ greeting: r(r({}, typeof ((B = this.uiConfig.features) == null ? void 0 : B.greeting) != "object" ? {} : (H = this.uiConfig.features) == null ? void 0 : H.greeting), e.greeting)
83
+ }) : this.uiConfig.features = C(r({}, this.uiConfig.features), {
84
84
  greeting: e.greeting
85
- })), this._token = g, this.rId = 0, this._defatulSessionId = o, this.errorHandlers = r(r({}, this.errorHandlers), d);
86
- const m = {
87
- sessionOpen: f === "float",
88
- sessionList: f === "float"
89
- }, L = (E = (V = (M = e == null ? void 0 : e.botMessageBox) == null ? void 0 : M.footer) == null ? void 0 : V.items) == null ? void 0 : E.find((v) => v.componentName === "AnswerAgain");
90
- (N = (A = (R = e == null ? void 0 : e.botMessageBox) == null ? void 0 : R.footer) == null ? void 0 : A.items) == null || N.find((v) => v.componentName === "Copy");
91
- const y = {
85
+ })), this._token = h, this.rId = 0, this._defatulSessionId = i, this.errorHandlers = r(r({}, this.errorHandlers), f);
86
+ const x = (V = (M = (E = e == null ? void 0 : e.botMessageBox) == null ? void 0 : E.footer) == null ? void 0 : M.items) == null ? void 0 : V.find((v) => v.componentName === "AnswerAgain");
87
+ (R = (N = (A = e == null ? void 0 : e.botMessageBox) == null ? void 0 : A.footer) == null ? void 0 : N.items) == null || R.find((v) => v.componentName === "Copy");
88
+ const w = {
92
89
  sessionList: e == null ? void 0 : e.sessionList,
93
90
  sessionOpen: e == null ? void 0 : e.newSession,
94
91
  fileUpload: e == null ? void 0 : e.fileUpload,
95
92
  userCopy: (T = e == null ? void 0 : e.userMessageBox) == null ? void 0 : T.copy,
96
- userEdit: (D = e == null ? void 0 : e.userMessageBox) == null ? void 0 : D.editAgain,
93
+ userEdit: (z = e == null ? void 0 : e.userMessageBox) == null ? void 0 : z.editAgain,
97
94
  userPrompt: e == null ? void 0 : e.fileUpload,
98
95
  prompt: e == null ? void 0 : e.prompts,
99
96
  relate: (j = e == null ? void 0 : e.botMessageBox) == null ? void 0 : j.relatedQuesions,
100
- again: !(L && L.visible === !1),
97
+ again: !(x && x.visible === !1),
101
98
  reference: {
102
- iconVisible: (P = (F = e == null ? void 0 : e.botMessageBox) == null ? void 0 : F.reference) == null ? void 0 : P.file,
103
- referenceFirst: (W = e == null ? void 0 : e.botMessageBox) == null ? void 0 : W.referenceFirst,
104
- isExpand: (O = ($ = e == null ? void 0 : e.botMessageBox) == null ? void 0 : $.reference) == null ? void 0 : O.itemExpanded
99
+ iconVisible: (F = (D = e == null ? void 0 : e.botMessageBox) == null ? void 0 : D.reference) == null ? void 0 : F.file,
100
+ referenceFirst: (P = e == null ? void 0 : e.botMessageBox) == null ? void 0 : P.referenceFirst,
101
+ isExpand: ($ = (O = e == null ? void 0 : e.botMessageBox) == null ? void 0 : O.reference) == null ? void 0 : $.itemExpanded
105
102
  },
106
- searchReference: (J = e == null ? void 0 : e.botMessageBox) == null ? void 0 : J.searchReference,
103
+ searchReference: (W = e == null ? void 0 : e.botMessageBox) == null ? void 0 : W.searchReference,
107
104
  knowledges: !!(e != null && e.knowledges),
108
105
  metadata: e == null ? void 0 : e.metadata,
109
106
  greet: (e == null ? void 0 : e.greeting) !== !1,
110
107
  imageUpload: e == null ? void 0 : e.imageUpload,
111
- promptVariables: (e == null ? void 0 : e.promptVariables) === void 0 ? (K = this.uiConfig.transform) == null ? void 0 : K.promptVariables : (e == null ? void 0 : e.promptVariables) === !0 || typeof (e == null ? void 0 : e.promptVariables) == "object" && ((Q = e == null ? void 0 : e.promptVariables) == null ? void 0 : Q.visible) !== !1 ? (G = this.uiConfig.transform) == null ? void 0 : G.promptVariables : !1,
112
- connectNetwork: (e == null ? void 0 : e.connectNetwork) === void 0 ? (X = this.uiConfig.transform) == null ? void 0 : X.connectNetwork : (e == null ? void 0 : e.connectNetwork) === !0 || (typeof (e == null ? void 0 : e.connectNetwork) == "object" && typeof (e == null ? void 0 : e.connectNetwork.visible) == "boolean" ? e == null ? void 0 : e.connectNetwork.visible : (Y = this.uiConfig.transform) == null ? void 0 : Y.connectNetwork)
113
- }, _ = {
114
- sider: f === "inlay"
108
+ promptVariables: (e == null ? void 0 : e.promptVariables) === void 0 ? (J = this.uiConfig.transform) == null ? void 0 : J.promptVariables : (e == null ? void 0 : e.promptVariables) === !0 || typeof (e == null ? void 0 : e.promptVariables) == "object" && ((K = e == null ? void 0 : e.promptVariables) == null ? void 0 : K.visible) !== !1 ? (Q = this.uiConfig.transform) == null ? void 0 : Q.promptVariables : !1,
109
+ connectNetwork: (e == null ? void 0 : e.connectNetwork) === void 0 ? (G = this.uiConfig.transform) == null ? void 0 : G.connectNetwork : (e == null ? void 0 : e.connectNetwork) === !0 || (typeof (e == null ? void 0 : e.connectNetwork) == "object" && typeof (e == null ? void 0 : e.connectNetwork.visible) == "boolean" ? e == null ? void 0 : e.connectNetwork.visible : (X = this.uiConfig.transform) == null ? void 0 : X.connectNetwork)
110
+ }, L = {};
111
+ t.header !== void 0 && (L.showHeader = !!t.header), Object.keys(w).forEach((v) => {
112
+ w[v] === void 0 && delete w[v];
113
+ });
114
+ const ee = {
115
+ triggerButton: b(this.uiConfig.triggerButton, u),
116
+ size: b(this.uiConfig.size, c),
117
+ theme: b(this.uiConfig.theme, U)
115
118
  };
116
- if (i.header !== void 0 && (_.showHeader = !!i.header), i.sider !== void 0 && (_.sider = !!i.sider), Object.keys(y).forEach((v) => {
117
- y[v] === void 0 && delete y[v];
118
- }), f === "inlay") {
119
- const v = {
120
- triggerButton: b({
121
- visible: !1
122
- }, c),
123
- open: !0,
124
- resizable: !1,
125
- size: b({
126
- width: "100%",
127
- height: "100%",
128
- maxWidth: "100%",
129
- maxHeight: "100%",
130
- minWidth: "100%"
131
- }, u),
132
- theme: b(this.uiConfig.theme, I),
133
- history: !0
134
- };
135
- this.uiConfig = w(r(r(r(r({}, this.uiConfig), i), v), _), {
136
- transform: r(r(r(r({}, this.uiConfig.transform), m), i.transform), y)
137
- }), this.wrapper = this.uiConfig.getContainer();
138
- } else {
139
- const v = {
140
- triggerButton: b(this.uiConfig.triggerButton, c),
141
- size: b(this.uiConfig.size, r({}, u)),
142
- theme: b(this.uiConfig.theme, I)
143
- };
144
- this.uiConfig = w(r(r(r(r(r({}, this.uiConfig), i), v), _), y), {
145
- transform: r(r(r(r({}, this.uiConfig.transform), m), i.transform), y)
146
- }), this.uiConfig.getContainer().append(this.wrapper);
147
- }
148
- this._mode = f, this.env = n || "prod", this.stream = a, ee({
119
+ this.uiConfig = C(r(r(r(r({}, this.uiConfig), t), ee), L), {
120
+ transform: r(r(r({}, this.uiConfig.transform), t.transform), w)
121
+ }), this.env = o || "prod", this.stream = m, q({
149
122
  stream: this.stream
150
- }), this._applicationId = me(g).rid, this.apiUrl = C || ce[this.env] || de, this.docViewerUrl = h || ue, this.service = this.setService(), this.createBotClientSDK().then(() => {
151
- this.render();
123
+ }), this._applicationId = me(h).rid, this.apiUrl = p || ue[this.env] || ce, this.docViewerUrl = a || de, this.service = this.setService(), this.wrapper = document.createElement("div"), this.wrapper.style.height = "100%", this.wrapper.style.width = "100%", this.createBotClientSDK().then(() => {
124
+ this.mode = g;
152
125
  });
153
126
  }
154
127
  get token() {
155
128
  return this._token;
156
129
  }
157
- set token(i) {
158
- this._token = i, this.reload();
130
+ set token(t) {
131
+ this._token = t, this.reload();
159
132
  }
160
133
  get mode() {
161
134
  return this._mode;
162
135
  }
163
- set mode(i) {
164
- if (i === "inlay") {
165
- const n = {
136
+ set mode(t) {
137
+ const o = {
138
+ sessionOpen: t === "float",
139
+ sessionList: t === "float"
140
+ }, h = {
141
+ sider: t === "inlay"
142
+ };
143
+ if (t === "inlay") {
144
+ const g = {
166
145
  triggerButton: b({
167
146
  visible: !1
168
147
  }, this.uiConfig.triggerButton),
@@ -175,19 +154,21 @@ class Ne {
175
154
  maxHeight: "100%",
176
155
  minWidth: "100%"
177
156
  }, this.uiConfig.size),
178
- theme: b(this.uiConfig.theme, I),
157
+ theme: b(this.uiConfig.theme, U),
179
158
  history: !0
180
159
  };
181
- this.uiConfig = r(r({}, this.uiConfig), n), this.wrapper = this.uiConfig.getContainer();
160
+ this.uiConfig = C(r(r(r({}, this.uiConfig), g), h), {
161
+ transform: r(r({}, this.uiConfig.transform), o)
162
+ }), this.uiConfig.getContainer().append(this.wrapper);
182
163
  } else {
183
- const n = {
184
- triggerButton: b(this.uiConfig.triggerButton, this.uiConfig.triggerButton),
185
- size: b(this.uiConfig.size, r({}, this.uiConfig.size)),
186
- theme: b(this.uiConfig.theme, I)
164
+ const g = {
165
+ theme: b(this.uiConfig.theme, U)
187
166
  };
188
- this.uiConfig = r(r({}, this.uiConfig), n), this._mode === "inlay" && this.wrapper.remove(), this.uiConfig.getContainer().append(this.wrapper);
167
+ this.uiConfig = C(r(r(r({}, this.uiConfig), g), h), {
168
+ transform: r(r({}, this.uiConfig.transform), o)
169
+ }), this._mode === "inlay" && this.wrapper.remove(), this.uiConfig.getContainer().append(this.wrapper);
189
170
  }
190
- this._mode = i, this.render();
171
+ this._mode = t, this.render();
191
172
  }
192
173
  get activeSession() {
193
174
  return this._activeSession;
@@ -196,35 +177,35 @@ class Ne {
196
177
  return this._applicationId;
197
178
  }
198
179
  setService() {
199
- const i = this.apiUrl, n = (h) => {
180
+ const t = this.apiUrl, o = (a) => {
200
181
  var e;
201
- const d = this.token;
202
- if (!d)
203
- return h;
204
- if (Ce(d)) {
205
- const o = "token is timeout";
182
+ const f = this.token;
183
+ if (!f)
184
+ return a;
185
+ if (Ce(f)) {
186
+ const i = "token is timeout";
206
187
  this.errorHandlers.token ? typeof this.errorHandlers.token == "function" ? this.errorHandlers.token(
207
188
  // @ts-ignore
208
- new Error(o, {
189
+ new Error(i, {
209
190
  cause: {
210
191
  status: 401,
211
- message: o
192
+ message: i
212
193
  }
213
194
  })
214
- ) : console.error("errorHandlers.token is not a function") : console.error(o);
195
+ ) : console.error("errorHandlers.token is not a function") : console.error(i);
215
196
  }
216
- return h.headers = (e = h.headers) != null ? e : {}, h.headers = w(r({}, h.headers), {
217
- Authorization: d ? `Bearer ${d}` : ""
218
- }), h;
197
+ return a.headers = (e = a.headers) != null ? e : {}, a.headers = C(r({}, a.headers), {
198
+ Authorization: f ? `Bearer ${f}` : ""
199
+ }), a;
219
200
  };
220
- function g(h, d = !0) {
221
- const e = `${i}${h}`, o = ge.create({
201
+ function h(a, f = !0) {
202
+ const e = `${t}${a}`, i = le.create({
222
203
  baseURL: e
223
204
  });
224
- return d && o.interceptors.request.use(n), o;
205
+ return f && i.interceptors.request.use(o), i;
225
206
  }
226
- const f = (h, d) => {
227
- if (h === 401) {
207
+ const g = (a, f) => {
208
+ if (a === 401) {
228
209
  const e = "token is invalid";
229
210
  this.errorHandlers.token ? typeof this.errorHandlers.token == "function" ? this.errorHandlers.token(
230
211
  // @ts-ignore
@@ -236,32 +217,32 @@ class Ne {
236
217
  })
237
218
  ) : console.error("errorHandlers.token is not a function") : console.error(e);
238
219
  }
239
- }, c = (h, d, e) => {
240
- h !== 10001 && h !== 10215 && (e || (B.config({
220
+ }, u = (a, f, e) => {
221
+ a !== 10001 && a !== 10215 && (e || (S.config({
241
222
  getContainer: this.uiConfig.getContainer
242
- }), B.error({
243
- message: d
244
- }), B.config({
223
+ }), S.error({
224
+ message: f
225
+ }), S.config({
245
226
  getContainer: void 0
246
227
  })));
247
- }, u = g("");
248
- return new pe(u, () => this.token, {
249
- onHttpStatusError: f,
250
- onAppStatusError: c
228
+ }, c = h("");
229
+ return new pe(c, () => this.token, {
230
+ onHttpStatusError: g,
231
+ onAppStatusError: u
251
232
  });
252
233
  }
253
234
  reload() {
254
- var i;
255
- this._defatulSessionId = (i = this.activeSession) == null ? void 0 : i.id, this.destroy(() => {
235
+ var t;
236
+ this._defatulSessionId = (t = this.activeSession) == null ? void 0 : t.id, this.destroy(() => {
256
237
  this.service = this.setService(), this.rId = this.rId + 1, this.render();
257
238
  });
258
239
  }
259
- getMessageList(i) {
260
- var n, g;
261
- return i || (i = (n = this.activeSession) == null ? void 0 : n.id), !this.applicationId || !i ? Promise.resolve([]) : (g = this.service) == null ? void 0 : g.getChatHistorySessionId(this.applicationId, i);
240
+ getMessageList(t) {
241
+ var o, h;
242
+ return t || (t = (o = this.activeSession) == null ? void 0 : o.id), !this.applicationId || !t ? Promise.resolve([]) : (h = this.service) == null ? void 0 : h.getChatHistorySessionId(this.applicationId, t);
262
243
  }
263
- input(i) {
264
- this._defaultInputText = i, this.render();
244
+ input(t) {
245
+ this._defaultInputText = t, this.render();
265
246
  }
266
247
  disable() {
267
248
  this._inputDisabled = !0, this.render();
@@ -270,32 +251,32 @@ class Ne {
270
251
  this._inputDisabled = !1, this.render();
271
252
  }
272
253
  getSessionList() {
273
- return this._agentClientRef.current ? new Promise((n, g) => {
274
- var f, c;
275
- (c = (f = this._agentClientRef.current) == null ? void 0 : f.getSessionList()) == null || c.then((u) => {
276
- n(u);
277
- }).catch((u) => {
278
- g(u);
254
+ return this._agentClientRef.current ? new Promise((o, h) => {
255
+ var g, u;
256
+ (u = (g = this._agentClientRef.current) == null ? void 0 : g.getSessionList()) == null || u.then((c) => {
257
+ o(c);
258
+ }).catch((c) => {
259
+ h(c);
279
260
  });
280
261
  }) : Promise.reject(new Error("client is not loaded"));
281
262
  }
282
- sessionCreate(i) {
283
- return this._agentClientRef.current ? new Promise((g, f) => {
284
- var c, u;
285
- (u = (c = this._agentClientRef.current) == null ? void 0 : c.sessionCreate(r({
263
+ sessionCreate(t) {
264
+ return this._agentClientRef.current ? new Promise((h, g) => {
265
+ var u, c;
266
+ (c = (u = this._agentClientRef.current) == null ? void 0 : u.sessionCreate(r({
286
267
  name: "新建会话"
287
- }, i))) == null || u.then((C) => {
288
- g(C);
289
- }).catch((C) => {
290
- f(C);
268
+ }, t))) == null || c.then((p) => {
269
+ h(p);
270
+ }).catch((p) => {
271
+ g(p);
291
272
  });
292
273
  }) : Promise.reject(new Error("client is not loaded"));
293
274
  }
294
275
  createBotClientSDK() {
295
- return k(this, null, function* () {
296
- return new Promise((i, n) => {
276
+ return y(this, null, function* () {
277
+ return new Promise((t, o) => {
297
278
  if (this.token)
298
- ee({
279
+ q({
299
280
  debug: this.uiConfig.debug,
300
281
  env: this.uiConfig.env,
301
282
  apiRoot: this.apiUrl
@@ -310,11 +291,11 @@ class Ne {
310
291
  // 这里记录应用的名称和版本,以便后期数据分析
311
292
  ui: {
312
293
  name: "bot-client-ui",
313
- version: le.version
294
+ version: ge.version
314
295
  }
315
- }), this.botClient.ready ? i(this.botClient) : this.botClient.addEventListener("ready", () => k(this, null, function* () {
316
- var g;
317
- this.botClient ? (((g = this.botClient.application) == null ? void 0 : g.type) === q.Text && (this.mode = "inlay"), i(this.botClient)) : n(this.botClient);
296
+ }), this.botClient.ready ? t(this.botClient) : this.botClient.addEventListener("ready", () => y(this, null, function* () {
297
+ var h;
298
+ this.botClient ? (((h = this.botClient.application) == null ? void 0 : h.type) === Z.Text && (this.mode = "inlay"), t(this.botClient)) : o(this.botClient);
318
299
  }), !0);
319
300
  else
320
301
  throw Error("token is required");
@@ -322,12 +303,11 @@ class Ne {
322
303
  });
323
304
  }
324
305
  render() {
325
- return k(this, null, function* () {
326
- var n, g, f, c, u, C, h, d, e;
327
- let i = this.wrapper.getBoundingClientRect().height;
328
- if (this.wrapper.style.height = `${i}px`, !((n = this.botClient) != null && n.application))
306
+ return y(this, null, function* () {
307
+ var t, o, h, g, u, c, p, a, f;
308
+ if (this.wrapper.style.height = "100%", !((t = this.botClient) != null && t.application))
329
309
  throw Error("application is required");
330
- this.botClient.application.type === q.Text ? x.render(/* @__PURE__ */ U(we, {
310
+ this.botClient.application.type === Z.Text ? I.render(/* @__PURE__ */ k(we, {
331
311
  rId: this.rId,
332
312
  application: this.botClient.application,
333
313
  sessionId: this._defatulSessionId,
@@ -352,68 +332,68 @@ class Ne {
352
332
  docViewerUrl: this.docViewerUrl,
353
333
  plugins: this.uiConfig.plugins,
354
334
  mcp: this.uiConfig.mcp,
355
- transform: w(r({}, this.uiConfig.transform), {
356
- knowledges: ((g = this.uiConfig.features) == null ? void 0 : g.knowledges) === !0 || typeof ((f = this.uiConfig.features) == null ? void 0 : f.knowledges) == "object" && ((u = (c = this.uiConfig.features) == null ? void 0 : c.knowledges) == null ? void 0 : u.visible) !== !1
335
+ transform: C(r({}, this.uiConfig.transform), {
336
+ knowledges: ((o = this.uiConfig.features) == null ? void 0 : o.knowledges) === !0 || typeof ((h = this.uiConfig.features) == null ? void 0 : h.knowledges) == "object" && ((u = (g = this.uiConfig.features) == null ? void 0 : g.knowledges) == null ? void 0 : u.visible) !== !1
357
337
  }),
358
338
  features: this.uiConfig.features,
359
339
  disabled: this._inputDisabled,
360
340
  sider: this.uiConfig.sider,
361
341
  footer: this.uiConfig.footer,
362
- onComment: (o) => {
363
- var t, s;
342
+ onComment: (e) => {
343
+ var i, s;
364
344
  try {
365
- (s = (t = this.uiConfig.eventListeners) == null ? void 0 : t.comment) == null || s.call(t, o);
366
- } catch (a) {
367
- console.error(a);
345
+ (s = (i = this.uiConfig.eventListeners) == null ? void 0 : i.comment) == null || s.call(i, e);
346
+ } catch (n) {
347
+ console.error(n);
368
348
  }
369
349
  },
370
350
  agentClient: this.botClient,
371
- onMessage: (o) => {
372
- var t, s;
373
- if (o.message.messageId)
351
+ onMessage: (e) => {
352
+ var i, s;
353
+ if (e.message.messageId)
374
354
  try {
375
- (s = (t = this.uiConfig.eventListeners) == null ? void 0 : t.message) == null || s.call(t, o);
376
- } catch (a) {
377
- console.error(a);
355
+ (s = (i = this.uiConfig.eventListeners) == null ? void 0 : i.message) == null || s.call(i, e);
356
+ } catch (n) {
357
+ console.error(n);
378
358
  }
379
359
  },
380
- beforeMessageSend: (o) => {
381
- var t, s, a;
382
- if (!((t = this.uiConfig.eventListeners) != null && t.beforemessagesend))
360
+ beforeMessageSend: (e) => {
361
+ var i, s, n;
362
+ if (!((i = this.uiConfig.eventListeners) != null && i.beforemessagesend))
383
363
  return !0;
384
364
  try {
385
- return ((a = (s = this.uiConfig.eventListeners) == null ? void 0 : s.beforemessagesend) == null ? void 0 : a.call(s, o)) || !1;
365
+ return ((n = (s = this.uiConfig.eventListeners) == null ? void 0 : s.beforemessagesend) == null ? void 0 : n.call(s, e)) || !1;
386
366
  } catch (m) {
387
367
  return console.error(m), !1;
388
368
  }
389
369
  },
390
- onSessionUnload: (o) => {
391
- var t, s;
370
+ onSessionUnload: (e) => {
371
+ var i, s;
392
372
  this._activeSession = null;
393
373
  try {
394
- (s = (t = this.uiConfig.eventListeners) == null ? void 0 : t.sessionunload) == null || s.call(t, o);
395
- } catch (a) {
396
- console.error(a);
374
+ (s = (i = this.uiConfig.eventListeners) == null ? void 0 : i.sessionunload) == null || s.call(i, e);
375
+ } catch (n) {
376
+ console.error(n);
397
377
  }
398
378
  },
399
- onSessionLoad: (o) => {
400
- var t, s, a;
401
- if (((t = this._activeSession) == null ? void 0 : t.id) === o.sessionId)
402
- this._activeSession = o.session;
379
+ onSessionLoad: (e) => {
380
+ var i, s, n;
381
+ if (((i = this._activeSession) == null ? void 0 : i.id) === e.sessionId)
382
+ this._activeSession = e.session;
403
383
  else {
404
- this._activeSession = o.session;
384
+ this._activeSession = e.session;
405
385
  try {
406
- (a = (s = this.uiConfig.eventListeners) == null ? void 0 : s.sessionload) == null || a.call(s, o);
386
+ (n = (s = this.uiConfig.eventListeners) == null ? void 0 : s.sessionload) == null || n.call(s, e);
407
387
  } catch (m) {
408
388
  console.error(m);
409
389
  }
410
390
  }
411
391
  },
412
- onHistoryLoad: (o) => {
413
- var t, s, a;
414
- if (((t = this._activeSession) == null ? void 0 : t.id) === o.sessionId)
392
+ onHistoryLoad: (e) => {
393
+ var i, s, n;
394
+ if (((i = this._activeSession) == null ? void 0 : i.id) === e.sessionId)
415
395
  try {
416
- (a = (s = this.uiConfig.eventListeners) == null ? void 0 : s.historyload) == null || a.call(s, o);
396
+ (n = (s = this.uiConfig.eventListeners) == null ? void 0 : s.historyload) == null || n.call(s, e);
417
397
  } catch (m) {
418
398
  console.error(m);
419
399
  }
@@ -423,7 +403,7 @@ class Ne {
423
403
  } : void 0,
424
404
  bodyStyle: this.uiConfig.bodyStyle,
425
405
  stream: this.stream
426
- }), this.wrapper) : x.render(/* @__PURE__ */ U(he, {
406
+ }), this.wrapper) : I.render(/* @__PURE__ */ k(he, {
427
407
  ref: this._agentClientRef,
428
408
  rId: this.rId,
429
409
  application: this.botClient.application,
@@ -450,67 +430,67 @@ class Ne {
450
430
  docViewerUrl: this.docViewerUrl,
451
431
  plugins: this.uiConfig.plugins,
452
432
  mcp: this.uiConfig.mcp,
453
- transform: w(r({}, this.uiConfig.transform), {
454
- knowledges: ((C = this.uiConfig.features) == null ? void 0 : C.knowledges) === !0 || typeof ((h = this.uiConfig.features) == null ? void 0 : h.knowledges) == "object" && ((e = (d = this.uiConfig.features) == null ? void 0 : d.knowledges) == null ? void 0 : e.visible) !== !1
433
+ transform: C(r({}, this.uiConfig.transform), {
434
+ knowledges: ((c = this.uiConfig.features) == null ? void 0 : c.knowledges) === !0 || typeof ((p = this.uiConfig.features) == null ? void 0 : p.knowledges) == "object" && ((f = (a = this.uiConfig.features) == null ? void 0 : a.knowledges) == null ? void 0 : f.visible) !== !1
455
435
  }),
456
436
  features: this.uiConfig.features,
457
437
  disabled: this._inputDisabled,
458
438
  sider: this.uiConfig.sider,
459
439
  footer: this.uiConfig.footer,
460
- onComment: (o) => {
461
- var t, s;
440
+ onComment: (e) => {
441
+ var i, s;
462
442
  try {
463
- (s = (t = this.uiConfig.eventListeners) == null ? void 0 : t.comment) == null || s.call(t, o);
464
- } catch (a) {
465
- console.error(a);
443
+ (s = (i = this.uiConfig.eventListeners) == null ? void 0 : i.comment) == null || s.call(i, e);
444
+ } catch (n) {
445
+ console.error(n);
466
446
  }
467
447
  },
468
- onMessage: (o) => {
469
- var t, s;
470
- if (o.message.messageId)
448
+ onMessage: (e) => {
449
+ var i, s;
450
+ if (e.message.messageId)
471
451
  try {
472
- (s = (t = this.uiConfig.eventListeners) == null ? void 0 : t.message) == null || s.call(t, o);
473
- } catch (a) {
474
- console.error(a);
452
+ (s = (i = this.uiConfig.eventListeners) == null ? void 0 : i.message) == null || s.call(i, e);
453
+ } catch (n) {
454
+ console.error(n);
475
455
  }
476
456
  },
477
- beforeMessageSend: (o) => {
478
- var t, s, a;
479
- if (!((t = this.uiConfig.eventListeners) != null && t.beforemessagesend))
457
+ beforeMessageSend: (e) => {
458
+ var i, s, n;
459
+ if (!((i = this.uiConfig.eventListeners) != null && i.beforemessagesend))
480
460
  return !0;
481
461
  try {
482
- return ((a = (s = this.uiConfig.eventListeners) == null ? void 0 : s.beforemessagesend) == null ? void 0 : a.call(s, o)) || !1;
462
+ return ((n = (s = this.uiConfig.eventListeners) == null ? void 0 : s.beforemessagesend) == null ? void 0 : n.call(s, e)) || !1;
483
463
  } catch (m) {
484
464
  return console.error(m), !1;
485
465
  }
486
466
  },
487
- onSessionUnload: (o) => {
488
- var t, s;
467
+ onSessionUnload: (e) => {
468
+ var i, s;
489
469
  this._activeSession = null;
490
470
  try {
491
- (s = (t = this.uiConfig.eventListeners) == null ? void 0 : t.sessionunload) == null || s.call(t, o);
492
- } catch (a) {
493
- console.error(a);
471
+ (s = (i = this.uiConfig.eventListeners) == null ? void 0 : i.sessionunload) == null || s.call(i, e);
472
+ } catch (n) {
473
+ console.error(n);
494
474
  }
495
475
  },
496
- onSessionLoad: (o) => {
497
- var t, s, a;
498
- if (((t = this._activeSession) == null ? void 0 : t.id) === o.sessionId)
499
- this._activeSession = o.session;
476
+ onSessionLoad: (e) => {
477
+ var i, s, n;
478
+ if (((i = this._activeSession) == null ? void 0 : i.id) === e.sessionId)
479
+ this._activeSession = e.session;
500
480
  else {
501
- this._activeSession = o.session;
481
+ this._activeSession = e.session;
502
482
  try {
503
- (a = (s = this.uiConfig.eventListeners) == null ? void 0 : s.sessionload) == null || a.call(s, o);
483
+ (n = (s = this.uiConfig.eventListeners) == null ? void 0 : s.sessionload) == null || n.call(s, e);
504
484
  } catch (m) {
505
485
  console.error(m);
506
486
  }
507
487
  }
508
488
  },
509
- onHistoryLoad: (o) => {
510
- var t, s, a;
511
- if (((t = this._activeSession) == null ? void 0 : t.id) === o.sessionId)
489
+ onHistoryLoad: (e) => {
490
+ var i, s, n;
491
+ if (((i = this._activeSession) == null ? void 0 : i.id) === e.sessionId)
512
492
  try {
513
- (a = (s = this.uiConfig.eventListeners) == null ? void 0 : s.historyload) == null || a.call(s, o);
493
+ (n = (s = this.uiConfig.eventListeners) == null ? void 0 : s.historyload) == null || n.call(s, e);
514
494
  } catch (m) {
515
495
  console.error(m);
516
496
  }
@@ -523,10 +503,10 @@ class Ne {
523
503
  }), this.wrapper), this._defaultInputText = "";
524
504
  });
525
505
  }
526
- destroy(i) {
527
- x.render(/* @__PURE__ */ U(re, {}), this.wrapper, i);
506
+ destroy(t) {
507
+ I.render(/* @__PURE__ */ k(re, {}), this.wrapper, t);
528
508
  }
529
509
  }
530
510
  export {
531
- Ne as default
511
+ Te as default
532
512
  };