@burdenoff/microfe-healthybowl 2026.829.1 → 2026.829.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.
- package/dist/components/assistant/AssistantChatArea.js +172 -163
- package/dist/components/assistant/AssistantChatArea.js.map +1 -1
- package/dist/components/assistant/AssistantMessageItem.js +15 -12
- package/dist/components/assistant/AssistantMessageItem.js.map +1 -1
- package/dist/components/assistant/AssistantSpeechProvider.js +152 -127
- package/dist/components/assistant/AssistantSpeechProvider.js.map +1 -1
- package/dist/components/assistant/composer/AssistantComposer.js +96 -84
- package/dist/components/assistant/composer/AssistantComposer.js.map +1 -1
- package/dist/components/assistant/composer/AssistantLanguageSelector.js +44 -0
- package/dist/components/assistant/composer/AssistantLanguageSelector.js.map +1 -0
- package/dist/config/assistantLanguages.js +115 -0
- package/dist/config/assistantLanguages.js.map +1 -0
- package/dist/hooks/useVoiceInput.js +34 -34
- package/dist/hooks/useVoiceInput.js.map +1 -1
- package/dist/store/assistantStore.js +7 -3
- package/dist/store/assistantStore.js.map +1 -1
- package/dist/types/assistant.js.map +1 -1
- package/dist/utils/assistantAttachments.js +1 -1
- package/dist/utils/assistantAttachments.js.map +1 -1
- package/dist/utils/assistantPrompt.js +13 -5
- package/dist/utils/assistantPrompt.js.map +1 -1
- package/dist/utils/replyLanguage.js +114 -0
- package/dist/utils/replyLanguage.js.map +1 -0
- package/dist/utils/speechVoices.js +2 -5
- package/dist/utils/speechVoices.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,35 +2,37 @@ import { useAssistantStore as e } from "../../store/assistantStore.js";
|
|
|
2
2
|
import { useTr as t } from "../../shared/hooks/useTr.js";
|
|
3
3
|
import { checkAssistantAiCredits as n, createAssistantSandbox as r, createAssistantSession as i, extendAssistantSandboxTTL as a, findExistingSandbox as o, getAssistantArtifacts as s, getAssistantMessages as c, getAssistantSession as l, reportAssistantAiTokenUsage as u, sendAssistantPromptAsync as d, waitForAssistantServiceReady as f, waitForSandboxReady as p } from "../../services/assistantApi.js";
|
|
4
4
|
import { gatherPageContext as m } from "../../utils/pageContext.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
5
|
+
import { findAssistantLanguage as h, resolveAssistantLanguage as g } from "../../config/assistantLanguages.js";
|
|
6
|
+
import { isTurnInFlight as _ } from "../../utils/assistantTurnState.js";
|
|
7
|
+
import { getOrganizationId as v, getWorkspaceId as ee } from "../../utils/assistantContext.js";
|
|
8
|
+
import { buildPromptParts as te, buildPromptWithAttachments as ne, countInlineImageCandidates as re, countInlinedImageParts as ie, toMessageAttachment as y } from "../../utils/assistantAttachments.js";
|
|
9
|
+
import { AssistantMessageList as b } from "./AssistantMessageList.js";
|
|
10
|
+
import { AssistantApiCallsConsentDialog as x } from "./AssistantApiCallsConsentDialog.js";
|
|
11
|
+
import { ASSISTANT_MODES as S } from "../../types/assistant.js";
|
|
12
|
+
import { AssistantEmptyState as C } from "./AssistantEmptyState.js";
|
|
13
|
+
import { AssistantComposer as w } from "./composer/AssistantComposer.js";
|
|
14
|
+
import { useAssistantApiAccess as ae } from "../../hooks/useAssistantApiAccess.js";
|
|
15
|
+
import { isQuotaExhaustedError as oe } from "../../utils/quotaUtils.js";
|
|
16
|
+
import { dispatchAssistantQuotaExhausted as se, notifyAiCreditsUpdated as ce } from "../../utils/aiCredits.js";
|
|
17
|
+
import { buildPromptForMode as le } from "../../utils/assistantPrompt.js";
|
|
18
|
+
import { isMultimodalBodyRejection as ue, isRecoverableAssistantError as de } from "../../utils/assistantTransportErrors.js";
|
|
19
|
+
import { useCallback as T, useEffect as E, useMemo as D, useRef as O, useState as fe } from "react";
|
|
20
|
+
import { useI18n as pe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
21
|
+
import { jsx as k, jsxs as me } from "react/jsx-runtime";
|
|
22
|
+
import { useGatewayClient as he } from "@burdenoff/fe-libs/shared/graphql";
|
|
23
|
+
import { useAuthToken as ge } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
22
24
|
import { getAssistantMedia as A } from "@burdenoff/fe-libs/shared/assistant";
|
|
23
25
|
//#region src/components/assistant/AssistantChatArea.tsx
|
|
24
|
-
var
|
|
26
|
+
var _e = {
|
|
25
27
|
general: 18e4,
|
|
26
28
|
assistant: 18e4,
|
|
27
29
|
"api-calls": 18e4,
|
|
28
30
|
"vibe-plugins": 6e5
|
|
29
|
-
},
|
|
30
|
-
function
|
|
31
|
+
}, ve = 18e4;
|
|
32
|
+
function ye() {
|
|
31
33
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
32
34
|
}
|
|
33
|
-
function
|
|
35
|
+
function be(e) {
|
|
34
36
|
return e.replace(/(Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/(X-Workspace-Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+\b/g, "[REDACTED_JWT]").replace(/\bsk-ant-[A-Za-z0-9-]+\b/g, "[REDACTED_API_KEY]");
|
|
35
37
|
}
|
|
36
38
|
function j(e) {
|
|
@@ -45,7 +47,7 @@ function N(e) {
|
|
|
45
47
|
return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
|
-
function
|
|
50
|
+
function xe(e, t) {
|
|
49
51
|
let n = e.filter((e) => e.info?.role === "assistant" && j(e) > t).sort((e, t) => j(e) - j(t));
|
|
50
52
|
if (n.length === 0) return {
|
|
51
53
|
content: "Thinking...",
|
|
@@ -62,7 +64,7 @@ function ve(e, t) {
|
|
|
62
64
|
tokens: r.info?.tokens
|
|
63
65
|
};
|
|
64
66
|
}
|
|
65
|
-
function
|
|
67
|
+
function Se(e) {
|
|
66
68
|
switch (e) {
|
|
67
69
|
case "provisioning": return "Starting assistant environment...";
|
|
68
70
|
case "connecting": return "Connecting to assistant...";
|
|
@@ -71,247 +73,254 @@ function ye(e) {
|
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
var P = () => {
|
|
74
|
-
let A = t(), M =
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
let e =
|
|
78
|
-
(!e || e.requiresAdmin && !
|
|
76
|
+
let A = t(), M = he("workspace"), { getAccessToken: N, getWorkspaceToken: P, userId: Ce } = ge(), { locale: F } = pe(), I = e((e) => e.assistantLanguage), we = D(() => g(I, F).english, [I, F]), Te = h(I) !== null, L = D(() => g(I, F).code, [I, F]), { conversations: Ee, activeConversationId: R, mode: z, processingByConversationId: De, setMode: B, setConversationMode: V, setActiveConversation: Oe, createConversation: H, addMessage: U, updateMessage: ke, patchMessage: W, setConversationProcessing: G, clearConversationProcessing: Ae, setBackendSessionId: je, clearBackendSessionId: K, setSandbox: q, clearSandbox: Me, acknowledgeApiCalls: Ne } = e(), J = Ee.find((e) => e.id === R)?.messages ?? [], Y = R ? De[R] : void 0, Pe = _(Y?.status), Fe = Pe ? Y?.messageId ?? null : null, Ie = Y?.status === "error" ? Y.messageId : null, { canUseApiCalls: X, loading: Le } = ae(v()), Re = D(() => S.filter((e) => !e.requiresAdmin || X), [X]), [ze, Be] = fe(null), Ve = O({}), He = O(/* @__PURE__ */ new Set());
|
|
77
|
+
E(() => {
|
|
78
|
+
if (Le) return;
|
|
79
|
+
let e = S.find((e) => e.id === z);
|
|
80
|
+
(!e || e.requiresAdmin && !X) && z !== "assistant" && B("assistant");
|
|
79
81
|
}, [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
z,
|
|
83
|
+
X,
|
|
84
|
+
Le,
|
|
85
|
+
B
|
|
84
86
|
]);
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
}, [
|
|
87
|
+
let Z = T((e, t, n, r) => {
|
|
88
|
+
G(e, n, t, null), r ? ke(e, t, r) : ke(e, t, Se(n));
|
|
89
|
+
}, [G, ke]), Ue = T(async (t, n, a, s, c) => {
|
|
88
90
|
let u = e.getState().sandboxesByMode[a]?.sandboxId ?? null, d = async (e) => {
|
|
89
91
|
try {
|
|
90
|
-
return await p(M, e, s, c, 3e5, (e) =>
|
|
92
|
+
return await p(M, e, s, c, 3e5, (e) => Z(t, n, "provisioning", e)), await f(M, e, s, c, 9e4, (e) => Z(t, n, "connecting", e)), !0;
|
|
91
93
|
} catch {
|
|
92
94
|
return !1;
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
|
-
if (u && (
|
|
96
|
-
|
|
97
|
+
if (u && (q(a, u, "provisioning"), Z(t, n, "provisioning", "Reusing assistant environment..."), await d(u) || (q(a, null, "provisioning"), u = null)), !u) {
|
|
98
|
+
Z(t, n, "provisioning", "Looking for existing environment...");
|
|
97
99
|
let e = await o(M, s, a, c);
|
|
98
|
-
e && (
|
|
100
|
+
e && (q(a, e, "provisioning"), Z(t, n, "provisioning", "Reusing assistant environment..."), await d(e) ? u = e : q(a, null, "provisioning"));
|
|
99
101
|
}
|
|
100
102
|
if (!u) {
|
|
101
103
|
if (a === "api-calls" && !N()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
102
|
-
|
|
104
|
+
Z(t, n, "provisioning", "Starting assistant environment..."), q(a, null, "provisioning"), u = await r(M, a, s, c), q(a, u, "provisioning"), await p(M, u, s, c, 3e5, (e) => Z(t, n, "provisioning", e)), await f(M, u, s, c, 9e4, (e) => Z(t, n, "connecting", e));
|
|
103
105
|
}
|
|
104
|
-
|
|
106
|
+
q(a, u, "running");
|
|
105
107
|
let m = e.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null;
|
|
106
108
|
if (m) try {
|
|
107
109
|
let e = await l(M, u, s, m, c);
|
|
108
110
|
if (e.mode !== a) throw Error(`Session mode mismatch: expected ${a}, received ${e.mode}`);
|
|
109
111
|
} catch {
|
|
110
|
-
|
|
112
|
+
K(t), m = null;
|
|
111
113
|
}
|
|
112
|
-
return m || (
|
|
114
|
+
return m || (Z(t, n, "connecting", "Preparing session..."), m = (await i(M, u, s, a, c)).sessionId, je(t, m)), {
|
|
113
115
|
sandboxId: u,
|
|
114
116
|
sessionId: m
|
|
115
117
|
};
|
|
116
118
|
}, [
|
|
117
119
|
M,
|
|
118
|
-
G,
|
|
119
|
-
N,
|
|
120
|
-
W,
|
|
121
120
|
K,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
let
|
|
121
|
+
N,
|
|
122
|
+
je,
|
|
123
|
+
q,
|
|
124
|
+
Z
|
|
125
|
+
]), Q = T(async (t, r = []) => {
|
|
126
|
+
let i = e.getState(), o = i.activeConversationId ?? R;
|
|
127
|
+
if (o && (_(i.processingByConversationId[o]?.status) || He.current.has(o))) return;
|
|
128
|
+
let l = i.mode, f = R, p = f ? e.getState().conversations.find((e) => e.id === f) : void 0;
|
|
129
|
+
if (f ? p && p.mode !== l && (p.messages.length > 0 || p.backendSessionId) ? f = H(void 0, l) : p && p.mode !== l && V(f, l) : f = H(void 0, l), !f) return;
|
|
130
|
+
Ve.current[f] = r;
|
|
131
|
+
let h = ee(), g = {
|
|
130
132
|
accessToken: N(),
|
|
131
133
|
workspaceToken: P(),
|
|
132
|
-
userId:
|
|
133
|
-
organizationId:
|
|
134
|
+
userId: Ce,
|
|
135
|
+
organizationId: v()
|
|
134
136
|
}, b = {
|
|
135
|
-
id:
|
|
137
|
+
id: ye(),
|
|
136
138
|
role: "user",
|
|
137
139
|
content: t,
|
|
138
140
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
139
|
-
metadata: r.length ? { attachments: r.map(
|
|
141
|
+
metadata: r.length ? { attachments: r.map(y) } : void 0
|
|
140
142
|
};
|
|
141
|
-
|
|
142
|
-
let x =
|
|
143
|
-
|
|
143
|
+
U(f, b);
|
|
144
|
+
let x = ye();
|
|
145
|
+
U(f, {
|
|
144
146
|
id: x,
|
|
145
147
|
role: "assistant",
|
|
146
148
|
content: "",
|
|
147
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
150
|
+
metadata: { lang: L }
|
|
151
|
+
}), G(f, "provisioning", x, null);
|
|
152
|
+
let S = (e, t, n, r, i = L) => {
|
|
153
|
+
W(f, x, {
|
|
154
|
+
content: be(e),
|
|
155
|
+
metadata: {
|
|
156
|
+
lang: i,
|
|
157
|
+
...t?.length ? { artifacts: t } : {},
|
|
158
|
+
...t?.length || n || r ? { mode: l } : {},
|
|
159
|
+
...n ? { sessionId: n } : {},
|
|
160
|
+
...r ? { sandboxId: r } : {}
|
|
161
|
+
}
|
|
158
162
|
});
|
|
159
163
|
}, C = async (e = 1) => {
|
|
160
164
|
let i = !1;
|
|
161
165
|
try {
|
|
162
|
-
await n(M,
|
|
166
|
+
await n(M, h, g);
|
|
163
167
|
} catch (e) {
|
|
164
|
-
if (
|
|
165
|
-
|
|
168
|
+
if (oe(e)) {
|
|
169
|
+
se("ai-credits"), S("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting.", void 0, void 0, void 0, "en"), G(f, "error", x, null);
|
|
166
170
|
return;
|
|
167
171
|
}
|
|
168
172
|
console.warn("[assistant] AI-credit pre-flight check failed with a non-quota error; proceeding — gateway @usage(checkQuota) still enforces the real budget downstream", e);
|
|
169
173
|
}
|
|
170
174
|
try {
|
|
171
|
-
let { sandboxId: e, sessionId: n } = await
|
|
172
|
-
|
|
173
|
-
let p =
|
|
174
|
-
i = re(r) >
|
|
175
|
+
let { sandboxId: e, sessionId: n } = await Ue(f, x, l, h, g), o = (await c(M, e, h, n, g, 50).catch(() => [])).reduce((e, t) => Math.max(e, j(t)), 0);
|
|
176
|
+
Z(f, x, "streaming", "Thinking...");
|
|
177
|
+
let p = le(l, ne(t, r), we, Te), _ = te(p, r), v = ie(_), ee = v > 0, y = m();
|
|
178
|
+
i = re(r) > v;
|
|
175
179
|
try {
|
|
176
|
-
await d(M, e,
|
|
180
|
+
await d(M, e, h, n, p, l, y, g, _);
|
|
177
181
|
} catch (t) {
|
|
178
|
-
if (!
|
|
179
|
-
await d(M, e,
|
|
182
|
+
if (!_ || !ue(t)) throw t;
|
|
183
|
+
await d(M, e, h, n, p, l, y, g, void 0), i ||= ee;
|
|
180
184
|
}
|
|
181
|
-
let b =
|
|
182
|
-
for (; Date.now() < C && (b =
|
|
185
|
+
let b = xe([], o), C = Date.now() + (_e[l] ?? ve), w = Date.now();
|
|
186
|
+
for (; Date.now() < C && (b = xe(await c(M, e, h, n, g, 50), o), W(f, x, { content: be(b.content) }), !b.done);) Date.now() - w > 3e4 && (await a(M, e, h, 600, g).catch(() => void 0), w = Date.now()), await new Promise((e) => setTimeout(e, 1500));
|
|
183
187
|
if (!b.done && l !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
|
|
184
|
-
let
|
|
188
|
+
let ae = l === "vibe-plugins" ? await s(M, e, h, n, g).catch(() => []) : void 0;
|
|
185
189
|
if (b.done || (b = {
|
|
186
190
|
...b,
|
|
187
191
|
content: `${b.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
|
|
188
192
|
}), i && (b = {
|
|
189
193
|
...b,
|
|
190
194
|
content: `${b.content}\n\n${A("healthybowl.assistant.attachments.imagesNotSent", "_Your photo was too large to include with this message, so the answer above is from the text and the file link only. Try a smaller or more tightly cropped photo._")}`
|
|
191
|
-
}), S(b.content,
|
|
192
|
-
|
|
195
|
+
}), S(b.content, ae, n, e), b.tokens) {
|
|
196
|
+
W(f, x, { tokens: b.tokens });
|
|
193
197
|
try {
|
|
194
|
-
await u(M,
|
|
198
|
+
await u(M, h, n, b.tokens, g), ce();
|
|
195
199
|
} catch {}
|
|
196
200
|
}
|
|
197
|
-
|
|
201
|
+
G(f, "complete", x, null);
|
|
198
202
|
} catch (t) {
|
|
199
|
-
if (e === 1 &&
|
|
203
|
+
if (e === 1 && de(t)) return K(f), Me(l), C(2);
|
|
200
204
|
throw t;
|
|
201
205
|
}
|
|
202
|
-
},
|
|
203
|
-
|
|
206
|
+
}, w = f;
|
|
207
|
+
He.current.add(w);
|
|
204
208
|
try {
|
|
205
|
-
if (!
|
|
209
|
+
if (!h) throw Error("Assistant backend is unavailable without an active workspace context.");
|
|
206
210
|
await C();
|
|
207
211
|
} catch (e) {
|
|
208
|
-
if (
|
|
209
|
-
|
|
212
|
+
if (oe(e)) {
|
|
213
|
+
se("sandbox"), S("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant.", void 0, void 0, void 0, "en"), G(f, "error", x, null);
|
|
210
214
|
return;
|
|
211
215
|
}
|
|
212
216
|
let t = e instanceof Error ? e.message : "Something went wrong";
|
|
213
|
-
|
|
217
|
+
G(f, "error", x, t), W(f, x, {
|
|
218
|
+
content: `Sorry, an error occurred: ${t}. Please try again.`,
|
|
219
|
+
metadata: { lang: "en" }
|
|
220
|
+
});
|
|
214
221
|
} finally {
|
|
215
|
-
|
|
222
|
+
He.current.delete(w);
|
|
216
223
|
}
|
|
217
224
|
}, [
|
|
218
|
-
|
|
219
|
-
|
|
225
|
+
R,
|
|
226
|
+
U,
|
|
220
227
|
M,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
K,
|
|
229
|
+
Me,
|
|
230
|
+
Ee,
|
|
231
|
+
H,
|
|
232
|
+
Ue,
|
|
226
233
|
N,
|
|
227
234
|
P,
|
|
228
|
-
H,
|
|
229
235
|
W,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
236
|
+
Te,
|
|
237
|
+
L,
|
|
238
|
+
we,
|
|
239
|
+
je,
|
|
234
240
|
V,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
Z(e);
|
|
238
|
-
}, [Z]), Re = E(() => {
|
|
239
|
-
let e = [...q].reverse().find((e) => e.role === "user"), t = F ? Pe.current[F] ?? [] : [];
|
|
240
|
-
e && Z(e.content, t);
|
|
241
|
-
}, [
|
|
242
|
-
q,
|
|
241
|
+
G,
|
|
242
|
+
A,
|
|
243
243
|
Z,
|
|
244
|
-
|
|
245
|
-
]),
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
Ce
|
|
245
|
+
]), We = T((e) => {
|
|
246
|
+
Q(e);
|
|
247
|
+
}, [Q]), Ge = T(() => {
|
|
248
|
+
let e = [...J].reverse().find((e) => e.role === "user"), t = R ? Ve.current[R] ?? [] : [];
|
|
249
|
+
e && Q(e.content, t);
|
|
250
|
+
}, [
|
|
251
|
+
J,
|
|
252
|
+
Q,
|
|
253
|
+
R
|
|
254
|
+
]), Ke = O(Q);
|
|
255
|
+
E(() => {
|
|
256
|
+
Ke.current = Q;
|
|
257
|
+
}, [Q]), E(() => {
|
|
249
258
|
let t = e.getState().consumePendingPrompt();
|
|
250
|
-
return t &&
|
|
259
|
+
return t && Ke.current(t), e.subscribe((t, n) => {
|
|
251
260
|
if (t.pendingPrompt && t.pendingPrompt !== n.pendingPrompt) {
|
|
252
261
|
let t = e.getState().consumePendingPrompt();
|
|
253
|
-
t &&
|
|
262
|
+
t && Ke.current(t);
|
|
254
263
|
}
|
|
255
264
|
});
|
|
256
265
|
}, []);
|
|
257
|
-
let $ =
|
|
258
|
-
let n =
|
|
266
|
+
let $ = T((t) => {
|
|
267
|
+
let n = R ? e.getState().conversations.find((e) => e.id === R) : void 0;
|
|
259
268
|
if (n && (n.messages.length > 0 || n.backendSessionId)) {
|
|
260
269
|
if (n.mode !== t) {
|
|
261
270
|
let n = e.getState().conversations.find((n) => n.mode === t && n.messages.length === 0 && !n.backendSessionId && !e.getState().processingByConversationId[n.id]);
|
|
262
|
-
n ?
|
|
271
|
+
n ? Oe(n.id) : H(void 0, t);
|
|
263
272
|
}
|
|
264
|
-
} else
|
|
265
|
-
|
|
273
|
+
} else R && V(R, t);
|
|
274
|
+
B(t);
|
|
266
275
|
}, [
|
|
267
|
-
F,
|
|
268
|
-
z,
|
|
269
|
-
Ce,
|
|
270
276
|
R,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
277
|
+
H,
|
|
278
|
+
Oe,
|
|
279
|
+
V,
|
|
280
|
+
B
|
|
281
|
+
]), qe = T((t) => {
|
|
282
|
+
if (S.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
|
|
283
|
+
Be(t);
|
|
275
284
|
return;
|
|
276
285
|
}
|
|
277
286
|
$(t);
|
|
278
|
-
}, [$]),
|
|
279
|
-
let e =
|
|
280
|
-
|
|
287
|
+
}, [$]), Je = T(() => {
|
|
288
|
+
let e = ze;
|
|
289
|
+
Be(null), Ne(), e && $(e);
|
|
281
290
|
}, [
|
|
282
|
-
|
|
283
|
-
|
|
291
|
+
ze,
|
|
292
|
+
Ne,
|
|
284
293
|
$
|
|
285
|
-
]),
|
|
286
|
-
|
|
294
|
+
]), Ye = T(() => {
|
|
295
|
+
Be(null);
|
|
287
296
|
}, []);
|
|
288
|
-
return /* @__PURE__ */
|
|
297
|
+
return /* @__PURE__ */ me("div", {
|
|
289
298
|
className: "flex flex-1 flex-col overflow-hidden",
|
|
290
299
|
children: [
|
|
291
|
-
|
|
292
|
-
mode:
|
|
293
|
-
onSuggestionClick:
|
|
300
|
+
J.length === 0 ? /* @__PURE__ */ k(C, {
|
|
301
|
+
mode: z,
|
|
302
|
+
onSuggestionClick: We
|
|
294
303
|
}) : /* @__PURE__ */ k("div", {
|
|
295
304
|
className: "flex min-h-0 flex-1 flex-col",
|
|
296
|
-
children: /* @__PURE__ */ k(
|
|
297
|
-
messages:
|
|
298
|
-
streamingMessageId:
|
|
299
|
-
failedMessageId:
|
|
300
|
-
onRetry:
|
|
305
|
+
children: /* @__PURE__ */ k(b, {
|
|
306
|
+
messages: J,
|
|
307
|
+
streamingMessageId: Fe,
|
|
308
|
+
failedMessageId: Ie,
|
|
309
|
+
onRetry: Ge
|
|
301
310
|
})
|
|
302
311
|
}),
|
|
303
|
-
/* @__PURE__ */ k(
|
|
304
|
-
onSend: (e, t) => void
|
|
305
|
-
disabled:
|
|
306
|
-
placeholder:
|
|
307
|
-
mode:
|
|
308
|
-
availableModes:
|
|
309
|
-
onModeChange:
|
|
312
|
+
/* @__PURE__ */ k(w, {
|
|
313
|
+
onSend: (e, t) => void Q(e, t),
|
|
314
|
+
disabled: Pe,
|
|
315
|
+
placeholder: z === "api-calls" ? A("healthybowl.assistant.chatArea.placeholderActions", "What would you like me to do?") : A("healthybowl.assistant.chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
|
|
316
|
+
mode: z,
|
|
317
|
+
availableModes: Re,
|
|
318
|
+
onModeChange: qe
|
|
310
319
|
}),
|
|
311
|
-
/* @__PURE__ */ k(
|
|
312
|
-
open:
|
|
313
|
-
onConfirm:
|
|
314
|
-
onCancel:
|
|
320
|
+
/* @__PURE__ */ k(x, {
|
|
321
|
+
open: ze !== null,
|
|
322
|
+
onConfirm: Je,
|
|
323
|
+
onCancel: Ye
|
|
315
324
|
})
|
|
316
325
|
]
|
|
317
326
|
});
|