@elia-assistant/chatui 1.0.6 → 1.0.9

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.
@@ -112,18 +112,18 @@ var n = [
112
112
  {
113
113
  id: "cherry",
114
114
  label: "Cherry",
115
- scheme: "dark",
115
+ scheme: "light",
116
116
  vars: {
117
- bgBase: "#120608",
118
- bgSurface: "#1e0c10",
119
- bgSurface2: "#2a1016",
120
- bgBorder: "#3d1520",
121
- accent: "#ef4444",
117
+ bgBase: "#ffffff",
118
+ bgSurface: "#fff1f2",
119
+ bgSurface2: "#ffe4e6",
120
+ bgBorder: "#fecdd3",
121
+ accent: "#e11d48",
122
122
  accentFg: "#ffffff",
123
- fgPrimary: "#ffe4e6",
124
- fgSecondary: "#fca5a5",
125
- fgMuted: "#f87171",
126
- userBubble: "#dc2626",
123
+ fgPrimary: "#1a0005",
124
+ fgSecondary: "#4c0519",
125
+ fgMuted: "#9f1239",
126
+ userBubble: "#e11d48",
127
127
  userBubbleFg: "#ffffff"
128
128
  }
129
129
  },
@@ -251,4 +251,4 @@ var a = {
251
251
  //#endregion
252
252
  export { i as n, n as r, o as t };
253
253
 
254
- //# sourceMappingURL=settingsStore-uYZsUiVr.js.map
254
+ //# sourceMappingURL=settingsStore-Br8PCCHq.js.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as e, i as t, n, r } from "./chunks/i18n-Bk--20yp.js";
2
- import { n as i, r as a, t as o } from "./chunks/settingsStore-uYZsUiVr.js";
2
+ import { n as i, r as a, t as o } from "./chunks/settingsStore-Br8PCCHq.js";
3
3
  import { useChatStore as s } from "./chat-store.js";
4
4
  import { Children as c, Fragment as l, cloneElement as u, createContext as d, createElement as f, isValidElement as p, useCallback as m, useContext as h, useEffect as g, useMemo as _, useRef as v, useState as y, useSyncExternalStore as b } from "react";
5
5
  import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
@@ -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"
@@ -8383,12 +8400,26 @@ function wu({ message: e }) {
8383
8400
  return /* @__PURE__ */ C("div", {
8384
8401
  className: `flex gap-3 ${t ? "flex-row-reverse" : "flex-row"} items-end mb-4`,
8385
8402
  children: [t ? /* @__PURE__ */ S("div", {
8386
- className: "w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center text-xs font-bold",
8403
+ className: "w-7 h-7 rounded-full flex-shrink-0 flex items-center justify-center",
8387
8404
  style: {
8388
8405
  background: "var(--t-user-bubble)",
8389
8406
  color: "var(--t-user-fg)"
8390
8407
  },
8391
- children: "U"
8408
+ children: /* @__PURE__ */ C("svg", {
8409
+ width: "14",
8410
+ height: "14",
8411
+ viewBox: "0 0 24 24",
8412
+ fill: "none",
8413
+ stroke: "currentColor",
8414
+ strokeWidth: "2",
8415
+ strokeLinecap: "round",
8416
+ strokeLinejoin: "round",
8417
+ children: [/* @__PURE__ */ S("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }), /* @__PURE__ */ S("circle", {
8418
+ cx: "12",
8419
+ cy: "7",
8420
+ r: "4"
8421
+ })]
8422
+ })
8392
8423
  }) : /* @__PURE__ */ S(Su, {}), /* @__PURE__ */ C("div", {
8393
8424
  className: `flex flex-col gap-1 max-w-[88%] ${t ? "items-end" : "items-start"}`,
8394
8425
  children: [/* @__PURE__ */ S("div", {
@@ -8489,7 +8520,7 @@ function Ou({ onSend: e, disabled: t, placeholder: n, allowFileUploads: r }) {
8489
8520
  className: "flex items-end gap-2 p-3",
8490
8521
  children: [
8491
8522
  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",
8523
+ 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
8524
  title: "Attach file",
8494
8525
  tabIndex: -1,
8495
8526
  children: /* @__PURE__ */ S("svg", {
@@ -8510,7 +8541,7 @@ function Ou({ onSend: e, disabled: t, placeholder: n, allowFileUploads: r }) {
8510
8541
  placeholder: n ?? "Type a message… (Enter to send, Shift+Enter for newline)",
8511
8542
  disabled: t,
8512
8543
  rows: 1,
8513
- className: "flex-1 rounded-xl px-4 py-2.5 text-sm leading-relaxed focus:outline-none disabled:opacity-50 min-h-[42px]",
8544
+ className: "flex-1 rounded-xl px-4 py-2.5 text-base md:text-sm leading-relaxed focus:outline-none disabled:opacity-50 min-h-[42px]",
8514
8545
  style: {
8515
8546
  background: "var(--t-bg-surface)",
8516
8547
  color: "var(--t-fg-primary)",
@@ -8521,7 +8552,7 @@ function Ou({ onSend: e, disabled: t, placeholder: n, allowFileUploads: r }) {
8521
8552
  /* @__PURE__ */ S("button", {
8522
8553
  onClick: f,
8523
8554
  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",
8555
+ 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
8556
  style: {
8526
8557
  background: "var(--t-accent)",
8527
8558
  color: "var(--t-accent-fg)"
@@ -8882,29 +8913,29 @@ function Bu({ text: e, muted: t }) {
8882
8913
  //#endregion
8883
8914
  //#region src/components/ChatView.tsx
8884
8915
  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 ? {
8916
+ 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 ? [
8917
+ T?.feedUrl || T?.items?.length ? {
8887
8918
  id: "notifications",
8888
- label: m.tabs?.notifications?.title ?? b?.notifications?.title ?? n("tabs.notifications"),
8919
+ label: h.tabs?.notifications?.title ?? w?.notifications?.title ?? n("tabs.notifications"),
8889
8920
  icon: "bulb"
8890
8921
  } : null,
8891
- T?.feedUrl || T?.items?.length ? {
8922
+ E?.feedUrl || E?.items?.length ? {
8892
8923
  id: "help",
8893
- label: m.tabs?.help?.title ?? b?.help?.title ?? n("tabs.help"),
8924
+ label: h.tabs?.help?.title ?? w?.help?.title ?? n("tabs.help"),
8894
8925
  icon: "book"
8895
8926
  } : null,
8896
8927
  {
8897
8928
  id: "chat",
8898
- label: m.tabs?.chat?.title ?? b?.chat?.title ?? n("tabs.chat"),
8929
+ label: h.tabs?.chat?.title ?? w?.chat?.title ?? n("tabs.chat"),
8899
8930
  icon: "chat"
8900
8931
  }
8901
- ].filter((e) => e !== null) : [], [O, k] = y("chat");
8932
+ ].filter((e) => e !== null) : [], [k, A] = y("chat");
8902
8933
  g(() => {
8903
8934
  r || a();
8904
8935
  }, [r, a]), g(() => {
8905
- p.current?.scrollIntoView({ behavior: "smooth" });
8936
+ m.current?.scrollIntoView({ behavior: "smooth" });
8906
8937
  }, [i, c]);
8907
- let A = l.showWelcomeScreen && i.length === 0 && !c, j = m.welcomeSubtitle ?? n("welcome.subtitle"), M = !E || O === "chat";
8938
+ let j = u.showWelcomeScreen && i.length === 0 && !c, M = h.welcomeSubtitle ?? n("welcome.subtitle"), N = !D || k === "chat";
8908
8939
  return /* @__PURE__ */ C("div", {
8909
8940
  className: "flex flex-col h-full min-w-0",
8910
8941
  children: [
@@ -8917,8 +8948,8 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8917
8948
  children: [/* @__PURE__ */ C("div", {
8918
8949
  className: "flex items-center gap-2",
8919
8950
  children: [
8920
- xu(l.botAvatar) ? /* @__PURE__ */ S("img", {
8921
- src: xu(l.botAvatar),
8951
+ xu(u.botAvatar) ? /* @__PURE__ */ S("img", {
8952
+ src: xu(u.botAvatar),
8922
8953
  alt: "",
8923
8954
  className: "w-7 h-7 rounded-full object-cover flex-shrink-0",
8924
8955
  style: { border: "1px solid var(--t-bg-border)" }
@@ -8928,9 +8959,9 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8928
8959
  }),
8929
8960
  /* @__PURE__ */ S("span", {
8930
8961
  className: "text-sm font-semibold text-fg-primary",
8931
- children: _
8962
+ children: b
8932
8963
  }),
8933
- l.webhookUrl ? /* @__PURE__ */ C("span", {
8964
+ u.webhookUrl ? /* @__PURE__ */ C("span", {
8934
8965
  className: "text-xs text-fg-muted",
8935
8966
  children: ["● ", n("header.online")]
8936
8967
  }) : /* @__PURE__ */ S("span", {
@@ -8940,7 +8971,7 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8940
8971
  ]
8941
8972
  }), /* @__PURE__ */ C("div", {
8942
8973
  className: "flex items-center gap-1",
8943
- children: [!d && /* @__PURE__ */ S("button", {
8974
+ children: [!f && /* @__PURE__ */ S("button", {
8944
8975
  onClick: e,
8945
8976
  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
8977
  title: n("sidebar.settings"),
@@ -8953,39 +8984,39 @@ function Vu({ onOpenSettings: e, onClose: t }) {
8953
8984
  })]
8954
8985
  })]
8955
8986
  }),
8956
- E && /* @__PURE__ */ S(ku, {
8957
- tabs: D,
8958
- activeId: O,
8959
- onChange: (e) => k(e)
8960
- }),
8961
- E && O === "notifications" && /* @__PURE__ */ S(Mu, {
8962
- feedUrl: w?.feedUrl,
8963
- inlineItems: w?.items
8987
+ D && /* @__PURE__ */ S(ku, {
8988
+ tabs: O,
8989
+ activeId: k,
8990
+ onChange: (e) => A(e)
8964
8991
  }),
8965
- E && O === "help" && /* @__PURE__ */ S(Lu, {
8992
+ D && k === "notifications" && /* @__PURE__ */ S(Mu, {
8966
8993
  feedUrl: T?.feedUrl,
8967
8994
  inlineItems: T?.items
8968
8995
  }),
8969
- M && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C("div", {
8996
+ D && k === "help" && /* @__PURE__ */ S(Lu, {
8997
+ feedUrl: E?.feedUrl,
8998
+ inlineItems: E?.items
8999
+ }),
9000
+ N && /* @__PURE__ */ C(x, { children: [/* @__PURE__ */ C("div", {
8970
9001
  className: "flex-1 overflow-y-auto px-4 py-4",
8971
- children: [A ? /* @__PURE__ */ S(Hu, {
8972
- botName: _,
8973
- subtitle: j
9002
+ children: [j ? /* @__PURE__ */ S(Hu, {
9003
+ botName: b,
9004
+ subtitle: M
8974
9005
  }) : /* @__PURE__ */ C(x, { children: [
8975
- i.length === 0 && h.map((e, t) => /* @__PURE__ */ S(wu, { message: {
9006
+ i.length === 0 && _.map((e, t) => /* @__PURE__ */ S(wu, { message: {
8976
9007
  id: String(t),
8977
9008
  role: "bot",
8978
9009
  content: e,
8979
9010
  ts: Date.now()
8980
9011
  } }, t)),
8981
9012
  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 })]
9013
+ (c && i[i.length - 1]?.role === "bot" && i[i.length - 1]?.content === "" || l) && /* @__PURE__ */ S(Tu, {})
9014
+ ] }), /* @__PURE__ */ S("div", { ref: m })]
8984
9015
  }), /* @__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
9016
+ onSend: p,
9017
+ disabled: c || !u.webhookUrl,
9018
+ placeholder: u.webhookUrl ? n("input.placeholder") : n("input.placeholderUnconfigured"),
9019
+ allowFileUploads: u.allowFileUploads
8989
9020
  })] })
8990
9021
  ]
8991
9022
  });
@@ -9058,35 +9089,35 @@ function Gu() {
9058
9089
  var Ku = 500 * 1024, qu = [
9059
9090
  {
9060
9091
  code: "en",
9061
- label: "EN English"
9092
+ label: "EN - English"
9062
9093
  },
9063
9094
  {
9064
9095
  code: "sk",
9065
- label: "SK Slovak"
9096
+ label: "SK - Slovak"
9066
9097
  },
9067
9098
  {
9068
9099
  code: "de",
9069
- label: "DE German"
9100
+ label: "DE - German"
9070
9101
  },
9071
9102
  {
9072
9103
  code: "cs",
9073
- label: "CS Czech"
9104
+ label: "CS - Czech"
9074
9105
  },
9075
9106
  {
9076
9107
  code: "pl",
9077
- label: "PL Polish"
9108
+ label: "PL - Polish"
9078
9109
  },
9079
9110
  {
9080
9111
  code: "hu",
9081
- label: "HU Hungarian"
9112
+ label: "HU - Hungarian"
9082
9113
  },
9083
9114
  {
9084
9115
  code: "fr",
9085
- label: "FR French"
9116
+ label: "FR - French"
9086
9117
  },
9087
9118
  {
9088
9119
  code: "es",
9089
- label: "ES Spanish"
9120
+ label: "ES - Spanish"
9090
9121
  }
9091
9122
  ];
9092
9123
  function Ju({ onClose: e }) {
@@ -9797,7 +9828,7 @@ useSettingsStore.getState().setLanguage(${JSON.stringify(i)})
9797
9828
  })] })
9798
9829
  })
9799
9830
  ]
9800
- }), /* @__PURE__ */ S("style", { children: "\n .input-field {\n width: 100%;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 13px;\n background: var(--t-bg-surface2);\n color: var(--t-fg-primary);\n border: 1px solid var(--t-bg-border);\n outline: none;\n transition: border-color 0.15s;\n }\n .input-field:focus { border-color: var(--t-accent); }\n " })]
9831
+ }), /* @__PURE__ */ S("style", { children: "\n .input-field {\n width: 100%;\n padding: 8px 12px;\n border-radius: 8px;\n font-size: 13px;\n background: var(--t-bg-surface2);\n color: var(--t-fg-primary);\n border: 1px solid var(--t-bg-border);\n outline: none;\n transition: border-color 0.15s;\n }\n .input-field:focus { border-color: var(--t-accent); }\n @media (max-width: 767px) {\n .input-field { font-size: 1rem; }\n }\n " })]
9801
9832
  });
9802
9833
  }
9803
9834
  function $({ label: e, required: t, error: n, children: r }) {
@@ -10082,11 +10113,10 @@ function $u() {
10082
10113
  }), !_ && r && /* @__PURE__ */ S(Ju, { onClose: () => i(!1) })] });
10083
10114
  }
10084
10115
  function ed({ open: e, iconSrc: t, onClick: n }) {
10085
- let r = !!t && !e;
10086
10116
  return /* @__PURE__ */ S("button", {
10087
10117
  className: "fixed bottom-4 right-4 z-50 w-14 h-14 rounded-full shadow-lg flex items-center justify-center transition-transform hover:scale-105 overflow-hidden",
10088
10118
  style: {
10089
- background: r ? "transparent" : "var(--t-accent)",
10119
+ background: "var(--t-accent)",
10090
10120
  color: "var(--t-accent-fg)"
10091
10121
  },
10092
10122
  onClick: n,
@@ -10099,7 +10129,7 @@ function ed({ open: e, iconSrc: t, onClick: n }) {
10099
10129
  stroke: "currentColor",
10100
10130
  strokeWidth: "2.5",
10101
10131
  children: /* @__PURE__ */ S("path", { d: "M18 6 6 18M6 6l12 12" })
10102
- }) : r ? /* @__PURE__ */ S("img", {
10132
+ }) : t && !e ? /* @__PURE__ */ S("img", {
10103
10133
  src: t,
10104
10134
  alt: "",
10105
10135
  className: "w-full h-full object-cover"
@@ -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/dist/store.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./chunks/settingsStore-uYZsUiVr.js";
1
+ import { t as e } from "./chunks/settingsStore-Br8PCCHq.js";
2
2
  export { e as useSettingsStore };
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.9",
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
+ }