@burdenoff/microfe-healthybowl 2026.720.2 → 2026.725.2
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/AIAssistantPanel.js +27 -99
- package/dist/components/assistant/AIAssistantPanel.js.map +1 -1
- package/dist/components/assistant/AssistantApiCallsConsentDialog.js +4 -4
- package/dist/components/assistant/AssistantApiCallsConsentDialog.js.map +1 -1
- package/dist/components/assistant/AssistantChatArea.js +147 -163
- package/dist/components/assistant/AssistantChatArea.js.map +1 -1
- package/dist/components/assistant/AssistantEmptyState.js +41 -0
- package/dist/components/assistant/AssistantEmptyState.js.map +1 -0
- package/dist/components/assistant/AssistantHeader.js +77 -0
- package/dist/components/assistant/AssistantHeader.js.map +1 -0
- package/dist/components/assistant/AssistantMessageItem.js +93 -51
- package/dist/components/assistant/AssistantMessageItem.js.map +1 -1
- package/dist/components/assistant/AssistantMessageList.js +12 -15
- package/dist/components/assistant/AssistantMessageList.js.map +1 -1
- package/dist/components/assistant/AssistantToolActivity.js +110 -0
- package/dist/components/assistant/AssistantToolActivity.js.map +1 -0
- package/dist/components/assistant/composer/AssistantAttachmentButton.js +20 -0
- package/dist/components/assistant/composer/AssistantAttachmentButton.js.map +1 -0
- package/dist/components/assistant/composer/AssistantComposer.js +74 -0
- package/dist/components/assistant/composer/AssistantComposer.js.map +1 -0
- package/dist/components/assistant/composer/AssistantModeSelector.js +46 -0
- package/dist/components/assistant/composer/AssistantModeSelector.js.map +1 -0
- package/dist/components/assistant/composer/AssistantVoiceButton.js +20 -0
- package/dist/components/assistant/composer/AssistantVoiceButton.js.map +1 -0
- package/dist/components/assistant/index.js +6 -4
- package/dist/config/assistantUsecases.js +2 -2
- package/dist/config/assistantUsecases.js.map +1 -1
- package/dist/healthybowl/components/index.js +2 -1
- package/dist/healthybowl/index.js +2 -1
- package/dist/healthybowl/pages/HomePage.js +450 -368
- package/dist/healthybowl/pages/HomePage.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/utils/pageContext.js +20 -2
- package/dist/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/assistant/AssistantChatInput.js +0 -65
- package/dist/components/assistant/AssistantChatInput.js.map +0 -1
- package/dist/components/assistant/AssistantModeSelector.js +0 -61
- package/dist/components/assistant/AssistantModeSelector.js.map +0 -1
- package/dist/components/assistant/AssistantWelcome.js +0 -45
- package/dist/components/assistant/AssistantWelcome.js.map +0 -1
- package/dist/healthybowl/components/assistant/AIAssistantPanel.js +0 -3
- package/dist/healthybowl/components/assistant/index.js +0 -1
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
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
|
-
import {
|
|
4
|
+
import { gatherPageContext as m } from "../../utils/pageContext.js";
|
|
5
5
|
import { AssistantMessageList as h } from "./AssistantMessageList.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { AssistantApiCallsConsentDialog as g } from "./AssistantApiCallsConsentDialog.js";
|
|
7
|
+
import { ASSISTANT_MODES as _ } from "../../types/assistant.js";
|
|
8
|
+
import { AssistantEmptyState as v } from "./AssistantEmptyState.js";
|
|
9
|
+
import { AssistantComposer as ee } from "./composer/AssistantComposer.js";
|
|
10
10
|
import { useAssistantApiAccess as te } from "../../hooks/useAssistantApiAccess.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { useGatewayClient as fe } from "@burdenoff/fe-libs/shared/graphql";
|
|
19
|
-
import { useAuthToken as pe } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
11
|
+
import { isQuotaExhaustedError as y } from "../../utils/quotaUtils.js";
|
|
12
|
+
import { dispatchAssistantQuotaExhausted as b, notifyAiCreditsUpdated as ne } from "../../utils/aiCredits.js";
|
|
13
|
+
import { buildPromptForMode as re } from "../../utils/assistantPrompt.js";
|
|
14
|
+
import { useCallback as x, useEffect as S, useMemo as ie, useRef as ae, useState as oe } from "react";
|
|
15
|
+
import { jsx as C, jsxs as se } from "react/jsx-runtime";
|
|
16
|
+
import { useGatewayClient as ce } from "@burdenoff/fe-libs/shared/graphql";
|
|
17
|
+
import { useAuthToken as le } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
20
18
|
//#region src/components/assistant/AssistantChatArea.tsx
|
|
21
|
-
var
|
|
19
|
+
var ue = {
|
|
22
20
|
general: 18e4,
|
|
23
21
|
"api-calls": 18e4,
|
|
24
22
|
"vibe-plugins": 6e5
|
|
25
|
-
},
|
|
26
|
-
function
|
|
23
|
+
}, de = 18e4;
|
|
24
|
+
function fe() {
|
|
27
25
|
return `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
28
26
|
}
|
|
29
|
-
function
|
|
27
|
+
function w(e) {
|
|
30
28
|
try {
|
|
31
29
|
let t = e === "workspaceId" ? "burdenoff-active-context-workspace" : "burdenoff-active-context-organization", n = sessionStorage.getItem(t);
|
|
32
30
|
if (n) return n;
|
|
@@ -40,13 +38,13 @@ function C(e) {
|
|
|
40
38
|
return "";
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
|
-
function
|
|
44
|
-
return new URLSearchParams(window.location.search).get("workspace") ??
|
|
41
|
+
function pe() {
|
|
42
|
+
return new URLSearchParams(window.location.search).get("workspace") ?? w("workspaceId");
|
|
45
43
|
}
|
|
46
|
-
function
|
|
47
|
-
return new URLSearchParams(window.location.search).get("org") ??
|
|
44
|
+
function me() {
|
|
45
|
+
return new URLSearchParams(window.location.search).get("org") ?? w("organizationId");
|
|
48
46
|
}
|
|
49
|
-
function
|
|
47
|
+
function he(e) {
|
|
50
48
|
let t = e instanceof Error ? e.message.toLowerCase() : String(e).toLowerCase();
|
|
51
49
|
return t.includes("rate limit exceeded") || t.includes("unauthorized") || t.includes("k8s api error 401") ? !1 : [
|
|
52
50
|
"sandbox not found",
|
|
@@ -61,35 +59,35 @@ function ye(e) {
|
|
|
61
59
|
"session mode mismatch"
|
|
62
60
|
].some((e) => t.includes(e));
|
|
63
61
|
}
|
|
64
|
-
function
|
|
62
|
+
function T(e) {
|
|
65
63
|
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]");
|
|
66
64
|
}
|
|
67
|
-
function
|
|
65
|
+
function E(e) {
|
|
68
66
|
return e.info?.time?.created ?? 0;
|
|
69
67
|
}
|
|
70
|
-
function
|
|
68
|
+
function D(e) {
|
|
71
69
|
return (e ?? []).filter((e) => e.type === "text" && typeof e.text == "string").map((e) => e.text?.trim() ?? "").filter(Boolean).join("\n");
|
|
72
70
|
}
|
|
73
|
-
function
|
|
71
|
+
function O(e) {
|
|
74
72
|
return (e ?? []).filter((e) => e.type === "tool" && e.tool).map((e) => {
|
|
75
73
|
let t = e.state?.status ?? "running", n = e.tool ?? "tool";
|
|
76
74
|
return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
|
-
function
|
|
80
|
-
let n = e.filter((e) => e.info?.role === "assistant" &&
|
|
77
|
+
function k(e, t) {
|
|
78
|
+
let n = e.filter((e) => e.info?.role === "assistant" && E(e) > t).sort((e, t) => E(e) - E(t));
|
|
81
79
|
if (n.length === 0) return {
|
|
82
80
|
content: "Thinking...",
|
|
83
81
|
done: !1
|
|
84
82
|
};
|
|
85
|
-
let r = n[n.length - 1], i =
|
|
83
|
+
let r = n[n.length - 1], i = D(r.parts), a = O(r.parts);
|
|
86
84
|
return {
|
|
87
85
|
content: [i, ...a].filter(Boolean).join("\n\n") || "Thinking...",
|
|
88
86
|
done: !!r.info?.time?.completed && (!!i || a.length > 0),
|
|
89
87
|
tokens: r.info?.tokens
|
|
90
88
|
};
|
|
91
89
|
}
|
|
92
|
-
function
|
|
90
|
+
function ge(e) {
|
|
93
91
|
switch (e) {
|
|
94
92
|
case "provisioning": return "Starting assistant environment...";
|
|
95
93
|
case "connecting": return "Connecting to assistant...";
|
|
@@ -97,85 +95,85 @@ function Se(e) {
|
|
|
97
95
|
default: return "";
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
|
-
var
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
let e =
|
|
105
|
-
(!e || e.requiresAdmin && !
|
|
98
|
+
var A = () => {
|
|
99
|
+
let w = t(), D = ce("workspace"), { getAccessToken: O, getWorkspaceToken: A, userId: j } = le(), { conversations: _e, activeConversationId: M, mode: N, processingByConversationId: P, setMode: F, setConversationMode: I, setActiveConversation: ve, createConversation: L, addMessage: R, updateMessage: z, patchMessage: B, setConversationProcessing: V, clearConversationProcessing: ye, setBackendSessionId: H, clearBackendSessionId: U, setSandbox: W, clearSandbox: be, acknowledgeApiCalls: xe } = e(), G = _e.find((e) => e.id === M)?.messages ?? [], K = M ? P[M] : void 0, Se = K?.messageId ?? null, Ce = K?.status === "provisioning" || K?.status === "connecting" || K?.status === "streaming", we = K?.status === "error" ? K.messageId : null, { canUseApiCalls: q, loading: Te } = te(me()), Ee = ie(() => _.filter((e) => !e.requiresAdmin || q), [q]), [J, Y] = oe(null);
|
|
100
|
+
S(() => {
|
|
101
|
+
if (Te) return;
|
|
102
|
+
let e = _.find((e) => e.id === N);
|
|
103
|
+
(!e || e.requiresAdmin && !q) && N !== "general" && F("general");
|
|
106
104
|
}, [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
N,
|
|
106
|
+
q,
|
|
107
|
+
Te,
|
|
108
|
+
F
|
|
111
109
|
]);
|
|
112
|
-
let
|
|
113
|
-
V(e, n, t, null), r ? z(e, t, r) : z(e, t,
|
|
114
|
-
}, [V, z]),
|
|
110
|
+
let X = x((e, t, n, r) => {
|
|
111
|
+
V(e, n, t, null), r ? z(e, t, r) : z(e, t, ge(n));
|
|
112
|
+
}, [V, z]), De = x(async (t, n, a, s, c) => {
|
|
115
113
|
let u = e.getState().sandboxesByMode[a]?.sandboxId ?? null, d = async (e) => {
|
|
116
114
|
try {
|
|
117
|
-
return await p(
|
|
115
|
+
return await p(D, e, s, c, 3e5, (e) => X(t, n, "provisioning", e)), await f(D, e, s, c, 9e4, (e) => X(t, n, "connecting", e)), !0;
|
|
118
116
|
} catch {
|
|
119
117
|
return !1;
|
|
120
118
|
}
|
|
121
119
|
};
|
|
122
|
-
if (u && (W(a, u, "provisioning"),
|
|
123
|
-
|
|
124
|
-
let e = await o(
|
|
125
|
-
e && (W(a, e, "provisioning"),
|
|
120
|
+
if (u && (W(a, u, "provisioning"), X(t, n, "provisioning", "Reusing assistant environment..."), await d(u) || (W(a, null, "provisioning"), u = null)), !u) {
|
|
121
|
+
X(t, n, "provisioning", "Looking for existing environment...");
|
|
122
|
+
let e = await o(D, s, a, c);
|
|
123
|
+
e && (W(a, e, "provisioning"), X(t, n, "provisioning", "Reusing assistant environment..."), await d(e) ? u = e : W(a, null, "provisioning"));
|
|
126
124
|
}
|
|
127
125
|
if (!u) {
|
|
128
|
-
if (a === "api-calls" && !
|
|
129
|
-
|
|
126
|
+
if (a === "api-calls" && !O()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
127
|
+
X(t, n, "provisioning", "Starting assistant environment..."), W(a, null, "provisioning"), u = await r(D, a, s, c), W(a, u, "provisioning"), await p(D, u, s, c, 3e5, (e) => X(t, n, "provisioning", e)), await f(D, u, s, c, 9e4, (e) => X(t, n, "connecting", e));
|
|
130
128
|
}
|
|
131
129
|
W(a, u, "running");
|
|
132
130
|
let m = e.getState().conversations.find((e) => e.id === t)?.backendSessionId ?? null;
|
|
133
131
|
if (m) try {
|
|
134
|
-
let e = await l(
|
|
132
|
+
let e = await l(D, u, s, m, c);
|
|
135
133
|
if (e.mode !== a) throw Error(`Session mode mismatch: expected ${a}, received ${e.mode}`);
|
|
136
134
|
} catch {
|
|
137
135
|
U(t), m = null;
|
|
138
136
|
}
|
|
139
|
-
return m || (
|
|
137
|
+
return m || (X(t, n, "connecting", "Preparing session..."), m = (await i(D, u, s, a, c)).sessionId, H(t, m)), {
|
|
140
138
|
sandboxId: u,
|
|
141
139
|
sessionId: m
|
|
142
140
|
};
|
|
143
141
|
}, [
|
|
144
|
-
E,
|
|
145
|
-
U,
|
|
146
142
|
D,
|
|
143
|
+
U,
|
|
144
|
+
O,
|
|
147
145
|
H,
|
|
148
146
|
W,
|
|
149
|
-
|
|
150
|
-
]), Z =
|
|
151
|
-
if (
|
|
152
|
-
let e =
|
|
147
|
+
X
|
|
148
|
+
]), Z = x(async (t) => {
|
|
149
|
+
if (M) {
|
|
150
|
+
let e = P[M]?.status;
|
|
153
151
|
if (e === "provisioning" || e === "connecting" || e === "streaming") return;
|
|
154
152
|
}
|
|
155
|
-
let r = e.getState().mode, i =
|
|
156
|
-
if (i ? o && o.mode !== r && (o.messages.length > 0 || o.backendSessionId) ? i = L(void 0, r) : o && o.mode !== r &&
|
|
157
|
-
let l =
|
|
158
|
-
accessToken:
|
|
159
|
-
workspaceToken:
|
|
160
|
-
userId:
|
|
161
|
-
organizationId:
|
|
153
|
+
let r = e.getState().mode, i = M, o = i ? e.getState().conversations.find((e) => e.id === i) : void 0;
|
|
154
|
+
if (i ? o && o.mode !== r && (o.messages.length > 0 || o.backendSessionId) ? i = L(void 0, r) : o && o.mode !== r && I(i, r) : i = L(void 0, r), !i) return;
|
|
155
|
+
let l = pe(), f = {
|
|
156
|
+
accessToken: O(),
|
|
157
|
+
workspaceToken: A(),
|
|
158
|
+
userId: j,
|
|
159
|
+
organizationId: me()
|
|
162
160
|
}, p = {
|
|
163
|
-
id:
|
|
161
|
+
id: fe(),
|
|
164
162
|
role: "user",
|
|
165
163
|
content: t,
|
|
166
164
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
167
165
|
};
|
|
168
166
|
R(i, p);
|
|
169
|
-
let
|
|
167
|
+
let h = fe();
|
|
170
168
|
R(i, {
|
|
171
|
-
id:
|
|
169
|
+
id: h,
|
|
172
170
|
role: "assistant",
|
|
173
171
|
content: "",
|
|
174
172
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
175
173
|
});
|
|
176
|
-
let
|
|
177
|
-
B(i,
|
|
178
|
-
content:
|
|
174
|
+
let g = (e, t, n, a) => {
|
|
175
|
+
B(i, h, {
|
|
176
|
+
content: T(e),
|
|
179
177
|
metadata: t?.length || n || a ? {
|
|
180
178
|
artifacts: t,
|
|
181
179
|
mode: r,
|
|
@@ -183,74 +181,77 @@ var D = ({ messagesExpanded: C = !1 }) => {
|
|
|
183
181
|
sandboxId: a
|
|
184
182
|
} : void 0
|
|
185
183
|
});
|
|
186
|
-
},
|
|
184
|
+
}, _ = async (e = 1) => {
|
|
187
185
|
try {
|
|
188
|
-
await n(
|
|
186
|
+
await n(D, l, f);
|
|
189
187
|
} catch (e) {
|
|
190
|
-
if (
|
|
191
|
-
|
|
188
|
+
if (y(e)) {
|
|
189
|
+
b("ai-credits"), g("You've run out of AI credits for this billing cycle. Upgrade your plan to keep chatting."), V(i, "error", h, null);
|
|
192
190
|
return;
|
|
193
191
|
}
|
|
194
192
|
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);
|
|
195
193
|
}
|
|
196
194
|
try {
|
|
197
|
-
let { sandboxId: e, sessionId: n } = await
|
|
198
|
-
|
|
199
|
-
let p =
|
|
200
|
-
for (; Date.now() <
|
|
195
|
+
let { sandboxId: e, sessionId: n } = await De(i, h, r, l, f), o = (await c(D, e, l, n, f, 50).catch(() => [])).reduce((e, t) => Math.max(e, E(t)), 0);
|
|
196
|
+
X(i, h, "streaming", "Thinking..."), await d(D, e, l, n, re(r, t), r, m(), f);
|
|
197
|
+
let p = k([], o), _ = Date.now() + (ue[r] ?? de), v = Date.now();
|
|
198
|
+
for (; Date.now() < _ && (p = k(await c(D, e, l, n, f, 50), o), B(i, h, { content: T(p.content) }), !p.done);) Date.now() - v > 3e4 && (await a(D, e, l, 600, f).catch(() => void 0), v = Date.now()), await new Promise((e) => setTimeout(e, 1500));
|
|
201
199
|
if (!p.done && r !== "vibe-plugins") throw Error("Assistant response timed out while streaming progress");
|
|
202
|
-
let
|
|
200
|
+
let ee = r === "vibe-plugins" ? await s(D, e, l, n, f).catch(() => []) : void 0;
|
|
203
201
|
if (p.done || (p = {
|
|
204
202
|
...p,
|
|
205
203
|
content: `${p.content}\n\n_Still building in the background — any artifacts below will finish shortly. Re-open this conversation to pick up the completed plugin._`
|
|
206
|
-
}),
|
|
207
|
-
B(i,
|
|
204
|
+
}), g(p.content, ee, n, e), p.tokens) {
|
|
205
|
+
B(i, h, { tokens: p.tokens });
|
|
208
206
|
try {
|
|
209
|
-
await u(
|
|
207
|
+
await u(D, l, n, p.tokens, f), ne();
|
|
210
208
|
} catch {}
|
|
211
209
|
}
|
|
212
|
-
V(i, "complete",
|
|
210
|
+
V(i, "complete", h, null);
|
|
213
211
|
} catch (t) {
|
|
214
|
-
if (e === 1 &&
|
|
212
|
+
if (e === 1 && he(t)) return U(i), be(r), _(2);
|
|
215
213
|
throw t;
|
|
216
214
|
}
|
|
217
215
|
};
|
|
218
216
|
try {
|
|
219
217
|
if (!l) throw Error("Assistant backend is unavailable without an active workspace context.");
|
|
220
|
-
await
|
|
218
|
+
await _();
|
|
221
219
|
} catch (e) {
|
|
222
|
-
if (
|
|
223
|
-
|
|
220
|
+
if (y(e)) {
|
|
221
|
+
b("sandbox"), g("You've reached your sandbox limit on the current plan. Upgrade to start the AI assistant."), V(i, "error", h, null);
|
|
224
222
|
return;
|
|
225
223
|
}
|
|
226
224
|
let t = e instanceof Error ? e.message : "Something went wrong";
|
|
227
|
-
V(i, "error",
|
|
225
|
+
V(i, "error", h, t), z(i, h, `Sorry, an error occurred: ${t}. Please try again.`);
|
|
228
226
|
}
|
|
229
227
|
}, [
|
|
230
|
-
|
|
228
|
+
M,
|
|
231
229
|
R,
|
|
232
|
-
|
|
230
|
+
D,
|
|
233
231
|
U,
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
be,
|
|
233
|
+
_e,
|
|
236
234
|
L,
|
|
237
|
-
|
|
238
|
-
D,
|
|
235
|
+
De,
|
|
239
236
|
O,
|
|
237
|
+
A,
|
|
240
238
|
B,
|
|
241
|
-
|
|
239
|
+
P,
|
|
242
240
|
H,
|
|
243
|
-
|
|
241
|
+
I,
|
|
244
242
|
V,
|
|
245
|
-
|
|
243
|
+
X,
|
|
246
244
|
z,
|
|
247
|
-
|
|
248
|
-
]),
|
|
245
|
+
j
|
|
246
|
+
]), Oe = x((e) => {
|
|
249
247
|
Z(e);
|
|
250
|
-
}, [Z]),
|
|
251
|
-
|
|
248
|
+
}, [Z]), ke = x(() => {
|
|
249
|
+
let e = [...G].reverse().find((e) => e.role === "user");
|
|
250
|
+
e && Z(e.content);
|
|
251
|
+
}, [G, Z]), Q = ae(Z);
|
|
252
|
+
S(() => {
|
|
252
253
|
Q.current = Z;
|
|
253
|
-
}, [Z]),
|
|
254
|
+
}, [Z]), S(() => {
|
|
254
255
|
let t = e.getState().consumePendingPrompt();
|
|
255
256
|
return t && Q.current(t), e.subscribe((t, n) => {
|
|
256
257
|
if (t.pendingPrompt && t.pendingPrompt !== n.pendingPrompt) {
|
|
@@ -259,86 +260,69 @@ var D = ({ messagesExpanded: C = !1 }) => {
|
|
|
259
260
|
}
|
|
260
261
|
});
|
|
261
262
|
}, []);
|
|
262
|
-
let $ =
|
|
263
|
-
let n =
|
|
263
|
+
let $ = x((t) => {
|
|
264
|
+
let n = M ? e.getState().conversations.find((e) => e.id === M) : void 0;
|
|
264
265
|
if (n && (n.messages.length > 0 || n.backendSessionId)) {
|
|
265
266
|
if (n.mode !== t) {
|
|
266
267
|
let n = e.getState().conversations.find((n) => n.mode === t && n.messages.length === 0 && !n.backendSessionId && !e.getState().processingByConversationId[n.id]);
|
|
267
|
-
n ?
|
|
268
|
+
n ? ve(n.id) : L(void 0, t);
|
|
268
269
|
}
|
|
269
|
-
} else
|
|
270
|
-
|
|
270
|
+
} else M && I(M, t);
|
|
271
|
+
F(t);
|
|
271
272
|
}, [
|
|
272
|
-
|
|
273
|
+
M,
|
|
273
274
|
L,
|
|
275
|
+
ve,
|
|
274
276
|
I,
|
|
275
|
-
F
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
J(t);
|
|
277
|
+
F
|
|
278
|
+
]), Ae = x((t) => {
|
|
279
|
+
if (_.find((e) => e.id === t)?.writeCapable && !e.getState().apiCallsAcknowledged) {
|
|
280
|
+
Y(t);
|
|
280
281
|
return;
|
|
281
282
|
}
|
|
282
283
|
$(t);
|
|
283
|
-
}, [$]),
|
|
284
|
-
let e =
|
|
285
|
-
|
|
284
|
+
}, [$]), je = x(() => {
|
|
285
|
+
let e = J;
|
|
286
|
+
Y(null), xe(), e && $(e);
|
|
286
287
|
}, [
|
|
287
|
-
|
|
288
|
-
|
|
288
|
+
J,
|
|
289
|
+
xe,
|
|
289
290
|
$
|
|
290
|
-
]),
|
|
291
|
-
|
|
291
|
+
]), Me = x(() => {
|
|
292
|
+
Y(null);
|
|
292
293
|
}, []);
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
className: "flex flex-
|
|
294
|
+
return /* @__PURE__ */ se("div", {
|
|
295
|
+
className: "flex flex-1 flex-col overflow-hidden",
|
|
295
296
|
children: [
|
|
296
|
-
|
|
297
|
-
mode:
|
|
298
|
-
onSuggestionClick:
|
|
299
|
-
}) : /* @__PURE__ */
|
|
300
|
-
className:
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
children: /* @__PURE__ */ x("div", {
|
|
307
|
-
className: "flex h-full flex-col",
|
|
308
|
-
children: /* @__PURE__ */ x(h, {
|
|
309
|
-
messages: Ee,
|
|
310
|
-
streamingMessageId: De,
|
|
311
|
-
expanded: C
|
|
312
|
-
})
|
|
313
|
-
})
|
|
297
|
+
G.length === 0 ? /* @__PURE__ */ C(v, {
|
|
298
|
+
mode: N,
|
|
299
|
+
onSuggestionClick: Oe
|
|
300
|
+
}) : /* @__PURE__ */ C("div", {
|
|
301
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
302
|
+
children: /* @__PURE__ */ C(h, {
|
|
303
|
+
messages: G,
|
|
304
|
+
streamingMessageId: Se,
|
|
305
|
+
failedMessageId: we,
|
|
306
|
+
onRetry: ke
|
|
314
307
|
})
|
|
315
|
-
}),
|
|
316
|
-
/* @__PURE__ */
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ C(ee, {
|
|
317
310
|
onSend: (e) => void Z(e),
|
|
318
|
-
disabled:
|
|
319
|
-
placeholder:
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
className: "flex size-7 flex-shrink-0 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-bg-elevated hover:text-text-primary",
|
|
324
|
-
"aria-label": T("healthybowl.assistant.chatArea.newConversation", "New conversation"),
|
|
325
|
-
"data-testid": "composer-new-conversation",
|
|
326
|
-
children: /* @__PURE__ */ x(ue, { className: "size-4" })
|
|
327
|
-
}), /* @__PURE__ */ x(_, {
|
|
328
|
-
mode: M,
|
|
329
|
-
availableModes: Ae,
|
|
330
|
-
onModeChange: Me
|
|
331
|
-
})] })
|
|
311
|
+
disabled: Ce,
|
|
312
|
+
placeholder: N === "api-calls" ? w("healthybowl.assistant.chatArea.placeholderActions", "What would you like me to do?") : w("healthybowl.assistant.chatArea.placeholderGeneral", "Ask HealthyBowl anything…"),
|
|
313
|
+
mode: N,
|
|
314
|
+
availableModes: Ee,
|
|
315
|
+
onModeChange: Ae
|
|
332
316
|
}),
|
|
333
|
-
/* @__PURE__ */
|
|
334
|
-
open:
|
|
335
|
-
onConfirm:
|
|
336
|
-
onCancel:
|
|
317
|
+
/* @__PURE__ */ C(g, {
|
|
318
|
+
open: J !== null,
|
|
319
|
+
onConfirm: je,
|
|
320
|
+
onCancel: Me
|
|
337
321
|
})
|
|
338
322
|
]
|
|
339
323
|
});
|
|
340
324
|
};
|
|
341
325
|
//#endregion
|
|
342
|
-
export {
|
|
326
|
+
export { A as AssistantChatArea };
|
|
343
327
|
|
|
344
328
|
//# sourceMappingURL=AssistantChatArea.js.map
|