@elia-assistant/chatui 1.0.6 → 1.0.8

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.js CHANGED
@@ -532,46 +532,47 @@ function Le(e, t, n) {
532
532
  //#endregion
533
533
  //#region src/hooks/useAgentStream.ts
534
534
  function Re() {
535
- let e = o((e) => e.config), t = s((e) => e.activeSessionId), n = s((e) => e.addMessage);
535
+ let e = o((e) => e.config), t = s((e) => e.activeSessionId), n = s((e) => e.addMessage), r = s((e) => e.setAwaitingAgentReply);
536
536
  g(() => {
537
- let r = e.agentStream;
538
- if (!r || !r.apiBaseUrl || !r.tenantId || !t) return;
539
- let i = !1, a = null;
537
+ let i = e.agentStream;
538
+ if (!i || !i.apiBaseUrl || !i.tenantId || !t) return;
539
+ let a = !1, o = null;
540
540
  return (async () => {
541
541
  try {
542
- let e = await fetch(`${r.apiBaseUrl.replace(/\/$/, "")}/api/public/chat-stream/init`, {
542
+ let e = await fetch(`${i.apiBaseUrl.replace(/\/$/, "")}/api/public/chat-stream/init`, {
543
543
  method: "POST",
544
544
  headers: { "Content-Type": "application/json" },
545
545
  body: JSON.stringify({
546
- tenantId: r.tenantId,
546
+ tenantId: i.tenantId,
547
547
  sessionId: t
548
548
  })
549
549
  });
550
550
  if (!e.ok) return;
551
- let o = await e.json();
552
- if (i) return;
553
- a = new EventSource(o.streamUrl), a.addEventListener("agentReply", (e) => {
554
- let r;
551
+ let s = await e.json();
552
+ if (a) return;
553
+ o = new EventSource(s.streamUrl), o.addEventListener("agentReply", (e) => {
554
+ let i;
555
555
  try {
556
- r = JSON.parse(e.data);
556
+ i = JSON.parse(e.data);
557
557
  } catch {
558
558
  return;
559
559
  }
560
560
  n(t, {
561
- id: r.id,
561
+ id: i.id,
562
562
  role: "bot",
563
- content: r.body,
564
- ts: Date.parse(r.createdAt) || Date.now()
565
- });
566
- }), a.onerror = () => {};
563
+ content: i.body,
564
+ ts: Date.parse(i.createdAt) || Date.now()
565
+ }), r(t, !1);
566
+ }), o.onerror = () => {};
567
567
  } catch {}
568
568
  })(), () => {
569
- i = !0, a?.close();
569
+ a = !0, o?.close();
570
570
  };
571
571
  }, [
572
572
  e.agentStream,
573
573
  t,
574
- n
574
+ n,
575
+ r
575
576
  ]);
576
577
  }
577
578
  //#endregion
@@ -707,8 +708,14 @@ async function Ve(e, t, n, r, i) {
707
708
  });
708
709
  if (!d.ok) throw new Be(`Webhook returned ${d.status}`, d.status);
709
710
  if (u && d.body) return He(d.body, i);
710
- let f = await d.json();
711
- return f.output ?? f.text ?? "";
711
+ let f = await d.text();
712
+ if (!f) return "";
713
+ try {
714
+ let e = JSON.parse(f);
715
+ return e.output ?? e.text ?? "";
716
+ } catch {
717
+ return "";
718
+ }
712
719
  }
