@ibiz-template-plugin/ai-chat 0.0.39 → 0.0.40

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/index.es.js CHANGED
@@ -4333,20 +4333,21 @@ class Ws {
4333
4333
  * @return {*} {Promise<void>}
4334
4334
  */
4335
4335
  async handleSuggestionClick(e, t, i) {
4336
+ var l;
4336
4337
  const r = this.messages.value.findIndex(
4337
- (l) => l.messageid === e.messageid
4338
+ (a) => a.messageid === e.messageid
4338
4339
  );
4339
4340
  if (r !== -1) {
4340
- const l = this.messages.value[r]._origin;
4341
- l.suggestions = void 0, this.messages.value[r].replace(l), this.messages.value = [...this.messages.value];
4341
+ const a = this.messages.value[r]._origin;
4342
+ a.suggestions = void 0, this.messages.value[r].replace(a), this.messages.value = [...this.messages.value];
4342
4343
  }
4343
4344
  this.asyncToIndexDB();
4344
4345
  const { type: s, metadata: o } = t;
4345
4346
  switch (s) {
4346
4347
  case "action":
4347
4348
  if (this.opts.extendToolbarClick) {
4348
- const l = t.data.actionid;
4349
- if (!l)
4349
+ const a = t.data.actionid;
4350
+ if (!a)
4350
4351
  throw new Error("actionid不能为空");
4351
4352
  this.addMessage({
4352
4353
  messageid: He(),
@@ -4355,25 +4356,22 @@ class Ws {
4355
4356
  role: "USER",
4356
4357
  content: o.content_name
4357
4358
  });
4358
- const a = { ...e };
4359
- Object.assign(a, { topic: this.topic }), a.msg.realcontent = e.realcontent;
4360
- const c = await this.opts.extendToolbarClick(
4359
+ const c = { ...e };
4360
+ Object.assign(c, { topic: this.topic }), c.msg.realcontent = e.realcontent;
4361
+ const d = await this.opts.extendToolbarClick(
4361
4362
  i,
4362
- { id: l, appId: this.context.srfappid },
4363
+ { id: a, appId: this.context.srfappid },
4363
4364
  this.context,
4364
4365
  this.params,
4365
- a
4366
- );
4367
- if (c && c.data) {
4368
- const d = c.data[0];
4369
- this.addMessage({
4370
- messageid: He(),
4371
- state: 30,
4372
- type: "DEFAULT",
4373
- role: "ASSISTANT",
4374
- ...d
4375
- });
4376
- }
4366
+ c
4367
+ ), u = (l = d == null ? void 0 : d.data) == null ? void 0 : l[0];
4368
+ u.content && this.addMessage({
4369
+ messageid: He(),
4370
+ state: 30,
4371
+ type: u.type || "DEFAULT",
4372
+ role: u.role || "ASSISTANT",
4373
+ content: u.content
4374
+ });
4377
4375
  }
4378
4376
  break;
4379
4377
  case "raw":
@@ -5190,7 +5188,7 @@ class Vu {
5190
5188
  const r = this.aiTopic.getCurrentTopicByID(
5191
5189
  e.id
5192
5190
  );
5193
- if (r && r.aiChat && r.aiChat.activeAIAgentID)
5191
+ if (e.sequence = r.sequence, e.isTop = r.isTop, r && r.aiChat && r.aiChat.activeAIAgentID)
5194
5192
  t.activeAIAgentID = r.aiChat.activeAIAgentID, e.aiChat.activeAIAgentID = r.aiChat.activeAIAgentID;
5195
5193
  else if (t.aiAgentlist && t.aiAgentlist.length > 0 && !t.activeAIAgentID) {
5196
5194
  const o = t.aiAgentlist.find(
@@ -19882,7 +19880,7 @@ const Vn = new L("chat-search"), L1 = (n) => {
19882
19880
  const It = new L("chat-topics"), B1 = (n) => {
19883
19881
  const e = se(null), t = F(void 0), i = F([]);
19884
19882
  K(() => {
19885
- const l = n.controller.topics.value.sort((a, c) => a.isTop !== c.isTop ? c.isTop ? 1 : -1 : a.sequence - c.sequence);
19883
+ const l = [...n.controller.topics.value].sort((a, c) => a.isTop !== c.isTop ? c.isTop ? 1 : -1 : a.sequence - c.sequence);
19886
19884
  i.value = l.filter(
19887
19885
  (a) => {
19888
19886
  var c, d;