chatbot-interface-ifi 1.2.2 → 1.2.4

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.
@@ -6555,16 +6555,24 @@ const bf = async (e) => {
6555
6555
  } catch (n) {
6556
6556
  throw console.error("Error ending conversation:", n), n;
6557
6557
  }
6558
- }, xf = async (e) => {
6558
+ }, xf = async (e, t) => {
6559
+ const r = new FormData();
6560
+ r.append("chatbot_id", e), r.append("conversation_id", t);
6559
6561
  try {
6560
- const t = await ae.get(
6561
- `https://rag-flask-api.onrender.com/summary/${e}`
6562
+ const n = await ae.post(
6563
+ "https://rag-flask-api.onrender.com/summary",
6564
+ r,
6565
+ {
6566
+ headers: {
6567
+ "Content-Type": "multipart/form-data"
6568
+ }
6569
+ }
6562
6570
  );
6563
- if (t.status === 200 && t.data.summary)
6564
- return t.data.summary;
6565
- throw new Error("Summary not found for this chatbot.");
6566
- } catch (t) {
6567
- throw console.error("Error fetching summary:", t), t;
6571
+ if (n.status === 200 && n.data.summary)
6572
+ return n.data.summary;
6573
+ throw new Error("Summary not found for this conversation.");
6574
+ } catch (n) {
6575
+ throw console.error("Error fetching summary:", n), n;
6568
6576
  }
6569
6577
  }, Ef = async (e, t, r, n = []) => {
6570
6578
  try {
@@ -6588,25 +6596,29 @@ const bf = async (e) => {
6588
6596
  } catch (o) {
6589
6597
  throw console.error("Error generating guided questions:", o), o;
6590
6598
  }
6591
- }, Sf = ({ chatbotId: e, open: t, onClose: r }) => {
6592
- const [n, o] = ge(null), [s, i] = ge(!1), [c, h] = ge(null), u = async () => {
6593
- i(!0), h(null);
6599
+ }, Sf = ({ chatbotId: e, conversationId: t, open: r, onClose: n }) => {
6600
+ const [o, s] = ge(null), [i, c] = ge(!1), [h, u] = ge(null), l = async () => {
6601
+ if (!t) {
6602
+ u("No active conversation to summarize.");
6603
+ return;
6604
+ }
6605
+ c(!0), u(null);
6594
6606
  try {
6595
- const l = await xf(e);
6596
- o(l);
6597
- } catch (l) {
6598
- h(l.message || "Failed to fetch summary. Please try again.");
6607
+ const p = await xf(e, t);
6608
+ s(p);
6609
+ } catch (p) {
6610
+ u(p.message || "Failed to fetch summary. Please try again.");
6599
6611
  } finally {
6600
- i(!1);
6612
+ c(!1);
6601
6613
  }
6602
6614
  };
6603
6615
  return Vt(() => {
6604
- t && u();
6605
- }, [t]), /* @__PURE__ */ x.jsx(
6616
+ r && l();
6617
+ }, [r]), /* @__PURE__ */ x.jsx(
6606
6618
  As,
6607
6619
  {
6608
- open: t,
6609
- onClose: r,
6620
+ open: r,
6621
+ onClose: n,
6610
6622
  "aria-labelledby": "summary-modal-title",
6611
6623
  "aria-describedby": "summary-modal-description",
6612
6624
  children: /* @__PURE__ */ x.jsxs(
@@ -6627,9 +6639,9 @@ const bf = async (e) => {
6627
6639
  children: [
6628
6640
  /* @__PURE__ */ x.jsxs(U, { sx: { display: "flex", justifyContent: "space-between", mb: 2 }, children: [
6629
6641
  /* @__PURE__ */ x.jsx(be, { id: "summary-modal-title", variant: "h6", component: "h2", children: "Document Summary" }),
6630
- /* @__PURE__ */ x.jsx(Rt, { onClick: r, children: /* @__PURE__ */ x.jsx(Bu, {}) })
6642
+ /* @__PURE__ */ x.jsx(Rt, { onClick: n, children: /* @__PURE__ */ x.jsx(Bu, {}) })
6631
6643
  ] }),
6632
- s ? /* @__PURE__ */ x.jsx(U, { sx: { display: "flex", justifyContent: "center", my: 4 }, children: /* @__PURE__ */ x.jsx(Ps, {}) }) : c ? /* @__PURE__ */ x.jsx(be, { color: "error", children: c }) : /* @__PURE__ */ x.jsx(
6644
+ i ? /* @__PURE__ */ x.jsx(U, { sx: { display: "flex", justifyContent: "center", my: 4 }, children: /* @__PURE__ */ x.jsx(Ps, {}) }) : h ? /* @__PURE__ */ x.jsx(be, { color: "error", children: h }) : /* @__PURE__ */ x.jsx(
6633
6645
  U,
6634
6646
  {
6635
6647
  sx: {
@@ -6640,7 +6652,7 @@ const bf = async (e) => {
6640
6652
  borderRadius: 2,
6641
6653
  backgroundColor: "#f9f9f9"
6642
6654
  },
6643
- children: /* @__PURE__ */ x.jsx(To, { children: n })
6655
+ children: /* @__PURE__ */ x.jsx(To, { children: o })
6644
6656
  }
6645
6657
  ),
6646
6658
  /* @__PURE__ */ x.jsx(
@@ -6648,7 +6660,7 @@ const bf = async (e) => {
6648
6660
  {
6649
6661
  variant: "contained",
6650
6662
  sx: { mt: 2 },
6651
- onClick: r,
6663
+ onClick: n,
6652
6664
  fullWidth: !0,
6653
6665
  children: "Close"
6654
6666
  }
@@ -7284,6 +7296,7 @@ const _o = /* @__PURE__ */ we(Tf), Of = ({ questions: e, loading: t, onQuestionC
7284
7296
  Sf,
7285
7297
  {
7286
7298
  chatbotId: e,
7299
+ conversationId: p,
7287
7300
  open: _,
7288
7301
  onClose: () => k(!1)
7289
7302
  }