@mxmweb/aichat 1.3.1 → 1.3.3

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 (2) hide show
  1. package/index.js +90 -78
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -43101,7 +43101,7 @@ function O2({
43101
43101
  disabledText: "#808080",
43102
43102
  shadow: "#000000",
43103
43103
  appBackground: "transparent"
43104
- }, h = n.map((v, d) => /* @__PURE__ */ k.jsxs("div", { className: "relative flex flex-col gap-2.5 items-center justify-center", children: [
43104
+ }, h = n.map((v, d) => (console.log(v, "fffffffff"), /* @__PURE__ */ k.jsxs("div", { className: "relative flex flex-col gap-2.5 items-center justify-center", children: [
43105
43105
  /* @__PURE__ */ k.jsx("div", { className: "absolute right-1 top-1 z-10", children: /* @__PURE__ */ k.jsx(
43106
43106
  Sh,
43107
43107
  {
@@ -43134,7 +43134,7 @@ function O2({
43134
43134
  kh,
43135
43135
  {
43136
43136
  file_type: Th(v.file.name || v.name),
43137
- file_name: v.file.name,
43137
+ file_name: v.name || v.file.name,
43138
43138
  url: v.url,
43139
43139
  retrieve_tags: [],
43140
43140
  styles: i,
@@ -43143,7 +43143,7 @@ function O2({
43143
43143
  parse_url: v.convertedFilePath
43144
43144
  }
43145
43145
  )
43146
- ] }, v.file.name + d)), p = r.map((v, d) => {
43146
+ ] }, v.file.name + d))), p = r.map((v, d) => {
43147
43147
  const b = v.file.name.split(".").pop() || "", y = El(b, i);
43148
43148
  return /* @__PURE__ */ k.jsx(
43149
43149
  $2,
@@ -44978,7 +44978,7 @@ function F2({
44978
44978
  const ne = {};
44979
44979
  C.forEach((fe) => {
44980
44980
  fe.type === "form" && (ne[fe.key] = S.current[fe.key] ?? fe.initialValues ?? {});
44981
- }), console.log("sender:send_recommandQuestion``````````", X), n == null || n("sender:send", {
44981
+ }), n == null || n("sender:send", {
44982
44982
  content: X.content,
44983
44983
  files: p,
44984
44984
  status: r,
@@ -44987,7 +44987,12 @@ function F2({
44987
44987
  formData: ne,
44988
44988
  // sessionId: currentSessionId,
44989
44989
  clearFn: I
44990
- });
44990
+ }), setTimeout(() => {
44991
+ f.current && f.current.scrollTo && f.current.scrollTo({
44992
+ top: 0,
44993
+ behavior: "smooth"
44994
+ });
44995
+ }, 120);
44991
44996
  break;
44992
44997
  }
44993
44998
  case "sender:send": {
@@ -45003,7 +45008,12 @@ function F2({
45003
45008
  formData: ne,
45004
45009
  // sessionId: currentSessionId,
45005
45010
  clearFn: I
45006
- });
45011
+ }), setTimeout(() => {
45012
+ f.current && f.current.scrollTo && f.current.scrollTo({
45013
+ top: 0,
45014
+ behavior: "smooth"
45015
+ });
45016
+ }, 120);
45007
45017
  break;
45008
45018
  }
45009
45019
  default:
@@ -45203,7 +45213,26 @@ function F2({
45203
45213
  display: "flex",
45204
45214
  flexDirection: "column"
45205
45215
  }, children: [
45206
- /* @__PURE__ */ k.jsxs(
45216
+ d && /* @__PURE__ */ k.jsx(
45217
+ "div",
45218
+ {
45219
+ style: {
45220
+ position: "absolute",
45221
+ inset: 0,
45222
+ background: H.colors.primary + "14",
45223
+ border: `4px dashed ${H.colors.primary}`,
45224
+ display: "flex",
45225
+ alignItems: "center",
45226
+ justifyContent: "center",
45227
+ zIndex: 50,
45228
+ pointerEvents: "none",
45229
+ userSelect: "none",
45230
+ borderRadius: W
45231
+ },
45232
+ children: /* @__PURE__ */ k.jsx("div", { style: { color: H.colors.primary, fontSize: Gm.lg, fontWeight: 700 }, children: "\u677E\u5F00\u6587\u4EF6\u4EE5\u4E0A\u4F20" })
45233
+ }
45234
+ ),
45235
+ /* @__PURE__ */ k.jsx(
45207
45236
  "div",
45208
45237
  {
45209
45238
  style: {
@@ -45217,73 +45246,52 @@ function F2({
45217
45246
  onDrop: F,
45218
45247
  onDragOver: A,
45219
45248
  onDragLeave: B,
45220
- children: [
45221
- d && /* @__PURE__ */ k.jsx(
45222
- "div",
45223
- {
45224
- style: {
45225
- position: "absolute",
45226
- inset: 0,
45227
- background: H.colors.primary + "14",
45228
- border: `4px dashed ${H.colors.primary}`,
45229
- display: "flex",
45230
- alignItems: "center",
45231
- justifyContent: "center",
45232
- zIndex: 50,
45233
- pointerEvents: "none",
45234
- userSelect: "none",
45235
- borderRadius: W
45236
- },
45237
- children: /* @__PURE__ */ k.jsx("div", { style: { color: H.colors.primary, fontSize: Gm.lg, fontWeight: 700 }, children: "\u677E\u5F00\u6587\u4EF6\u4EE5\u4E0A\u4F20" })
45238
- }
45239
- ),
45240
- /* @__PURE__ */ k.jsx(
45241
- "div",
45242
- {
45243
- style: {
45244
- width: "100%",
45245
- minWidth: 520,
45246
- margin: "0 auto",
45247
- flex: 1,
45248
- display: "flex",
45249
- flexDirection: "column",
45250
- height: "100%",
45251
- overflow: "hidden"
45252
- },
45253
- children: e.isNew ? a != null && a.WelcomeComponent ? /* @__PURE__ */ k.jsx(a.WelcomeComponent, {}) : /* @__PURE__ */ k.jsx(bW, {}) : r.display === "loading" ? a != null && a.DisplayLoading ? /* @__PURE__ */ k.jsx(a.DisplayLoading, {}) : /* @__PURE__ */ k.jsx(vW, {}) : r.display === "error" ? a != null && a.DisplayError ? /* @__PURE__ */ k.jsx(a.DisplayError, {}) : /* @__PURE__ */ k.jsx(hW, {}) : /* @__PURE__ */ k.jsxs(
45254
- "div",
45255
- {
45256
- ref: f,
45257
- className: "relative px-8",
45258
- style: {
45259
- direction: "rtl",
45260
- transform: "rotate(180deg)",
45261
- flex: 1,
45262
- overflowY: "scroll",
45263
- paddingTop: 230,
45264
- paddingBottom: 20,
45265
- display: "flex",
45266
- flexDirection: "column",
45267
- alignItems: "center"
45268
- },
45269
- children: [
45270
- /* @__PURE__ */ k.jsx("div", { style: { flexGrow: 1, flexShrink: 1, flex: 1 } }),
45271
- /* @__PURE__ */ k.jsx("div", { style: { width: "100%", maxWidth: 1200 }, children: /* @__PURE__ */ k.jsx(
45272
- iW,
45273
- {
45274
- status: r.display,
45275
- messages: D,
45276
- eventsEmit: n,
45277
- renderAiChatBox: a == null ? void 0 : a.AiChatBox,
45278
- renderUserChatBox: a == null ? void 0 : a.UserChatBox
45279
- }
45280
- ) })
45281
- ]
45282
- }
45283
- )
45284
- }
45285
- )
45286
- ]
45249
+ children: /* @__PURE__ */ k.jsx(
45250
+ "div",
45251
+ {
45252
+ style: {
45253
+ width: "100%",
45254
+ minWidth: 520,
45255
+ margin: "0 auto",
45256
+ flex: 1,
45257
+ display: "flex",
45258
+ flexDirection: "column",
45259
+ height: "100%",
45260
+ overflow: "hidden"
45261
+ },
45262
+ children: e.isNew ? a != null && a.WelcomeComponent ? /* @__PURE__ */ k.jsx(a.WelcomeComponent, {}) : /* @__PURE__ */ k.jsx(bW, {}) : r.display === "loading" ? a != null && a.DisplayLoading ? /* @__PURE__ */ k.jsx(a.DisplayLoading, {}) : /* @__PURE__ */ k.jsx(vW, {}) : r.display === "error" ? a != null && a.DisplayError ? /* @__PURE__ */ k.jsx(a.DisplayError, {}) : /* @__PURE__ */ k.jsx(hW, {}) : /* @__PURE__ */ k.jsxs(
45263
+ "div",
45264
+ {
45265
+ ref: f,
45266
+ className: "relative px-8",
45267
+ style: {
45268
+ direction: "rtl",
45269
+ transform: "rotate(180deg)",
45270
+ flex: 1,
45271
+ overflowY: "scroll",
45272
+ paddingTop: 230,
45273
+ paddingBottom: 20,
45274
+ display: "flex",
45275
+ flexDirection: "column",
45276
+ alignItems: "center"
45277
+ },
45278
+ children: [
45279
+ /* @__PURE__ */ k.jsx("div", { style: { flexGrow: 1, flexShrink: 1, flex: 1 } }),
45280
+ /* @__PURE__ */ k.jsx("div", { style: { width: "100%", maxWidth: 1200 }, children: /* @__PURE__ */ k.jsx(
45281
+ iW,
45282
+ {
45283
+ status: r.display,
45284
+ messages: D,
45285
+ eventsEmit: n,
45286
+ renderAiChatBox: a == null ? void 0 : a.AiChatBox,
45287
+ renderUserChatBox: a == null ? void 0 : a.UserChatBox
45288
+ }
45289
+ ) })
45290
+ ]
45291
+ }
45292
+ )
45293
+ }
45294
+ )
45287
45295
  }
45288
45296
  ),
45289
45297
  /* @__PURE__ */ k.jsx(
@@ -59563,18 +59571,22 @@ function KQ(e = F2) {
59563
59571
  }, [f]);
59564
59572
  function be(ce, se) {
59565
59573
  const ye = /* @__PURE__ */ new Map();
59566
- return ce.forEach((xe) => ye.set(xe.uid, we(xe))), se.forEach((xe) => ye.set(xe.uid, we(xe))), Array.from(ye.values());
59574
+ return ce.forEach((xe) => ye.set(xe.uid, we(xe))), se.forEach((xe) => ye.set(xe.uid, we(xe))), console.log(Array.from(ye.values()), "``````````````````9929312830918309812903819023890128390"), Array.from(ye.values());
59567
59575
  }
59568
59576
  function we(ce) {
59569
- return !ce || ce.file && ce.file.name ? ce : {
59577
+ if (!ce || ce.file && ce.file.name) return ce;
59578
+ const se = ce.name || ce.fileName || "";
59579
+ return {
59570
59580
  ...ce,
59571
59581
  url: ce.filePath || "",
59572
59582
  uid: ce.uid || "",
59573
59583
  file: {
59574
- name: ce.name || "",
59584
+ name: se,
59575
59585
  size: typeof ce.size == "string" && ce.size.endsWith("MB") ? Number(ce.size.replace("MB", "")) * 1024 * 1024 : ce.size || 0,
59576
59586
  type: ce.type || ""
59577
- }
59587
+ },
59588
+ name: se
59589
+ // 兜底 name 字段,供 UI 使用
59578
59590
  };
59579
59591
  }
59580
59592
  Ct(() => {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "style": "assets/style.css",
6
6
  "types": "index.d.ts",
7
7
  "private": false,
8
- "version": "1.3.1",
8
+ "version": "1.3.3",
9
9
  "author": "hanfeng_Zhang",
10
10
  "type": "module",
11
11
  "scripts": {