@green-on-grey/ui-kit 1.8.0 → 1.9.0
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/chat/MessageView.d.ts +2 -0
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/types.d.ts +8 -0
- package/dist/chat.js +82 -56
- package/dist/chat.js.map +1 -1
- package/dist/locales/index.d.ts +20 -0
- package/dist/locales.js +20 -0
- package/dist/locales.js.map +1 -1
- package/dist/manifest.json +3 -1
- package/dist/styles.css +13 -0
- package/package.json +1 -1
|
@@ -13,3 +13,5 @@ export declare function MessageView({ m, busy, onRetry, loadAttachment, onOpenAt
|
|
|
13
13
|
loadAttachment?: LoadAttachment;
|
|
14
14
|
onOpenAttachment?: (a: ChatAttachment) => void;
|
|
15
15
|
}): import("react").JSX.Element;
|
|
16
|
+
/** A notice longer than this many lines is folded (FTR.NAB.CHAT-0002 design §3.1). */
|
|
17
|
+
export declare const NOTICE_LINES = 12;
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export { AgentButton, AgentMenu, type AgentModelOption, type AgentModels, type A
|
|
|
5
5
|
export { AgentSettingsMenu, agentModelKey, agentModelOptions, type AgentModel, type AgentModelChoice, type AgentModelState, } from "./AgentSettingsMenu";
|
|
6
6
|
export { CommandPalette } from "./CommandPalette";
|
|
7
7
|
export { ContextMeter, tokens } from "./ContextMeter";
|
|
8
|
-
export { MessageView } from "./MessageView";
|
|
8
|
+
export { MessageView, NOTICE_LINES } from "./MessageView";
|
|
9
9
|
export { useRecorder } from "./useRecorder";
|
|
10
10
|
export type { ChatAttachment, ChatCommand, ChatConfirmation, ChatContext, ChatConversation, ChatEvent, ChatMark, ChatMessage, ChatProps, ChatStep, ChatUpload, ChatWait, ConversationListProps, } from "./types";
|
package/dist/chat/types.d.ts
CHANGED
|
@@ -66,6 +66,9 @@ export interface ChatMessage {
|
|
|
66
66
|
};
|
|
67
67
|
/** The content of the product inside the message: a mail card, a digest. */
|
|
68
68
|
content?: ReactNode;
|
|
69
|
+
/** `notice`: an answer that is a notice of a product, not words of the agent (FTR.NAB.CHAT-0002 R2):
|
|
70
|
+
* a card with a stripe, without the actions of an answer, folded past `NOTICE_LINES` lines. */
|
|
71
|
+
variant?: "notice";
|
|
69
72
|
/** The tooltip of the bubble: the model of an answer (FTR.NAB.CHAT-0001 R18). */
|
|
70
73
|
hint?: string;
|
|
71
74
|
}
|
|
@@ -99,6 +102,11 @@ export interface ChatProps {
|
|
|
99
102
|
header?: ReactNode;
|
|
100
103
|
/** The second line of the empty conversation. */
|
|
101
104
|
emptyHint?: ReactNode;
|
|
105
|
+
/** Replaces the whole empty conversation: the draft of a topic with its suggestions
|
|
106
|
+
* (FTR.HMR.DISC-0001 design §3.2). `emptyHint` is then not used. */
|
|
107
|
+
empty?: ReactNode;
|
|
108
|
+
/** The placeholder of the composer instead of «Message to <agent>»; a picked skill keeps its own. */
|
|
109
|
+
placeholder?: string;
|
|
102
110
|
loading?: boolean;
|
|
103
111
|
historyError?: ReactNode;
|
|
104
112
|
hasOlder?: boolean;
|
package/dist/chat.js
CHANGED
|
@@ -584,7 +584,7 @@ function ie({ m: e, busy: n, onRetry: i, loadAttachment: a, onOpenAttachment: u
|
|
|
584
584
|
className: "sysnote",
|
|
585
585
|
children: e.text
|
|
586
586
|
});
|
|
587
|
-
if (e.role === "event" && e.event) return /* @__PURE__ */ c(
|
|
587
|
+
if (e.role === "event" && e.event) return /* @__PURE__ */ c(ae, { m: e });
|
|
588
588
|
let _ = e.mark && /* @__PURE__ */ l("div", {
|
|
589
589
|
className: "chan",
|
|
590
590
|
children: [
|
|
@@ -625,6 +625,11 @@ function ie({ m: e, busy: n, onRetry: i, loadAttachment: a, onOpenAttachment: u
|
|
|
625
625
|
})
|
|
626
626
|
]
|
|
627
627
|
});
|
|
628
|
+
if (e.variant === "notice") return /* @__PURE__ */ c(q, {
|
|
629
|
+
m: e,
|
|
630
|
+
mark: _,
|
|
631
|
+
atts: v
|
|
632
|
+
});
|
|
628
633
|
let y = e.steps ?? [], b = (e.status === "streaming" || e.status === "pending") && !e.text && !e.content;
|
|
629
634
|
return /* @__PURE__ */ l("div", {
|
|
630
635
|
className: "m a",
|
|
@@ -686,7 +691,28 @@ function ie({ m: e, busy: n, onRetry: i, loadAttachment: a, onOpenAttachment: u
|
|
|
686
691
|
]
|
|
687
692
|
});
|
|
688
693
|
}
|
|
689
|
-
|
|
694
|
+
var K = 12;
|
|
695
|
+
function q({ m: e, mark: t, atts: n }) {
|
|
696
|
+
let { t: i } = g(o), [a, s] = h(!1), u = !e.content && e.text.split("\n").length > 12;
|
|
697
|
+
return /* @__PURE__ */ l("div", {
|
|
698
|
+
className: "m a notice",
|
|
699
|
+
children: [
|
|
700
|
+
t,
|
|
701
|
+
e.content ?? /* @__PURE__ */ l("div", {
|
|
702
|
+
className: `bub${u && !a ? " folded" : ""}`,
|
|
703
|
+
children: [/* @__PURE__ */ c(r, { text: e.text }), u && /* @__PURE__ */ c("button", {
|
|
704
|
+
type: "button",
|
|
705
|
+
className: "textbtn",
|
|
706
|
+
"aria-expanded": a,
|
|
707
|
+
onClick: () => s((e) => !e),
|
|
708
|
+
children: i(a ? "chat.notice.less" : "chat.notice.more")
|
|
709
|
+
})]
|
|
710
|
+
}),
|
|
711
|
+
n
|
|
712
|
+
]
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
function ae({ m: e }) {
|
|
690
716
|
let { t: n, i18n: r } = g(o), [i, a] = h(!1), s = e.event;
|
|
691
717
|
return /* @__PURE__ */ l("div", {
|
|
692
718
|
className: "evdiv",
|
|
@@ -724,20 +750,20 @@ function K({ m: e }) {
|
|
|
724
750
|
}
|
|
725
751
|
//#endregion
|
|
726
752
|
//#region src/chat/transcription.ts
|
|
727
|
-
async function
|
|
753
|
+
async function oe(e, t, n) {
|
|
728
754
|
n.busy(!0);
|
|
729
755
|
let r;
|
|
730
756
|
try {
|
|
731
757
|
r = await t(e);
|
|
732
758
|
} catch (r) {
|
|
733
|
-
n.busy(!1), n.failed(r instanceof Error && r.message ? r.message : void 0, () => void
|
|
759
|
+
n.busy(!1), n.failed(r instanceof Error && r.message ? r.message : void 0, () => void oe(e, t, n));
|
|
734
760
|
return;
|
|
735
761
|
}
|
|
736
762
|
n.busy(!1), r !== null && (r ? n.text(r) : n.empty());
|
|
737
763
|
}
|
|
738
764
|
//#endregion
|
|
739
765
|
//#region src/chat/useRecorder.ts
|
|
740
|
-
function
|
|
766
|
+
function se(e = 300, t) {
|
|
741
767
|
let n = typeof window < "u" && "MediaRecorder" in window && !!navigator.mediaDevices?.getUserMedia, [r, i] = h(!1), [a, o] = h(0), [s, c] = h(0), [l, f] = h(!1), p = m(null), g = m([]), _ = m(void 0), v = m(null), y = m(null), b = m(!1), x = m(t);
|
|
742
768
|
d(() => {
|
|
743
769
|
x.current = t;
|
|
@@ -799,24 +825,24 @@ function oe(e = 300, t) {
|
|
|
799
825
|
cancel: T
|
|
800
826
|
};
|
|
801
827
|
}
|
|
802
|
-
function
|
|
828
|
+
function ce(e) {
|
|
803
829
|
return `${Math.floor(e / 60)}:${String(e % 60).padStart(2, "0")}`;
|
|
804
830
|
}
|
|
805
831
|
//#endregion
|
|
806
832
|
//#region src/chat/Chat.tsx
|
|
807
|
-
function
|
|
833
|
+
function le(n) {
|
|
808
834
|
let r = a(), i = e(), [o, u] = h(""), [g, y] = h([]), [b, S] = h(!1), [C, w] = h(null), [T, E] = h(0), [D, O] = h(!1), [k, A] = h(null), [j, ee] = h(!1), [M, N] = h(null), P = m(n.loadAttachment);
|
|
809
835
|
d(() => {
|
|
810
836
|
P.current = n.loadAttachment;
|
|
811
837
|
});
|
|
812
|
-
let F = !!n.loadAttachment, I = p(() => F ? (e) => P.current ? P.current(e) : Promise.reject(/* @__PURE__ */ Error("no loader")) : void 0, [F]), L = m(!1), R = m(null), z = m(null), B = m(null), V = n.voiceMaxSeconds ?? 300, H =
|
|
838
|
+
let F = !!n.loadAttachment, I = p(() => F ? (e) => P.current ? P.current(e) : Promise.reject(/* @__PURE__ */ Error("no loader")) : void 0, [F]), L = m(!1), R = m(null), z = m(null), B = m(null), V = n.voiceMaxSeconds ?? 300, H = se(V, () => void ve()), { messages: U, busy: W = !1 } = n, ne = W || U.some((e) => e.status === "pending" || e.status === "streaming"), re = n.onPendingChange;
|
|
813
839
|
d(() => re?.(g), [g, re]);
|
|
814
|
-
let G = U[0]?.id, K = U[U.length - 1], q = K?.id,
|
|
840
|
+
let G = U[0]?.id, K = U[U.length - 1], q = K?.id, ae = K?.text.length, le = K?.steps?.length, fe = m({ height: 0 });
|
|
815
841
|
f(() => {
|
|
816
842
|
let e = R.current;
|
|
817
843
|
if (!e) return;
|
|
818
|
-
let t =
|
|
819
|
-
e.scrollTop = t.first !== void 0 && G !== t.first && q === t.last ? e.scrollTop + (e.scrollHeight - t.height) : e.scrollHeight,
|
|
844
|
+
let t = fe.current;
|
|
845
|
+
e.scrollTop = t.first !== void 0 && G !== t.first && q === t.last ? e.scrollTop + (e.scrollHeight - t.height) : e.scrollHeight, fe.current = {
|
|
820
846
|
first: G,
|
|
821
847
|
last: q,
|
|
822
848
|
height: e.scrollHeight
|
|
@@ -825,32 +851,32 @@ function q(n) {
|
|
|
825
851
|
U.length,
|
|
826
852
|
G,
|
|
827
853
|
q,
|
|
828
|
-
|
|
829
|
-
|
|
854
|
+
ae,
|
|
855
|
+
le
|
|
830
856
|
]);
|
|
831
|
-
let J = n.commands && !C && o.startsWith("/") && !/\s/.test(o) ? o.slice(1) : null, Y = J === null ? [] : _(n.commands ?? [], J), X = J !== null && !D,
|
|
857
|
+
let J = n.commands && !C && o.startsWith("/") && !/\s/.test(o) ? o.slice(1) : null, Y = J === null ? [] : _(n.commands ?? [], J), X = J !== null && !D, he = () => {
|
|
832
858
|
u(""), y([]), w(null), A(null), L.current = !1;
|
|
833
|
-
},
|
|
859
|
+
}, Z = async (e, t) => {
|
|
834
860
|
if (n.onCommand) try {
|
|
835
|
-
await n.onCommand(e, t),
|
|
861
|
+
await n.onCommand(e, t), he();
|
|
836
862
|
} catch {}
|
|
837
|
-
},
|
|
863
|
+
}, Q = async (e, t = !1) => {
|
|
838
864
|
let r = e.trim();
|
|
839
865
|
if (!(!r && g.length === 0 && !C || W || n.readOnly)) {
|
|
840
866
|
if (!t && !C && n.commands && r.startsWith("/")) {
|
|
841
867
|
let [e, ...t] = r.slice(1).split(/\s+/), i = n.commands.find((t) => t.kind === "command" && t.name === e);
|
|
842
|
-
if (i) return
|
|
868
|
+
if (i) return Z(i.name, t.join(" "));
|
|
843
869
|
if (e && !r.includes("\n")) {
|
|
844
870
|
A("/" + e);
|
|
845
871
|
return;
|
|
846
872
|
}
|
|
847
873
|
}
|
|
848
874
|
try {
|
|
849
|
-
await n.onSend(r, g.map((e) => e.id), L.current, C ?? void 0),
|
|
875
|
+
await n.onSend(r, g.map((e) => e.id), L.current, C ?? void 0), he();
|
|
850
876
|
} catch {}
|
|
851
877
|
}
|
|
852
|
-
},
|
|
853
|
-
E(0), e.kind === "skill" ? (w(e.name), u("")) : e.takesText ? u("/" + e.name + " ") :
|
|
878
|
+
}, $ = (e) => {
|
|
879
|
+
E(0), e.kind === "skill" ? (w(e.name), u("")) : e.takesText ? u("/" + e.name + " ") : Z(e.name, ""), B.current?.focus();
|
|
854
880
|
}, ge = (e) => {
|
|
855
881
|
if (X && Y.length > 0) {
|
|
856
882
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
@@ -860,17 +886,17 @@ function q(n) {
|
|
|
860
886
|
return;
|
|
861
887
|
}
|
|
862
888
|
if (e.key === "Enter" && !e.shiftKey || e.key === "Tab") {
|
|
863
|
-
e.preventDefault(),
|
|
889
|
+
e.preventDefault(), $(Y[Math.min(T, Y.length - 1)]);
|
|
864
890
|
return;
|
|
865
891
|
}
|
|
866
892
|
}
|
|
867
|
-
X && e.key === "Escape" ? (e.preventDefault(), O(!0)) : e.key === "Backspace" && C && o === "" ? w(null) : e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && !
|
|
893
|
+
X && e.key === "Escape" ? (e.preventDefault(), O(!0)) : e.key === "Backspace" && C && o === "" ? w(null) : e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing && !de() && (e.preventDefault(), Q(o));
|
|
868
894
|
};
|
|
869
|
-
f(() =>
|
|
895
|
+
f(() => pe(R.current, () => me(B.current)), [o]), d(() => {
|
|
870
896
|
let e = B.current;
|
|
871
897
|
if (!e || typeof ResizeObserver > "u") return;
|
|
872
898
|
let t = e.clientWidth, n = new ResizeObserver(() => {
|
|
873
|
-
e.clientWidth !== t && (t = e.clientWidth,
|
|
899
|
+
e.clientWidth !== t && (t = e.clientWidth, pe(R.current, () => me(e)));
|
|
874
900
|
});
|
|
875
901
|
return n.observe(e), () => n.disconnect();
|
|
876
902
|
}, [H.recording]);
|
|
@@ -894,7 +920,7 @@ function q(n) {
|
|
|
894
920
|
};
|
|
895
921
|
async function ve() {
|
|
896
922
|
let e = await H.stop();
|
|
897
|
-
e && n.onTranscribe && await
|
|
923
|
+
e && n.onTranscribe && await oe(e, n.onTranscribe, {
|
|
898
924
|
busy: ee,
|
|
899
925
|
empty: () => i({
|
|
900
926
|
kind: "error",
|
|
@@ -916,7 +942,7 @@ function q(n) {
|
|
|
916
942
|
}
|
|
917
943
|
let ye = (e) => {
|
|
918
944
|
e.key === "Escape" && H.recording && (e.preventDefault(), H.cancel());
|
|
919
|
-
}, be = C ? r("chat.skillPlaceholder") : r("chat.placeholder", { name: n.agentName }), xe = V - H.seconds;
|
|
945
|
+
}, be = C ? r("chat.skillPlaceholder") : n.placeholder ?? r("chat.placeholder", { name: n.agentName }), xe = V - H.seconds;
|
|
920
946
|
return /* @__PURE__ */ l("section", {
|
|
921
947
|
className: "nb-chat",
|
|
922
948
|
"aria-label": r("chat.title"),
|
|
@@ -938,7 +964,7 @@ function q(n) {
|
|
|
938
964
|
className: "err-text",
|
|
939
965
|
children: n.historyError
|
|
940
966
|
}),
|
|
941
|
-
U.length === 0 && !n.loading && !n.historyError && /* @__PURE__ */ l("div", {
|
|
967
|
+
U.length === 0 && !n.loading && !n.historyError && (n.empty ?? /* @__PURE__ */ l("div", {
|
|
942
968
|
className: "empty",
|
|
943
969
|
children: [
|
|
944
970
|
/* @__PURE__ */ c("div", {
|
|
@@ -948,7 +974,7 @@ function q(n) {
|
|
|
948
974
|
/* @__PURE__ */ c("b", { children: r("chat.emptyTitle", { name: n.agentName }) }),
|
|
949
975
|
n.emptyHint
|
|
950
976
|
]
|
|
951
|
-
}),
|
|
977
|
+
})),
|
|
952
978
|
U.map((e) => /* @__PURE__ */ c(ie, {
|
|
953
979
|
m: e,
|
|
954
980
|
busy: W,
|
|
@@ -999,7 +1025,7 @@ function q(n) {
|
|
|
999
1025
|
X && /* @__PURE__ */ c(v, {
|
|
1000
1026
|
items: Y,
|
|
1001
1027
|
active: Math.min(T, Math.max(Y.length - 1, 0)),
|
|
1002
|
-
onPick:
|
|
1028
|
+
onPick: $,
|
|
1003
1029
|
onHover: E
|
|
1004
1030
|
}),
|
|
1005
1031
|
n.aboveComposer,
|
|
@@ -1035,7 +1061,7 @@ function q(n) {
|
|
|
1035
1061
|
children: [r("chat.unknownCommand", { name: k }), /* @__PURE__ */ c("button", {
|
|
1036
1062
|
type: "button",
|
|
1037
1063
|
className: "textbtn",
|
|
1038
|
-
onClick: () => void
|
|
1064
|
+
onClick: () => void Q(o, !0),
|
|
1039
1065
|
children: r("chat.sendAsText")
|
|
1040
1066
|
})]
|
|
1041
1067
|
}),
|
|
@@ -1068,9 +1094,9 @@ function q(n) {
|
|
|
1068
1094
|
/* @__PURE__ */ l("span", {
|
|
1069
1095
|
className: "tm",
|
|
1070
1096
|
children: [
|
|
1071
|
-
|
|
1097
|
+
ce(H.seconds),
|
|
1072
1098
|
" / ",
|
|
1073
|
-
|
|
1099
|
+
ce(V)
|
|
1074
1100
|
]
|
|
1075
1101
|
}),
|
|
1076
1102
|
/* @__PURE__ */ c("span", {
|
|
@@ -1138,7 +1164,7 @@ function q(n) {
|
|
|
1138
1164
|
onReset: n.onReset,
|
|
1139
1165
|
busy: ne
|
|
1140
1166
|
}),
|
|
1141
|
-
n.onTranscribe && !H.recording && /* @__PURE__ */ c(
|
|
1167
|
+
n.onTranscribe && !H.recording && /* @__PURE__ */ c(ue, {
|
|
1142
1168
|
supported: H.supported,
|
|
1143
1169
|
recognizing: j,
|
|
1144
1170
|
onStart: () => void H.start()
|
|
@@ -1152,7 +1178,7 @@ function q(n) {
|
|
|
1152
1178
|
className: "iconbtn fill",
|
|
1153
1179
|
"aria-label": r("chat.send"),
|
|
1154
1180
|
disabled: !o.trim() && g.length === 0 && !C || W || j,
|
|
1155
|
-
onClick: () =>
|
|
1181
|
+
onClick: () => Q(o),
|
|
1156
1182
|
children: /* @__PURE__ */ c(t, { name: "send" })
|
|
1157
1183
|
}))
|
|
1158
1184
|
]
|
|
@@ -1172,7 +1198,7 @@ function q(n) {
|
|
|
1172
1198
|
]
|
|
1173
1199
|
});
|
|
1174
1200
|
}
|
|
1175
|
-
function
|
|
1201
|
+
function ue({ supported: e, recognizing: n, onStart: r }) {
|
|
1176
1202
|
let i = a();
|
|
1177
1203
|
return n ? /* @__PURE__ */ l("span", {
|
|
1178
1204
|
className: "voicewait",
|
|
@@ -1195,15 +1221,15 @@ function ce({ supported: e, recognizing: n, onStart: r }) {
|
|
|
1195
1221
|
children: /* @__PURE__ */ c(t, { name: "mic" })
|
|
1196
1222
|
});
|
|
1197
1223
|
}
|
|
1198
|
-
function
|
|
1224
|
+
function de() {
|
|
1199
1225
|
return typeof window < "u" && !!window.matchMedia?.("(hover: none) and (pointer: coarse)").matches;
|
|
1200
1226
|
}
|
|
1201
|
-
var
|
|
1202
|
-
function
|
|
1203
|
-
let n = !!e &&
|
|
1227
|
+
var fe = (e) => e.scrollHeight - e.scrollTop - e.clientHeight < 2;
|
|
1228
|
+
function pe(e, t) {
|
|
1229
|
+
let n = !!e && fe(e);
|
|
1204
1230
|
t(), e && n && (e.scrollTop = e.scrollHeight);
|
|
1205
1231
|
}
|
|
1206
|
-
function
|
|
1232
|
+
function me(e) {
|
|
1207
1233
|
if (!e) return;
|
|
1208
1234
|
e.style.overflowY = "hidden", e.style.height = "auto";
|
|
1209
1235
|
let t = e.scrollHeight + e.offsetHeight - e.clientHeight;
|
|
@@ -1211,7 +1237,7 @@ function fe(e) {
|
|
|
1211
1237
|
}
|
|
1212
1238
|
//#endregion
|
|
1213
1239
|
//#region src/chat/ConversationList.tsx
|
|
1214
|
-
function
|
|
1240
|
+
function J({ conversations: e, currentId: n, open: r, onPick: i, onClose: o, onCreate: u }) {
|
|
1215
1241
|
let f = a(), [p, m] = h(!1);
|
|
1216
1242
|
d(() => {
|
|
1217
1243
|
if (!r) return;
|
|
@@ -1287,19 +1313,19 @@ function pe({ conversations: e, currentId: n, open: r, onPick: i, onClose: o, on
|
|
|
1287
1313
|
"aria-label": f("close"),
|
|
1288
1314
|
onClick: o
|
|
1289
1315
|
}),
|
|
1290
|
-
p && u && /* @__PURE__ */ c(
|
|
1316
|
+
p && u && /* @__PURE__ */ c(X, {
|
|
1291
1317
|
onClose: () => m(!1),
|
|
1292
1318
|
onCreate: u
|
|
1293
1319
|
})
|
|
1294
1320
|
] });
|
|
1295
1321
|
}
|
|
1296
|
-
function
|
|
1322
|
+
function Y({ narrow: e, children: t }) {
|
|
1297
1323
|
return /* @__PURE__ */ c("div", {
|
|
1298
1324
|
className: `nb-app${e ? " narrow" : ""}`,
|
|
1299
1325
|
children: t
|
|
1300
1326
|
});
|
|
1301
1327
|
}
|
|
1302
|
-
function
|
|
1328
|
+
function X({ onClose: e, onCreate: t }) {
|
|
1303
1329
|
let r = a(), [i, o] = h(""), [u, d] = h(!1), [f, p] = h(null), m = async () => {
|
|
1304
1330
|
if (i.trim() && !u) {
|
|
1305
1331
|
d(!0), p(null);
|
|
@@ -1351,7 +1377,7 @@ function J({ onClose: e, onCreate: t }) {
|
|
|
1351
1377
|
}
|
|
1352
1378
|
//#endregion
|
|
1353
1379
|
//#region src/chat/AgentMenu.tsx
|
|
1354
|
-
function
|
|
1380
|
+
function he({ icon: e, label: n, title: r, expanded: i, small: a, disabled: o, onClick: s }) {
|
|
1355
1381
|
return /* @__PURE__ */ c("button", {
|
|
1356
1382
|
type: "button",
|
|
1357
1383
|
className: `agentbtn${a ? " s" : ""}`,
|
|
@@ -1367,7 +1393,7 @@ function Y({ icon: e, label: n, title: r, expanded: i, small: a, disabled: o, on
|
|
|
1367
1393
|
})
|
|
1368
1394
|
});
|
|
1369
1395
|
}
|
|
1370
|
-
function
|
|
1396
|
+
function Z({ label: e, name: n, options: r, value: o, optionsLabel: u, hint: d, narrow: f, models: p, onRename: m, onPick: g, onClose: _ }) {
|
|
1371
1397
|
let v = a(), [y, b] = h(n), x = i(!0, _);
|
|
1372
1398
|
return /* @__PURE__ */ l("div", {
|
|
1373
1399
|
className: `agentmenu${f ? " narrow" : ""}`,
|
|
@@ -1479,8 +1505,8 @@ function X({ label: e, name: n, options: r, value: o, optionsLabel: u, hint: d,
|
|
|
1479
1505
|
}
|
|
1480
1506
|
//#endregion
|
|
1481
1507
|
//#region src/chat/AgentSettingsMenu.tsx
|
|
1482
|
-
var
|
|
1483
|
-
function
|
|
1508
|
+
var Q = (e) => `${e.connectionId}/${e.model}`;
|
|
1509
|
+
function $(e, t, n) {
|
|
1484
1510
|
let r = (n) => [
|
|
1485
1511
|
...n.caps.image ? [{
|
|
1486
1512
|
icon: "image",
|
|
@@ -1492,7 +1518,7 @@ function Q(e, t, n) {
|
|
|
1492
1518
|
}] : [],
|
|
1493
1519
|
...n.caps.contextWindow > 0 ? [{ text: b(n.caps.contextWindow, t) }] : []
|
|
1494
1520
|
], i = (t) => t.caps.contextWindow > 0 && n.contextTokens > .8 * t.caps.contextWindow ? e("agent.modelCompactWarn") : void 0, a = n.available.length > 1, o = n.available.map((e) => ({
|
|
1495
|
-
key:
|
|
1521
|
+
key: Q(e),
|
|
1496
1522
|
label: e.name,
|
|
1497
1523
|
sub: e.connection,
|
|
1498
1524
|
badges: r(e),
|
|
@@ -1505,12 +1531,12 @@ function Q(e, t, n) {
|
|
|
1505
1531
|
sub: n.defaultModel?.name ?? "—",
|
|
1506
1532
|
warn: n.defaultModel ? i(n.defaultModel) : void 0
|
|
1507
1533
|
}, ...o] : o,
|
|
1508
|
-
value: n.chosen && n.model ?
|
|
1534
|
+
value: n.chosen && n.model ? Q(n.model) : a ? "" : n.model ? Q(n.model) : ""
|
|
1509
1535
|
};
|
|
1510
1536
|
}
|
|
1511
|
-
function
|
|
1512
|
-
let d = a(), { i18n: f } = g(), p = r && l ?
|
|
1513
|
-
return /* @__PURE__ */ c(
|
|
1537
|
+
function ge({ name: e, value: t, options: n, models: r, hint: i, onRename: o, onPick: s, onModel: l, onClose: u }) {
|
|
1538
|
+
let d = a(), { i18n: f } = g(), p = r && l ? $(d, f.language, r) : null;
|
|
1539
|
+
return /* @__PURE__ */ c(Z, {
|
|
1514
1540
|
label: d("agent.menu"),
|
|
1515
1541
|
name: e,
|
|
1516
1542
|
value: t,
|
|
@@ -1524,7 +1550,7 @@ function $({ name: e, value: t, options: n, models: r, hint: i, onRename: o, onP
|
|
|
1524
1550
|
onPick: (e) => {
|
|
1525
1551
|
if (!r || !l) return;
|
|
1526
1552
|
if (!e) return l(null);
|
|
1527
|
-
let t = r.available.find((t) =>
|
|
1553
|
+
let t = r.available.find((t) => Q(t) === e);
|
|
1528
1554
|
t && l({
|
|
1529
1555
|
connectionId: t.connectionId,
|
|
1530
1556
|
model: t.model
|
|
@@ -1538,6 +1564,6 @@ function $({ name: e, value: t, options: n, models: r, hint: i, onRename: o, onP
|
|
|
1538
1564
|
});
|
|
1539
1565
|
}
|
|
1540
1566
|
//#endregion
|
|
1541
|
-
export {
|
|
1567
|
+
export { he as AgentButton, Z as AgentMenu, ge as AgentSettingsMenu, V as AttachmentList, te as AttachmentPreview, le as Chat, Y as ChatLayout, v as CommandPalette, x as ContextMeter, J as ConversationList, ie as MessageView, K as NOTICE_LINES, X as NewTopicModal, ue as VoiceButton, Q as agentModelKey, $ as agentModelOptions, A as fileSize, L as parseTable, O as previewIcon, E as previewKind, b as tokens, se as useRecorder };
|
|
1542
1568
|
|
|
1543
1569
|
//# sourceMappingURL=chat.js.map
|