713
720
  async function He(e, t) {
714
721
  let n = e.getReader(), r = new TextDecoder(), i = "", a = "";
@@ -735,41 +742,49 @@ function Ue() {
735
742
  return Math.random().toString(36).slice(2) + Date.now().toString(36);
736
743
  }
737
744
  function We() {
738
- let { activeSessionId: e, addMessage: t, appendToLastBot: n, setStreaming: r, createSession: i } = s(), a = o((e) => e.config), c = o((e) => e.language), l = s((e) => e.isStreaming);
745
+ let { activeSessionId: e, addMessage: t, appendToLastBot: n, removeLastBotIfEmpty: r, setStreaming: i, setAwaitingAgentReply: a, createSession: c } = s(), l = o((e) => e.config), u = o((e) => e.language), d = s((e) => e.isStreaming);
739
746
  return {
740
747
  send: m(async (o) => {
741
- if (!a.webhookUrl || !o.trim()) return;
742
- let s = e ?? i();
743
- t(s, {
748
+ if (!l.webhookUrl || !o.trim()) return;
749
+ let d = e ?? c();
750
+ t(d, {
744
751
  id: Ue(),
745
752
  role: "user",
746
753
  content: o.trim(),
747
754
  ts: Date.now()
748
- }), r(!0), t(s, {
755
+ }), i(!0), t(d, {
749
756
  id: Ue(),
750
757
  role: "bot",
751
758
  content: "",
752
759
  ts: Date.now()
753
760
  });
754
761
  try {
755
- a.streaming ? await Ve(a, s, o.trim(), c, (e) => {
756
- n(s, e);
757
- }) : n(s, await Ve(a, s, o.trim(), c));
762
+ if (l.streaming) await Ve(l, d, o.trim(), u, (e) => {
763
+ n(d, e);
764
+ });
765
+ else {
766
+ let e = await Ve(l, d, o.trim(), u);
767
+ e && n(d, e);
768
+ }
769
+ let e = s.getState().messages[d]?.slice(-1)[0];
770
+ e?.role === "bot" && e.content === "" && (r(d), a(d, !0));
758
771
  } catch (e) {
759
- n(s, e instanceof Be ? `Error ${e.status ?? ""}: ${e.message}` : "Something went wrong. Please try again.");
772
+ n(d, e instanceof Be ? `Error ${e.status ?? ""}: ${e.message}` : "Something went wrong. Please try again.");
760
773
  } finally {
761
- r(!1);
774
+ i(!1);
762
775
  }
763
776
  }, [
764
777
  e,
765
- a,
766
- c,
778
+ l,
779
+ u,
767
780
  t,
768
781
  n,
769
782
  r,
770
- i
783
+ i,
784
+ a,
785
+ c
771
786
  ]),
772
- isStreaming: l
787
+ isStreaming: d
773
788
  };
774
789
  }
775
790
  //#endregion
@@ -8346,7 +8361,9 @@ var yu = {
8346
8361
  omar: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2096%2096'%20width='96'%20height='96'%3e%3cdefs%3e%3cclipPath%20id='c'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23c)'%3e%3crect%20width='96'%20height='96'%20fill='%23D9D6EB'/%3e%3ccircle%20cx='68'%20cy='24'%20r='42'%20fill='%23fff'%20opacity='0.08'/%3e%3ccircle%20cx='24'%20cy='82'%20r='36'%20fill='%23000'%20opacity='0.045'/%3e%3c/g%3e%3cg%20clip-path='url(%23c)'%3e%3cpath%20d='M38%2072%20Q38%2080%2048%2080%20Q58%2080%2058%2072%20L58%2068%20L38%2068%20Z'%20fill='%238B5836'/%3e%3cpath%20d='M8%2096%20C%208%2076,%2024%2068,%2034%2068%20L%2062%2068%20C%2072%2068,%2088%2076,%2088%2096%20Z'%20fill='%2326324A'/%3e%3cpath%20d='M40%2068%20L48%2074%20L56%2068%20Z'%20fill='rgba(0,0,0,0.12)'/%3e%3cpath%20d='M48%2017%20C%2032%2017,%2025%2029,%2025%2044%20C%2025%2059,%2033%2073,%2048%2073%20C%2063%2073,%2071%2059,%2071%2044%20C%2071%2029,%2064%2017,%2048%2017%20Z'%20fill='%23A8714E'/%3e%3cpath%20d='M48%2017%20C%2063%2017,%2071%2029,%2071%2044%20C%2071%2059,%2063%2073,%2048%2073%20Z'%20fill='%238B5836'%20opacity='0.55'/%3e%3cellipse%20cx='26'%20cy='46'%20rx='3'%20ry='5'%20fill='%238B5836'/%3e%3cellipse%20cx='70'%20cy='46'%20rx='3'%20ry='5'%20fill='%238B5836'/%3e%3cpath%20d='M26%2040%20C%2026%2024,%2036%2016,%2048%2016%20C%2060%2016,%2070%2024,%2070%2040%20C%2066%2034,%2062%2034,%2058%2036%20C%2054%2032,%2050%2034,%2048%2036%20C%2046%2032,%2042%2034,%2038%2036%20C%2034%2034,%2030%2034,%2026%2040%20Z'%20fill='%231F1A17'/%3e%3cpath%20d='M28%2032%20C%2036%2028,%2044%2030,%2048%2034%20C%2052%2030,%2060%2028,%2068%2032%20C%2062%2022,%2054%2018,%2048%2018%20C%2042%2018,%2034%2022,%2028%2032%20Z'%20fill='%23100C0A'%20opacity='0.5'/%3e%3cpath%20d='M36%2041%20q4%20-2%208%200'%20stroke='%23100C0A'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M52%2041%20q4%20-2%208%200'%20stroke='%23100C0A'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M37%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3cpath%20d='M53%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3ccircle%20cx='41.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3ccircle%20cx='57.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3cpath%20d='M46.5%2051%20q1.5%201.5%203%200'%20stroke='%238B5836'%20stroke-width='1.2'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cellipse%20cx='34'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cellipse%20cx='62'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cpath%20d='M43%2057%20q5%203%2010%200'%20stroke='%23B56A5A'%20stroke-width='1.7'%20stroke-linecap='round'%20fill='none'/%3e%3c/g%3e%3c/svg%3e",
8347
8362
  priya: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2096%2096'%20width='96'%20height='96'%3e%3cdefs%3e%3cclipPath%20id='c'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23c)'%3e%3crect%20width='96'%20height='96'%20fill='%23D6E7D6'/%3e%3ccircle%20cx='68'%20cy='24'%20r='42'%20fill='%23fff'%20opacity='0.08'/%3e%3ccircle%20cx='24'%20cy='82'%20r='36'%20fill='%23000'%20opacity='0.045'/%3e%3c/g%3e%3cg%20clip-path='url(%23c)'%3e%3cpath%20d='M38%2072%20Q38%2080%2048%2080%20Q58%2080%2058%2072%20L58%2068%20L38%2068%20Z'%20fill='%23AE7853'/%3e%3cpath%20d='M8%2096%20C%208%2076,%2024%2068,%2034%2068%20L%2062%2068%20C%2072%2068,%2088%2076,%2088%2096%20Z'%20fill='%235C3A55'/%3e%3cpath%20d='M40%2068%20L48%2074%20L56%2068%20Z'%20fill='rgba(0,0,0,0.12)'/%3e%3cpath%20d='M22%2040%20C%2022%2022,%2034%2012,%2048%2012%20C%2062%2012,%2074%2022,%2074%2040%20L%2074%2082%20C%2070%2076,%2066%2072,%2062%2072%20L%2034%2072%20C%2030%2072,%2026%2076,%2022%2082%20Z'%20fill='%233B2A1E'/%3e%3cpath%20d='M22%2040%20Q%2020%2060%2022%2082%20L%2030%2078%20Q%2026%2060%2026%2042%20Z'%20fill='%23271B12'%20opacity='0.55'/%3e%3cpath%20d='M74%2040%20Q%2076%2060%2074%2082%20L%2066%2078%20Q%2070%2060%2070%2042%20Z'%20fill='%23271B12'%20opacity='0.55'/%3e%3cpath%20d='M48%2017%20C%2032%2017,%2025%2029,%2025%2044%20C%2025%2059,%2033%2073,%2048%2073%20C%2063%2073,%2071%2059,%2071%2044%20C%2071%2029,%2064%2017,%2048%2017%20Z'%20fill='%23C89270'/%3e%3cpath%20d='M48%2017%20C%2063%2017,%2071%2029,%2071%2044%20C%2071%2059,%2063%2073,%2048%2073%20Z'%20fill='%23AE7853'%20opacity='0.55'/%3e%3cellipse%20cx='26'%20cy='46'%20rx='3'%20ry='5'%20fill='%23AE7853'/%3e%3cellipse%20cx='70'%20cy='46'%20rx='3'%20ry='5'%20fill='%23AE7853'/%3e%3cpath%20d='M26%2038%20C%2030%2022,%2040%2016,%2048%2016%20C%2058%2016,%2068%2022,%2072%2040%20C%2066%2030,%2054%2028,%2044%2030%20C%2038%2031,%2032%2034,%2026%2038%20Z'%20fill='%233B2A1E'/%3e%3cpath%20d='M36%2041%20q4%20-2%208%200'%20stroke='%23271B12'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M52%2041%20q4%20-2%208%200'%20stroke='%23271B12'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M37%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3cpath%20d='M53%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3ccircle%20cx='41.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3ccircle%20cx='57.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3cpath%20d='M46.5%2051%20q1.5%201.5%203%200'%20stroke='%23AE7853'%20stroke-width='1.2'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cellipse%20cx='34'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cellipse%20cx='62'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cpath%20d='M43%2057%20q5%204%2010%200%20q-5%201%20-10%200%20Z'%20fill='%23B56A5A'%20opacity='0.85'/%3e%3c/g%3e%3c/svg%3e",
8348
8363
  samuel: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2096%2096'%20width='96'%20height='96'%3e%3cdefs%3e%3cclipPath%20id='c'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23c)'%3e%3crect%20width='96'%20height='96'%20fill='%23DCE4D1'/%3e%3ccircle%20cx='68'%20cy='24'%20r='42'%20fill='%23fff'%20opacity='0.08'/%3e%3ccircle%20cx='24'%20cy='82'%20r='36'%20fill='%23000'%20opacity='0.045'/%3e%3c/g%3e%3cg%20clip-path='url(%23c)'%3e%3cpath%20d='M38%2072%20Q38%2080%2048%2080%20Q58%2080%2058%2072%20L58%2068%20L38%2068%20Z'%20fill='%233D2413'/%3e%3cpath%20d='M8%2096%20C%208%2076,%2024%2068,%2034%2068%20L%2062%2068%20C%2072%2068,%2088%2076,%2088%2096%20Z'%20fill='%238A6A2C'/%3e%3cpath%20d='M40%2068%20L48%2074%20L56%2068%20Z'%20fill='rgba(0,0,0,0.12)'/%3e%3cpath%20d='M48%2017%20C%2032%2017,%2025%2029,%2025%2044%20C%2025%2059,%2033%2073,%2048%2073%20C%2063%2073,%2071%2059,%2071%2044%20C%2071%2029,%2064%2017,%2048%2017%20Z'%20fill='%2355341E'/%3e%3cpath%20d='M48%2017%20C%2063%2017,%2071%2029,%2071%2044%20C%2071%2059,%2063%2073,%2048%2073%20Z'%20fill='%233D2413'%20opacity='0.55'/%3e%3cellipse%20cx='26'%20cy='46'%20rx='3'%20ry='5'%20fill='%233D2413'/%3e%3cellipse%20cx='70'%20cy='46'%20rx='3'%20ry='5'%20fill='%233D2413'/%3e%3cpath%20d='M28%2040%20C%2028%2024,%2036%2016,%2048%2016%20C%2060%2016,%2068%2024,%2068%2040%20C%2066%2034,%2058%2030,%2048%2030%20C%2038%2030,%2030%2034,%2028%2040%20Z'%20fill='%236A6259'/%3e%3cpath%20d='M30%2028%20C%2040%2034,%2056%2034,%2066%2028%20C%2062%2022,%2055%2020,%2048%2020%20C%2041%2020,%2034%2022,%2030%2028%20Z'%20fill='%234F4841'%20opacity='0.45'/%3e%3cpath%20d='M36%2041%20q4%20-2%208%200'%20stroke='%234F4841'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M52%2041%20q4%20-2%208%200'%20stroke='%234F4841'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M37%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3cpath%20d='M53%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3ccircle%20cx='41.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3ccircle%20cx='57.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3cpath%20d='M46.5%2051%20q1.5%201.5%203%200'%20stroke='%233D2413'%20stroke-width='1.2'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cellipse%20cx='34'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cellipse%20cx='62'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cpath%20d='M44%2058%20q4%202%208%200'%20stroke='%23B56A5A'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M34%2050%20q1%201%202%200'%20stroke='%233D2413'%20stroke-width='0.8'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cpath%20d='M60%2050%20q1%201%202%200'%20stroke='%233D2413'%20stroke-width='0.8'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cpath%20d='M41%2062%20q3%201%206%200'%20stroke='%233D2413'%20stroke-width='0.8'%20stroke-linecap='round'%20fill='none'%20opacity='0.5'/%3e%3c/g%3e%3c/svg%3e",
8349
- sofia: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2096%2096'%20width='96'%20height='96'%3e%3cdefs%3e%3cclipPath%20id='c'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23c)'%3e%3crect%20width='96'%20height='96'%20fill='%23D4E3EC'/%3e%3ccircle%20cx='68'%20cy='24'%20r='42'%20fill='%23fff'%20opacity='0.08'/%3e%3ccircle%20cx='24'%20cy='82'%20r='36'%20fill='%23000'%20opacity='0.045'/%3e%3c/g%3e%3cg%20clip-path='url(%23c)'%3e%3cpath%20d='M38%2072%20Q38%2080%2048%2080%20Q58%2080%2058%2072%20L58%2068%20L38%2068%20Z'%20fill='%23C6976C'/%3e%3cpath%20d='M8%2096%20C%208%2076,%2024%2068,%2034%2068%20L%2062%2068%20C%2072%2068,%2088%2076,%2088%2096%20Z'%20fill='%237E3E2A'/%3e%3cpath%20d='M40%2068%20L48%2074%20L56%2068%20Z'%20fill='rgba(0,0,0,0.12)'/%3e%3cpath%20d='M24%2038%20C%2024%2022,%2034%2012,%2048%2012%20C%2062%2012,%2072%2022,%2072%2038%20L%2072%2062%20C%2068%2058,%2064%2058,%2060%2060%20L%2036%2060%20C%2032%2058,%2028%2058,%2024%2062%20Z'%20fill='%2355392A'/%3e%3cpath%20d='M48%2017%20C%2032%2017,%2025%2029,%2025%2044%20C%2025%2059,%2033%2073,%2048%2073%20C%2063%2073,%2071%2059,%2071%2044%20C%2071%2029,%2064%2017,%2048%2017%20Z'%20fill='%23DDAE85'/%3e%3cpath%20d='M48%2017%20C%2063%2017,%2071%2029,%2071%2044%20C%2071%2059,%2063%2073,%2048%2073%20Z'%20fill='%23C6976C'%20opacity='0.55'/%3e%3cellipse%20cx='26'%20cy='46'%20rx='3'%20ry='5'%20fill='%23C6976C'/%3e%3cellipse%20cx='70'%20cy='46'%20rx='3'%20ry='5'%20fill='%23C6976C'/%3e%3cpath%20d='M26%2038%20C%2030%2024,%2040%2018,%2048%2018%20C%2058%2018,%2066%2024,%2070%2038%20C%2064%2032,%2054%2030,%2048%2030%20C%2040%2030,%2032%2032,%2026%2038%20Z'%20fill='%2355392A'/%3e%3cpath%20d='M30%2024%20C%2038%2032,%2058%2032,%2066%2024%20C%2060%2018,%2054%2016,%2048%2016%20C%2040%2016,%2034%2018,%2030%2024%20Z'%20fill='%233D2718'%20opacity='0.4'/%3e%3cpath%20d='M36%2041%20q4%20-2%208%200'%20stroke='%233D2718'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M52%2041%20q4%20-2%208%200'%20stroke='%233D2718'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M37%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3cpath%20d='M53%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3ccircle%20cx='41.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3ccircle%20cx='57.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3cpath%20d='M46.5%2051%20q1.5%201.5%203%200'%20stroke='%23C6976C'%20stroke-width='1.2'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cellipse%20cx='34'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cellipse%20cx='62'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cpath%20d='M43%2057%20q5%204%2010%200%20q-5%201%20-10%200%20Z'%20fill='%23B56A5A'%20opacity='0.85'/%3e%3c/g%3e%3c/svg%3e"
8364
+ sofia: "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2096%2096'%20width='96'%20height='96'%3e%3cdefs%3e%3cclipPath%20id='c'%3e%3ccircle%20cx='48'%20cy='48'%20r='48'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23c)'%3e%3crect%20width='96'%20height='96'%20fill='%23D4E3EC'/%3e%3ccircle%20cx='68'%20cy='24'%20r='42'%20fill='%23fff'%20opacity='0.08'/%3e%3ccircle%20cx='24'%20cy='82'%20r='36'%20fill='%23000'%20opacity='0.045'/%3e%3c/g%3e%3cg%20clip-path='url(%23c)'%3e%3cpath%20d='M38%2072%20Q38%2080%2048%2080%20Q58%2080%2058%2072%20L58%2068%20L38%2068%20Z'%20fill='%23C6976C'/%3e%3cpath%20d='M8%2096%20C%208%2076,%2024%2068,%2034%2068%20L%2062%2068%20C%2072%2068,%2088%2076,%2088%2096%20Z'%20fill='%237E3E2A'/%3e%3cpath%20d='M40%2068%20L48%2074%20L56%2068%20Z'%20fill='rgba(0,0,0,0.12)'/%3e%3cpath%20d='M24%2038%20C%2024%2022,%2034%2012,%2048%2012%20C%2062%2012,%2072%2022,%2072%2038%20L%2072%2062%20C%2068%2058,%2064%2058,%2060%2060%20L%2036%2060%20C%2032%2058,%2028%2058,%2024%2062%20Z'%20fill='%2355392A'/%3e%3cpath%20d='M48%2017%20C%2032%2017,%2025%2029,%2025%2044%20C%2025%2059,%2033%2073,%2048%2073%20C%2063%2073,%2071%2059,%2071%2044%20C%2071%2029,%2064%2017,%2048%2017%20Z'%20fill='%23DDAE85'/%3e%3cpath%20d='M48%2017%20C%2063%2017,%2071%2029,%2071%2044%20C%2071%2059,%2063%2073,%2048%2073%20Z'%20fill='%23C6976C'%20opacity='0.55'/%3e%3cellipse%20cx='26'%20cy='46'%20rx='3'%20ry='5'%20fill='%23C6976C'/%3e%3cellipse%20cx='70'%20cy='46'%20rx='3'%20ry='5'%20fill='%23C6976C'/%3e%3cpath%20d='M26%2038%20C%2030%2024,%2040%2018,%2048%2018%20C%2058%2018,%2066%2024,%2070%2038%20C%2064%2032,%2054%2030,%2048%2030%20C%2040%2030,%2032%2032,%2026%2038%20Z'%20fill='%2355392A'/%3e%3cpath%20d='M30%2024%20C%2038%2032,%2058%2032,%2066%2024%20C%2060%2018,%2054%2016,%2048%2016%20C%2040%2016,%2034%2018,%2030%2024%20Z'%20fill='%233D2718'%20opacity='0.4'/%3e%3cpath%20d='M36%2041%20q4%20-2%208%200'%20stroke='%233D2718'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M52%2041%20q4%20-2%208%200'%20stroke='%233D2718'%20stroke-width='1.6'%20stroke-linecap='round'%20fill='none'/%3e%3cpath%20d='M37%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3cpath%20d='M53%2046%20q3%20-3%206%200%20q-3%203%20-6%200%20Z'%20fill='%232A1F18'/%3e%3ccircle%20cx='41.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3ccircle%20cx='57.4'%20cy='45.4'%20r='0.6'%20fill='%23fff'/%3e%3cpath%20d='M46.5%2051%20q1.5%201.5%203%200'%20stroke='%23C6976C'%20stroke-width='1.2'%20stroke-linecap='round'%20fill='none'%20opacity='0.8'/%3e%3cellipse%20cx='34'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cellipse%20cx='62'%20cy='54'%20rx='4'%20ry='2.2'%20fill='rgba(210,120,110,0.22)'/%3e%3cpath%20d='M43%2057%20q5%204%2010%200%20q-5%201%20-10%200%20Z'%20fill='%23B56A5A'%20opacity='0.85'/%3e%3c/g%3e%3c/svg%3e",
8365
+ bean: "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2096'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;'%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cpath%20d='M64,30C64,24.667%2066,22%2070,22C74,22%2076,20%2076,16'%20style='fill:none;fill-rule:nonzero;stroke:rgb(58,31,16);stroke-width:3px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='76'%20cy='14'%20r='3.5'%20style='fill:rgb(255,111,177);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cpath%20d='M38,50C38,38%2046.667,32%2064,32C81.333,32%2090,38%2090,50L90,92C90,101.333%2081.333,106%2064,106C46.667,106%2038,101.333%2038,92L38,50Z'%20style='fill:url(%23_Linear1);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='64'%20cy='84'%20rx='20'%20ry='14'%20style='fill:rgb(255,226,194);fill-opacity:0.85;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='54'%20cy='62'%20rx='5.525'%20ry='6.5'%20style='fill:rgb(58,31,16);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='74'%20cy='62'%20rx='5.525'%20ry='6.5'%20style='fill:rgb(58,31,16);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='52.375'%20cy='59.4'%20r='2.275'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='72.375'%20cy='59.4'%20r='2.275'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='56.6'%20cy='63.95'%20r='1.17'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3ccircle%20cx='76.6'%20cy='63.95'%20r='1.17'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cpath%20d='M58,74C62,78%2066,78%2070,74'%20style='fill:none;fill-rule:nonzero;stroke:rgb(58,31,16);stroke-width:3px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='50'%20cy='106'%20rx='6'%20ry='3'%20style='fill:rgb(210,106,45);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,0)'%3e%3cellipse%20cx='78'%20cy='106'%20rx='6'%20ry='3'%20style='fill:rgb(210,106,45);'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='_Linear1'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.53119e-15,74,-74,4.53119e-15,38,32)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(255,197,138);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(240,138,75);stop-opacity:1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",
8366
+ owl: "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'%20standalone='no'?%3e%3c!DOCTYPE%20svg%20PUBLIC%20'-//W3C//DTD%20SVG%201.1//EN'%20'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'%3e%3csvg%20width='100%25'%20height='100%25'%20viewBox='0%200%2096%2096'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;'%3e%3cg%20transform='matrix(2,0,0,2,-116.592,-107.388)'%3e%3cellipse%20cx='86'%20cy='92'%20rx='3'%20ry='1.5'%20style='fill:rgb(122,74,14);'/%3e%3c/g%3e%3cg%20transform='matrix(2,0,0,2,-132.065,-107.388)'%3e%3cellipse%20cx='86'%20cy='92'%20rx='3'%20ry='1.5'%20style='fill:rgb(122,74,14);'/%3e%3c/g%3e%3cg%20transform='matrix(1.02083,0,0,1.02083,-28.4825,-8.00437)'%3e%3cpath%20d='M90,34L96,22L80,30L90,34Z'%20style='fill:url(%23_Linear1);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(-1.02083,0,0,1.02083,124.21,-8.00437)'%3e%3cpath%20d='M90,34L96,22L80,30L90,34Z'%20style='fill:url(%23_Linear2);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cellipse%20cx='64'%20cy='72'%20rx='34'%20ry='38'%20style='fill:url(%23_Linear3);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cellipse%20cx='64'%20cy='86'%20rx='22'%20ry='20'%20style='fill:rgb(248,232,200);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='52'%20cy='58'%20r='11'%20style='fill:white;stroke:rgb(90,58,26);stroke-width:2px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='76'%20cy='58'%20r='11'%20style='fill:white;stroke:rgb(90,58,26);stroke-width:2px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='52'%20cy='58'%20r='5'%20style='fill:rgb(26,15,10);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='76'%20cy='58'%20r='5'%20style='fill:rgb(26,15,10);'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='50'%20cy='56'%20r='2'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3ccircle%20cx='74'%20cy='56'%20r='2'%20style='fill:white;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M60,70L64,78L68,70L60,70Z'%20style='fill:rgb(255,179,106);fill-rule:nonzero;stroke:rgb(122,74,14);stroke-width:1px;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M30,60C24.667,73.333%2025.333,86.667%2032,100L38,90C36.667,80.667%2036.667,72%2038,64L30,60Z'%20style='fill:url(%23_Linear4);fill-rule:nonzero;'/%3e%3c/g%3e%3cg%20transform='matrix(0.75,0,0,0.75,0,-4.92105)'%3e%3cpath%20d='M98,60C103.333,73.333%20102.667,86.667%2096,100L90,90C91.333,80.667%2091.333,72%2090,64L98,60Z'%20style='fill:url(%23_Linear5);fill-rule:nonzero;'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='_Linear1'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(7.34788e-16,12,-12,7.34788e-16,80,22)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear2'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(7.34788e-16,12,-12,7.34788e-16,80,22)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear3'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(4.65366e-15,76,-76,4.65366e-15,30,34)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear4'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(-9.30994,-1.27833,1.27833,-9.30994,35.7544,81.2783)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3clinearGradient%20id='_Linear5'%20x1='0'%20y1='0'%20x2='1'%20y2='0'%20gradientUnits='userSpaceOnUse'%20gradientTransform='matrix(11.5556,3.71929,-3.71929,11.5556,90,74.9474)'%3e%3cstop%20offset='0'%20style='stop-color:rgb(232,200,168);stop-opacity:1'/%3e%3cstop%20offset='1'%20style='stop-color:rgb(168,120,74);stop-opacity:1'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e"
8350
8367
  }, bu = Object.keys(yu);
8351
8368
  function xu(e) {
8352
8369
  if (e) return e in yu ? yu[e] : e;
@@ -8357,7 +8374,7 @@ function Su() {
8357
8374
  let e = xu(o((e) => e.config.botAvatar));
8358
8375
  return e ? /* @__PURE__ */ S("div", {
8359
8376
  className: "w-7 h-7 rounded-full flex-shrink-0 overflow-hidden",
8360
- style: { background: "var(--t-bg-surface2)" },
8377
+ style: { background: "var(--t-bg-base)" },
8361
8378
  children: /* @__PURE__ */ S("img", {
8362
8379
  src: e,
8363
8380
  alt: "",
@@ -8366,7 +8383,7 @@ function Su() {
8366
8383
  }) : /* @__PURE__ */ S("div", {
8367
8384
  className: "w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center text-xs font-bold",
8368
8385
  style: {
8369
- background: "var(--t-bg-surface2)",
8386
+ background: "var(--t-bg-base)",
8370
8387
  color: "var(--t-fg-secondary)"
8371
8388
  },
8372
8389
  children: "A"
@@ -8489,7 +8506,7 @@ function Ou({ onSend: e, disabled: t, placeholder: n, allowFileUploads: r }) {
8489
8506
  className: "flex items-end gap-2 p-3",
8490
8507
  children: [
8491
8508
  r && /* @__PURE__ */ S("button", {
8492
- className: "flex-shrink-0 w-9 h-9 rounded-xl flex items-center justify-center text-fg-secondary hover:text-fg-primary hover:bg-bg-surface transition-colors",
8509
+ className: "flex-shrink-0 w-[42px] h-[42px] rounded-xl flex items-center justify-center text-fg-secondary hover:text-fg-primary hover:bg-bg-surface transition-colors",
8493
8510
  title: "Attach file",
8494
8511
  tabIndex: -1,
8495
8512
  children: /* @__PURE__ */ S("svg", {
@@ -8521,7 +8538,7 @@ function Ou({ onSend: e, disabled: t, placeholder: n, allowFileUploads: r }) {
8521
8538
  /* @__PURE__ */ S("button", {
8522
8539
  onClick: f,
8523
8540
  disabled: t || !i.trim(),
8524
- className: "flex-shrink-0 w-9 h-9 rounded-xl flex items-center justify-center transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
8541
+ className: "flex-shrink-0 w-[42px] h-[42px] rounded-xl flex items-center justify-center transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
8525
8542
  style: {
8526
8543
  background: "var(--t-accent)",
8527
8544
  color: "var(--t-accent-fg)"
@@ -8882,29 +8899,29 @@ function Bu({ text: e, muted: t }) {
8882
8899
  //#endregion
8883
8900
  //#region src/components/ChatView.tsx
8884
8901
  function Vu({ onOpenSettings: e, onClose: t }) {
8885
- let { t: n } = Pe(), r = s((e) => e.activeSessionId), i = s((e) => r ? e.messages[r] ?? [] : []), a = s((e) => e.createSession), c = s((e) => e.isStreaming), l = o((e) => e.config), u = o((e) => e.language), d = l.hideSettings ?? !1, { send: f } = We(), p = v(null), m = l.i18n?.[u] ?? l.i18n?.en ?? {}, h = m.initialMessages ?? l.initialMessages ?? [], _ = m.botName ?? l.botName ?? n("header.assistant"), b = l.tabs, w = b?.notifications, T = b?.help, E = !!(w?.feedUrl || w?.items?.length || T?.feedUrl || T?.items?.length), D = E ? [
8886
- w?.feedUrl || w?.items?.length ? {
8902
+ let { t: n } = Pe(), r = s((e) => e.activeSessionId), i = s((e) => r ? e.messages[r] ?? [] : []), a = s((e) => e.createSession), c = s((e) => e.isStreaming), l = s((e) => r ? !!e.awaitingAgentReply[r] : !1), u = o((e) => e.config), d = o((e) => e.language), f = u.hideSettings ?? !1, { send: p } = We(), m = v(null), h = u.i18n?.[d] ?? u.i18n?.en ?? {}, _ = h.initialMessages ?? u.initialMessages ?? [], b = h.botName ?? u.botName ?? n("header.assistant"), w = u.tabs, T = w?.notifications, E = w?.help, D = !!(T?.feedUrl || T?.items?.length || E?.feedUrl || E?.items?.length), O = D ? [
8903
+ T?.feedUrl || T?.items?.length ? {
8887
8904
  id: "notifications",
8888
- label: m.tabs?.notifications?.title ?? b?.notifications?.title ?? n("tabs.notifications"),
8905
+ label: h.tabs?.notifications?.title ?? w?.notifications?.title ?? n("tabs.notifications"),
8889
8906
  icon: "bulb"
8890
8907
  } : null,
8891
- T?.feedUrl || T?.items?.length ? {
8908
+ E?.feedUrl || E?.items?.length ? {
8892
8909
  id: "help",
8893
- label: m.tabs?.help?.title ?? b?.help?.title ?? n("tabs.help"),
8910
+ label: h.tabs?.help?.title ?? w?.help?.title ?? n("tabs.help"),
8894
8911
  icon: "book"
8895
8912
  } : null,
8896
8913
  {
8897
8914
  id: "chat",
8898
- label: m.tabs?.chat?.title ?? b?.chat?.title ?? n("tabs.chat"),
8915
+ label: h.tabs?.chat?.title ?? w?.chat?.title ?? n("tabs.chat"),
8899
8916
  icon: "chat"
8900
8917
  }
8901
- ].filter((e) => e !== null) : [], [O, k] = y("chat");
8918
+ ].filter((e) => e !== null) : [], [k, A] = y("chat");
8902
8919
  g(() => {
8903
8920
  r || a();
8904
8921
  }, [r, a]), g(() => {
8905
- p.current?.scrollIntoView({ behavior: "smooth" });
8922
+ m.current?.scrollIntoView({ behavior: "smooth" });
8906
8923
  }, [i, c]);
8907
- let A = l.showWelcomeScreen && i.length === 0 && !c, j = m.welcomeSubtitle ?? n("welcome.subtitle"), M = !E || O === "chat";
8924
+ let j = u.showWelcomeScreen && i.length === 0 && !c, M = h.welcomeSubtitle ?? n("welcome.subtitle"), N = !D || k === "chat";
8908
8925
  return /* @__PURE__ */ C("div", {
8909
8926
  className: "flex flex-col h-full min-w-0",
8910
8927
  children: [
@@ -8917,8 +8934,8 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8917
8934
  children: [/* @__PURE__ */ C("div", {
8918
8935
  className: "flex items-center gap-2",
8919
8936
  children: [
8920
- xu(l.botAvatar) ? /* @__PURE__ */ S("img", {
8921
- src: xu(l.botAvatar),
8937
+ xu(u.botAvatar) ? /* @__PURE__ */ S("img", {
8938
+ src: xu(u.botAvatar),
8922
8939
  alt: "",
8923
8940
  className: "w-7 h-7 rounded-full object-cover flex-shrink-0",
8924
8941
  style: { border: "1px solid var(--t-bg-border)" }
@@ -8928,9 +8945,9 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8928
8945
  }),
8929
8946
  /* @__PURE__ */ S("span", {
8930
8947
  className: "text-sm font-semibold text-fg-primary",
8931
- children: _
8948
+ children: b
8932
8949
  }),
8933
- l.webhookUrl ? /* @__PURE__ */ C("span", {
8950
+ u.webhookUrl ? /* @__PURE__ */ C("span", {
8934
8951
  className: "text-xs text-fg-muted",
8935
8952
  children: ["● ", n("header.online")]
8936
8953
  }) : /* @__PURE__ */ S("span", {
@@ -8940,7 +8957,7 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8940
8957
  ]
8941
8958
  }), /* @__PURE__ */ C("div", {
8942
8959
  className: "flex items-center gap-1",
8943
- children: [!d && /* @__PURE__ */ S("button", {
8960
+ children: [!f && /* @__PURE__ */ S("button", {
8944
8961
  onClick: e,
8945
8962
  className: "w-8 h-8 rounded-lg flex items-center justify-center text-fg-secondary hover:text-fg-primary hover:bg-bg-surface transition-colors",
8946
8963
  title: n("sidebar.settings"),
@@ -8953,39 +8970,39 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8953
8970
  })]
8954
8971
  })]
8955
8972
  }),
8956
- E && /* @__PURE__ */ S(ku, {
8957
- tabs: D,
8958
- activeId: O,
8959
- onChange: (e) => k(e)
8973
+ D && /* @__PURE__ */ S(ku, {
8974
+ tabs: O,
8975
+ activeId: k,
8976
+ onChange: (e) => A(e)
8960
8977
  }),
8961
- E && O === "notifications" && /* @__PURE__ */ S(Mu, {
8962
- feedUrl: w?.feedUrl,
8963
- inlineItems: w?.items
8964
- }),
8965
- E && O === "help" && /* @__PURE__ */ S(Lu, {
8978
+ D && k === "notifications" && /* @__PURE__ */ S(Mu, {
8966
8979
  feedUrl: T?.feedUrl,
8967
8980
  inlineItems: T?.items
8968
8981
  }),
8969
- M && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C("div", {
8982
+ D && k === "help" && /* @__PURE__ */ S(Lu, {
8983
+ feedUrl: E?.feedUrl,
8984
+ inlineItems: E?.items
8985
+ }),
8986
+ N && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C("div", {
8970
8987
  className: "flex-1 overflow-y-auto px-4 py-4",
8971
- children: [A ? /* @__PURE__ */ S(Hu, {
8972
- botName: _,
8973
- subtitle: j
8988
+ children: [j ? /* @__PURE__ */ S(Hu, {
8989
+ botName: b,
8990
+ subtitle: M
8974
8991
  }) : /* @__PURE__ */ C(x, { children: [
8975
- i.length === 0 && h.map((e, t) => /* @__PURE__ */ S(wu, { message: {
8992
+ i.length === 0 && _.map((e, t) => /* @__PURE__ */ S(wu, { message: {
8976
8993
  id: String(t),
8977
8994
  role: "bot",
8978
8995
  content: e,
8979
8996
  ts: Date.now()
8980
8997
  } }, t)),
8981
8998
  i.map((e, t) => c && t === i.length - 1 && e.role === "bot" && e.content === "" ? null : /* @__PURE__ */ S(wu, { message: e }, e.id)),
8982
- c && i[i.length - 1]?.role === "bot" && i[i.length - 1]?.content === "" && /* @__PURE__ */ S(Tu, {})
8983
- ] }), /* @__PURE__ */ S("div", { ref: p })]
8999
+ (c && i[i.length - 1]?.role === "bot" && i[i.length - 1]?.content === "" || l) && /* @__PURE__ */ S(Tu, {})
9000
+ ] }), /* @__PURE__ */ S("div", { ref: m })]
8984
9001
  }), /* @__PURE__ */ S(Ou, {
8985
- onSend: f,
8986
- disabled: c || !l.webhookUrl,
8987
- placeholder: l.webhookUrl ? n("input.placeholder") : n("input.placeholderUnconfigured"),
8988
- allowFileUploads: l.allowFileUploads
9002
+ onSend: p,
9003
+ disabled: c || !u.webhookUrl,
9004
+ placeholder: u.webhookUrl ? n("input.placeholder") : n("input.placeholderUnconfigured"),
9005
+ allowFileUploads: u.allowFileUploads
8989
9006
  })] })
8990
9007
  ]
8991
9008
  });
@@ -4,11 +4,14 @@ interface ChatState {
4
4
  activeSessionId: string | null;
5
5
  messages: Record<string, Message[]>;
6
6
  isStreaming: boolean;
7
+ awaitingAgentReply: Record<string, boolean>;
7
8
  createSession(): string;
8
9
  setActiveSession(id: string): void;
9
10
  addMessage(sessionId: string, msg: Message): void;
10
11
  appendToLastBot(sessionId: string, chunk: string): void;
12
+ removeLastBotIfEmpty(sessionId: string): void;
11
13
  setStreaming(val: boolean): void;
14
+ setAwaitingAgentReply(sessionId: string, val: boolean): void;
12
15
  deleteSession(id: string): void;
13
16
  renameSession(id: string, title: string): void;
14
17
  clearMessages(sessionId: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elia-assistant/chatui",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "build": "tsc -b --noEmit && vite build && vite build --config vite.iife.config.ts && tsc -p tsconfig.build.json",
45
45
  "preview": "vite preview",
46
46
  "pack:dry": "npm pack --dry-run",
47
- "prepublishOnly": "npm run build"
47
+ "prepack": "npm run build"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "react": "^19.0.0",
@@ -72,4 +72,4 @@
72
72
  "vite": "^8.0.0",
73
73
  "vite-plugin-dts": "^4.5.4"
74
74
  }
75
- }
75
+ }