@burdenoff/fe-libs 2026.910.4 → 2026.910.6
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/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/index.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +11 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AIAssistantPanel.js +50 -46
- package/dist/shared/assistant/ui/AssistantChatArea.js +358 -358
- package/dist/shared/assistant/ui/AssistantConversationList.js +16 -16
- package/dist/shared/assistant/ui/AssistantLanguageMenu.js +6 -6
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +21 -7
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts.map +1 -1
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.js +47 -37
- package/dist/shared/assistant/ui/AssistantMessageItem.js +16 -16
- package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.js +5 -5
- package/dist/shared/assistant/ui/AssistantSpeechProvider.js +151 -151
- package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.d.ts.map +1 -1
- package/dist/shared/assistant/ui/composer/AssistantAttachmentButton.js +50 -47
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +6 -6
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts +7 -0
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts.map +1 -0
- package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +52 -0
- package/dist/shared/assistant/ui/composer/AssistantLanguageSelector.js +4 -4
- package/dist/shared/assistant/ui/composer/connectSource.d.ts +8 -0
- package/dist/shared/assistant/ui/composer/connectSource.d.ts.map +1 -0
- package/dist/shared/assistant/ui/composer/connectSource.js +12 -0
- package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +48 -48
- package/dist/shared/assistant/ui/voice/VoiceConversationView.js +8 -8
- package/dist/shared/components/assistantWidget/MessageContent.d.ts +11 -3
- package/dist/shared/components/assistantWidget/MessageContent.d.ts.map +1 -1
- package/dist/shared/components/assistantWidget/MessageContent.js +26 -27
- package/dist/shared-assistant.js +95 -93
- package/package.json +2 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useAssistantTr as e } from "../../i18n.js";
|
|
2
|
+
import { assistantRoutePath as t, classifyAssistantHref as n, useAssistantNavigate as r } from "../AssistantMarkdownRenderer.js";
|
|
3
|
+
import { useAssistantConnectSource as i } from "./connectSource.js";
|
|
4
|
+
import { useCallback as a } from "react";
|
|
5
|
+
import { Link2 as o } from "lucide-react";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
//#region src/shared/assistant/ui/composer/AssistantConnectSourceItem.tsx
|
|
8
|
+
function l(e, t) {
|
|
9
|
+
let n = (e ?? "").trim();
|
|
10
|
+
if (!n) return !1;
|
|
11
|
+
let r = t;
|
|
12
|
+
if (!r) try {
|
|
13
|
+
r = typeof window > "u" ? void 0 : window.location.origin;
|
|
14
|
+
} catch {
|
|
15
|
+
r = void 0;
|
|
16
|
+
}
|
|
17
|
+
if (!r) return !1;
|
|
18
|
+
try {
|
|
19
|
+
let { protocol: e } = new URL(n, r);
|
|
20
|
+
return e === "https:" || e === "http:";
|
|
21
|
+
} catch {
|
|
22
|
+
return !1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
var u = ({ onActivate: u }) => {
|
|
26
|
+
let d = e(), f = i(), p = r(), m = n(f), h = m === "internal" ? t(f) : null, g = m === "external" && l(f), _ = a((e) => {
|
|
27
|
+
e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || (u?.(), !(!p || !h) && (e.preventDefault(), p(h)));
|
|
28
|
+
}, [
|
|
29
|
+
p,
|
|
30
|
+
h,
|
|
31
|
+
u
|
|
32
|
+
]);
|
|
33
|
+
if (!f || m === "blocked" || !h && !g) return null;
|
|
34
|
+
let v = d("composer.connectSource", "Connect a source");
|
|
35
|
+
return /* @__PURE__ */ c("a", {
|
|
36
|
+
href: f,
|
|
37
|
+
role: "menuitem",
|
|
38
|
+
onClick: _,
|
|
39
|
+
...g ? {
|
|
40
|
+
target: "_blank",
|
|
41
|
+
rel: "noopener noreferrer"
|
|
42
|
+
} : {},
|
|
43
|
+
className: "flex w-full items-center gap-2.5 border-t border-border-subtle px-3 py-2 text-left text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken",
|
|
44
|
+
"data-testid": "assistant-connect-source",
|
|
45
|
+
children: [/* @__PURE__ */ s(o, {
|
|
46
|
+
className: "size-4 flex-shrink-0 text-text-secondary",
|
|
47
|
+
"aria-hidden": "true"
|
|
48
|
+
}), v]
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { u as AssistantConnectSourceItem };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useAssistantTr as e } from "../../i18n.js";
|
|
2
|
+
import { ASSISTANT_LANGUAGES as t } from "../../voice/languages.js";
|
|
3
3
|
import { Languages as n } from "lucide-react";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/shared/assistant/ui/composer/AssistantLanguageSelector.tsx
|
|
6
6
|
var a = ({ current: a, selected: s, onChange: c, disabled: l = !1 }) => {
|
|
7
|
-
let u =
|
|
7
|
+
let u = e(), d = u("voice.languageLabel", "Language you speak to the assistant");
|
|
8
8
|
return /* @__PURE__ */ i("label", {
|
|
9
9
|
className: `relative flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] transition-colors focus-within:ring-2 focus-within:ring-border-strong ${l ? "cursor-not-allowed opacity-50" : "cursor-pointer text-text-muted hover:bg-bg-elevated hover:text-text-secondary"}`,
|
|
10
10
|
title: `${d}: ${a.label}`,
|
|
@@ -30,7 +30,7 @@ var a = ({ current: a, selected: s, onChange: c, disabled: l = !1 }) => {
|
|
|
30
30
|
children: [/* @__PURE__ */ r("option", {
|
|
31
31
|
value: o,
|
|
32
32
|
children: u("voice.languageFollowApp", "Same as interface")
|
|
33
|
-
}),
|
|
33
|
+
}), t.map((e) => /* @__PURE__ */ r("option", {
|
|
34
34
|
value: e.code,
|
|
35
35
|
children: e.label
|
|
36
36
|
}, e.code))]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
export declare const AssistantConnectSourceProvider: FC<{
|
|
3
|
+
value?: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
/** The product's connections href, or null when the product supplied none. */
|
|
7
|
+
export declare function useAssistantConnectSource(): string | null;
|
|
8
|
+
//# sourceMappingURL=connectSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectSource.d.ts","sourceRoot":"","sources":["../../../../../src/shared/assistant/ui/composer/connectSource.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAA6B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI3E,eAAO,MAAM,8BAA8B,EAAE,EAAE,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB,CAIA,CAAC;AAEF,8EAA8E;AAC9E,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAEzD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "react";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/shared/assistant/ui/composer/connectSource.tsx
|
|
4
|
+
var r = e(null), i = ({ value: e, children: t }) => /* @__PURE__ */ n(r.Provider, {
|
|
5
|
+
value: e ?? null,
|
|
6
|
+
children: t
|
|
7
|
+
});
|
|
8
|
+
function a() {
|
|
9
|
+
return t(r);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { i as AssistantConnectSourceProvider, a as useAssistantConnectSource };
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useAssistantTr as e } from "../../i18n.js";
|
|
2
|
+
import { micIsInterrupt as t, showsAssistantCaption as n, voiceStageState as r } from "../../voice/voiceStageState.js";
|
|
3
|
+
import { spokenSoFar as i } from "../../voice/voiceSession.js";
|
|
4
4
|
import { AssistantAttachmentButton as ee } from "../composer/AssistantAttachmentButton.js";
|
|
5
5
|
import { AssistantAttachmentChips as a } from "../composer/AssistantAttachmentChips.js";
|
|
6
|
-
import { AssistantVoiceOrb as
|
|
7
|
-
import { VoiceMiniController as
|
|
8
|
-
import { VoiceStage as
|
|
9
|
-
import { VoiceTranscriptDrawer as
|
|
10
|
-
import { useCallback as
|
|
11
|
-
import { Maximize2 as
|
|
6
|
+
import { AssistantVoiceOrb as o } from "./AssistantVoiceOrb.js";
|
|
7
|
+
import { VoiceMiniController as s } from "./VoiceMiniController.js";
|
|
8
|
+
import { VoiceStage as c } from "./VoiceStage.js";
|
|
9
|
+
import { VoiceTranscriptDrawer as te } from "./VoiceTranscriptDrawer.js";
|
|
10
|
+
import { useCallback as ne, useEffect as l, useRef as u, useState as d } from "react";
|
|
11
|
+
import { Maximize2 as f, Minimize2 as p, ScrollText as m, X as re } from "lucide-react";
|
|
12
12
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
13
13
|
//#region src/shared/assistant/ui/voice/AssistantVoiceSession.tsx
|
|
14
|
-
var _ = ({ session: _, turns: b = [], onSaveTranscript:
|
|
15
|
-
let F =
|
|
16
|
-
J.current =
|
|
17
|
-
let se =
|
|
18
|
-
I || q.current ||
|
|
14
|
+
var _ = ({ session: _, turns: b = [], onSaveTranscript: x, onContinueInChat: S, notice: C = null, spoken: w, onInterrupt: T, onToggleMute: E, attachments: D = [], onAttachFiles: O, onRemoveAttachment: k, onRetryAttachment: ie, canAttachMore: ae = !0, preparingAttachments: A = 0, spokenChunks: j = null, onEnd: M, capturing: oe = !0, interrupting: N = !1, awaitingEndpoint: P = !1 }) => {
|
|
15
|
+
let F = e(), { muted: I, error: L } = _, R = u(null), z = u(null), [B, V] = d("mini"), H = B === "full", U = B === "mini", W = B === "mini" ? "panel" : B === "panel" ? "full" : "mini", [G, K] = d(!1), q = u(!1), J = u(E);
|
|
16
|
+
J.current = E;
|
|
17
|
+
let se = ne(() => {
|
|
18
|
+
I || q.current || i(_) || (q.current = !0, J.current());
|
|
19
19
|
}, [I, _]);
|
|
20
|
-
|
|
20
|
+
l(() => {
|
|
21
21
|
let e = () => {
|
|
22
22
|
q.current && (q.current = !1, J.current());
|
|
23
23
|
};
|
|
24
24
|
return window.addEventListener("focus", e), () => {
|
|
25
25
|
window.removeEventListener("focus", e), q.current = !1;
|
|
26
26
|
};
|
|
27
|
-
}, []),
|
|
27
|
+
}, []), l(() => {
|
|
28
28
|
R.current?.focus();
|
|
29
|
-
}, []),
|
|
29
|
+
}, []), l(() => {
|
|
30
30
|
let e = (e) => {
|
|
31
31
|
if (e.key === "Escape") {
|
|
32
32
|
if (G) {
|
|
33
33
|
K(!1);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
M();
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (e.key !== "Tab" || !H) return;
|
|
@@ -44,13 +44,13 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
|
|
|
44
44
|
};
|
|
45
45
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
46
46
|
}, [
|
|
47
|
-
|
|
47
|
+
M,
|
|
48
48
|
H,
|
|
49
49
|
G
|
|
50
50
|
]);
|
|
51
|
-
let Y =
|
|
51
|
+
let Y = C !== null && L === null, X = i(_), Z = r({
|
|
52
52
|
snapshot: _,
|
|
53
|
-
capturing:
|
|
53
|
+
capturing: oe,
|
|
54
54
|
interrupting: N,
|
|
55
55
|
awaitingEndpoint: P
|
|
56
56
|
}), Q = (() => {
|
|
@@ -77,11 +77,11 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
|
|
|
77
77
|
/* @__PURE__ */ g("button", {
|
|
78
78
|
ref: R,
|
|
79
79
|
type: "button",
|
|
80
|
-
onClick:
|
|
80
|
+
onClick: M,
|
|
81
81
|
className: `absolute ${H ? "right-6 top-6 h-14 gap-2 px-5 text-base" : U ? "right-12 top-2 h-8 gap-1.5 px-2.5 text-xs" : "right-3 top-3 h-11 gap-2 px-4 text-sm"} flex items-center justify-center rounded-full border border-border-default bg-bg-elevated text-text-secondary hover:bg-bg-sunken transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
82
82
|
title: F("voiceSession.end", "End the voice conversation"),
|
|
83
83
|
"data-testid": "assistant-voice-end",
|
|
84
|
-
children: [/* @__PURE__ */ h(
|
|
84
|
+
children: [/* @__PURE__ */ h(re, {
|
|
85
85
|
className: H ? "size-6" : U ? "size-4" : "size-5",
|
|
86
86
|
"aria-hidden": "true"
|
|
87
87
|
}), /* @__PURE__ */ h("span", {
|
|
@@ -94,60 +94,60 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
|
|
|
94
94
|
children: Y ? /* @__PURE__ */ h("p", {
|
|
95
95
|
className: "max-w-xs text-center text-xs text-status-warning",
|
|
96
96
|
"data-testid": "assistant-voice-notice",
|
|
97
|
-
children: v(
|
|
97
|
+
children: v(C, F)
|
|
98
98
|
}) : null
|
|
99
99
|
}),
|
|
100
100
|
(() => {
|
|
101
|
-
let
|
|
101
|
+
let e = /* @__PURE__ */ h(o, {
|
|
102
102
|
session: _,
|
|
103
103
|
compact: U,
|
|
104
104
|
connecting: Z === "connecting",
|
|
105
|
-
onPress:
|
|
106
|
-
label:
|
|
107
|
-
}), r =
|
|
108
|
-
return U ? /* @__PURE__ */ h(
|
|
109
|
-
spokenChunks:
|
|
105
|
+
onPress: t(Z) ? T : E,
|
|
106
|
+
label: t(Z) ? F("voiceSession.interrupt", "Stop the assistant and speak") : I ? F("voiceSession.unmute", "Turn the microphone on") : F("voiceSession.mute", "Turn the microphone off")
|
|
107
|
+
}), r = n(Z) ? w : X || null, i = L === null ? null : y(L, F);
|
|
108
|
+
return U ? /* @__PURE__ */ h(s, {
|
|
109
|
+
spokenChunks: j,
|
|
110
110
|
state: Z,
|
|
111
111
|
caption: r,
|
|
112
112
|
statusText: $,
|
|
113
113
|
errorText: i,
|
|
114
|
-
control:
|
|
115
|
-
}) : /* @__PURE__ */ h(
|
|
114
|
+
control: e
|
|
115
|
+
}) : /* @__PURE__ */ h(c, {
|
|
116
116
|
state: Z,
|
|
117
117
|
userCaption: X || null,
|
|
118
|
-
spokenChunks:
|
|
119
|
-
assistantCaption:
|
|
118
|
+
spokenChunks: j,
|
|
119
|
+
assistantCaption: w,
|
|
120
120
|
expanded: H,
|
|
121
121
|
statusText: $,
|
|
122
122
|
errorText: i,
|
|
123
|
-
control:
|
|
123
|
+
control: e
|
|
124
124
|
});
|
|
125
125
|
})(),
|
|
126
|
-
G ? /* @__PURE__ */ h(
|
|
126
|
+
G ? /* @__PURE__ */ h(te, {
|
|
127
127
|
turns: b,
|
|
128
128
|
onClose: () => K(!1),
|
|
129
|
-
onSave:
|
|
130
|
-
onContinueInChat:
|
|
129
|
+
onSave: x,
|
|
130
|
+
onContinueInChat: S
|
|
131
131
|
}) : null,
|
|
132
|
-
|
|
132
|
+
O ? /* @__PURE__ */ h("div", {
|
|
133
133
|
className: `absolute ${H ? "left-6 top-6" : U ? "left-11 top-2" : "left-3 top-3"}`,
|
|
134
134
|
children: /* @__PURE__ */ h(ee, {
|
|
135
135
|
onFiles: (e) => {
|
|
136
|
-
|
|
136
|
+
O(e), V((e) => e === "mini" ? "panel" : e);
|
|
137
137
|
},
|
|
138
138
|
onPickerOpen: se,
|
|
139
139
|
direction: "down",
|
|
140
|
-
canAddMore:
|
|
140
|
+
canAddMore: ae
|
|
141
141
|
})
|
|
142
142
|
}) : null,
|
|
143
|
-
(
|
|
143
|
+
(D.length > 0 || A > 0) && !U ? /* @__PURE__ */ h("div", {
|
|
144
144
|
className: `absolute ${H ? "bottom-24 left-24 right-24" : "bottom-16 left-16 right-16"}`,
|
|
145
145
|
"data-testid": "assistant-voice-attachments",
|
|
146
146
|
children: /* @__PURE__ */ h(a, {
|
|
147
|
-
attachments:
|
|
148
|
-
onRemove:
|
|
149
|
-
onRetry:
|
|
150
|
-
preparingCount:
|
|
147
|
+
attachments: D,
|
|
148
|
+
onRemove: k ?? (() => void 0),
|
|
149
|
+
onRetry: ie ?? (() => void 0),
|
|
150
|
+
preparingCount: A
|
|
151
151
|
})
|
|
152
152
|
}) : null,
|
|
153
153
|
/* @__PURE__ */ h("button", {
|
|
@@ -157,7 +157,7 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
|
|
|
157
157
|
"aria-pressed": G,
|
|
158
158
|
"aria-label": F("voiceSession.transcript", "Voice transcript"),
|
|
159
159
|
"data-testid": "assistant-voice-transcript-toggle",
|
|
160
|
-
children: /* @__PURE__ */ h(
|
|
160
|
+
children: /* @__PURE__ */ h(m, { className: H ? "size-6" : U ? "size-4" : "size-5" })
|
|
161
161
|
}),
|
|
162
162
|
/* @__PURE__ */ h("button", {
|
|
163
163
|
type: "button",
|
|
@@ -165,7 +165,7 @@ var _ = ({ session: _, turns: b = [], onSaveTranscript: ie, onContinueInChat: ae
|
|
|
165
165
|
className: `absolute ${H ? "bottom-6 left-6 size-14" : U ? "left-2 top-2 size-8" : "bottom-3 left-3 size-11"} flex items-center justify-center rounded-full bg-bg-elevated text-text-secondary transition-colors hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong`,
|
|
166
166
|
"aria-label": W === "panel" ? F("voiceSession.expandPanel", "Show the conversation in the panel") : W === "full" ? F("voiceSession.expand", "Expand the conversation to full screen") : F("voiceSession.collapse", "Shrink to the compact controller"),
|
|
167
167
|
"data-testid": "assistant-voice-expand",
|
|
168
|
-
children: H ? /* @__PURE__ */ h(
|
|
168
|
+
children: H ? /* @__PURE__ */ h(p, { className: "size-5" }) : /* @__PURE__ */ h(f, { className: U ? "size-4" : "size-5" })
|
|
169
169
|
})
|
|
170
170
|
]
|
|
171
171
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { useAssistantTr as e } from "../../i18n.js";
|
|
2
|
+
import { AssistantMarkdownRenderer as t } from "../AssistantMarkdownRenderer.js";
|
|
3
|
+
import { groupConsecutiveBySession as n } from "../../voice/turnVisibility.js";
|
|
4
4
|
import { useMemo as r } from "react";
|
|
5
5
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
6
|
//#region src/shared/assistant/ui/voice/VoiceConversationView.tsx
|
|
7
7
|
var o = ({ turns: o }) => {
|
|
8
|
-
let s =
|
|
8
|
+
let s = e(), c = r(() => n(o, (e) => e.sessionId), [o]);
|
|
9
9
|
return o.length === 0 ? /* @__PURE__ */ i("div", {
|
|
10
10
|
className: "flex flex-1 items-center justify-center px-6",
|
|
11
11
|
children: /* @__PURE__ */ i("p", {
|
|
@@ -15,9 +15,9 @@ var o = ({ turns: o }) => {
|
|
|
15
15
|
}) : /* @__PURE__ */ i("div", {
|
|
16
16
|
className: "flex-1 overflow-y-auto px-4 py-4",
|
|
17
17
|
"data-testid": "assistant-voice-conversation",
|
|
18
|
-
children: c.map((e,
|
|
18
|
+
children: c.map((e, n) => /* @__PURE__ */ a("section", {
|
|
19
19
|
className: "space-y-4 pb-4",
|
|
20
|
-
children: [
|
|
20
|
+
children: [n > 0 ? /* @__PURE__ */ a("div", {
|
|
21
21
|
className: "flex items-center gap-2 pt-2",
|
|
22
22
|
role: "separator",
|
|
23
23
|
children: [
|
|
@@ -36,9 +36,9 @@ var o = ({ turns: o }) => {
|
|
|
36
36
|
})
|
|
37
37
|
}, e.id) : /* @__PURE__ */ i("div", {
|
|
38
38
|
className: "text-sm leading-relaxed text-text-secondary",
|
|
39
|
-
children: /* @__PURE__ */ i(
|
|
39
|
+
children: /* @__PURE__ */ i(t, { content: e.text })
|
|
40
40
|
}, e.id))]
|
|
41
|
-
}, `${e.sessionId ?? "earlier"}-${
|
|
41
|
+
}, `${e.sessionId ?? "earlier"}-${n}`))
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
//#endregion
|
|
@@ -2,10 +2,18 @@ import { FC } from 'react';
|
|
|
2
2
|
export interface MessageContentProps {
|
|
3
3
|
content: string;
|
|
4
4
|
/**
|
|
5
|
-
* Called for in-app
|
|
6
|
-
*
|
|
5
|
+
* Called for in-app links so the host can route without a full page reload.
|
|
6
|
+
* When omitted, in-app links fall back to a normal anchor.
|
|
7
|
+
*
|
|
8
|
+
* ★ Receives a router-ready PATH (`/fields?crop=42#yield`), already resolved
|
|
9
|
+
* and proven same-origin — NOT the raw href. It used to receive the href, and
|
|
10
|
+
* an absolute same-origin URL (`https://app.example.com/fields`, which is
|
|
11
|
+
* `internal`) then reached the router as a string it reads as a path, landing
|
|
12
|
+
* on a literal `/https:/app.example.com/fields` segment. Both shells that pass
|
|
13
|
+
* this do `onNavigate={(href) => navigate(href)}`, so a path is what they
|
|
14
|
+
* needed all along.
|
|
7
15
|
*/
|
|
8
|
-
onNavigate?: (
|
|
16
|
+
onNavigate?: (path: string) => void;
|
|
9
17
|
}
|
|
10
18
|
export declare const MessageContent: FC<MessageContentProps>;
|
|
11
19
|
//# sourceMappingURL=MessageContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/MessageContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageContent.d.ts","sourceRoot":"","sources":["../../../../src/shared/components/assistantWidget/MessageContent.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAwC1D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA2DlD,CAAC"}
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fragment as
|
|
1
|
+
import { assistantRoutePath as e, browserShouldHandle as t, classifyAssistantHref as n } from "../../assistant/ui/AssistantMarkdownRenderer.js";
|
|
2
|
+
import { Fragment as r } from "react";
|
|
3
|
+
import { Fragment as i, jsx as a } from "react/jsx-runtime";
|
|
3
4
|
//#region src/shared/components/assistantWidget/MessageContent.tsx
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
return e.startsWith("
|
|
5
|
+
var o = /\[([^\]]+)\]\(([^)\s]+)\)/g;
|
|
6
|
+
function s(e) {
|
|
7
|
+
return e.startsWith("https://");
|
|
7
8
|
}
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
for (let
|
|
11
|
-
let [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} else s.push(/* @__PURE__ */ n(e, { children: l ?? r }, `u${String(d)}`));
|
|
27
|
-
c = d + r.length;
|
|
9
|
+
var c = ({ content: c, onNavigate: l }) => {
|
|
10
|
+
let u = [], d = 0, f = new RegExp(o.source, "g");
|
|
11
|
+
for (let i of c.matchAll(f)) {
|
|
12
|
+
let [o, f, p] = i, m = i.index ?? 0;
|
|
13
|
+
m > d && u.push(/* @__PURE__ */ a(r, { children: c.slice(d, m) }, `t${String(d)}`));
|
|
14
|
+
let h = p ? n(p) : "blocked", g = h === "internal" ? e(p) : null, _ = h === "external" && s(p);
|
|
15
|
+
f && p && (g || _) ? u.push(/* @__PURE__ */ a("a", {
|
|
16
|
+
href: g ?? p,
|
|
17
|
+
"data-testid": "assistant-message-link",
|
|
18
|
+
...g ? { onClick: l ? (e) => {
|
|
19
|
+
t(e) || (e.preventDefault(), l(g));
|
|
20
|
+
} : void 0 } : {
|
|
21
|
+
target: "_blank",
|
|
22
|
+
rel: "noopener noreferrer"
|
|
23
|
+
},
|
|
24
|
+
className: "font-medium text-action-primary-bg underline underline-offset-2 hover:opacity-80",
|
|
25
|
+
children: f
|
|
26
|
+
}, `l${String(m)}`)) : u.push(/* @__PURE__ */ a(r, { children: f ?? o }, `u${String(m)}`)), d = m + o.length;
|
|
28
27
|
}
|
|
29
|
-
return
|
|
28
|
+
return d < c.length && u.push(/* @__PURE__ */ a(r, { children: c.slice(d) }, `t${String(d)}`)), /* @__PURE__ */ a(i, { children: u });
|
|
30
29
|
};
|
|
31
30
|
//#endregion
|
|
32
|
-
export {
|
|
31
|
+
export { c as MessageContent };
|