@burtson-labs/bandit-engine 2.0.64 → 2.0.66
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-IWRBVOVP.mjs +16 -0
- package/dist/chat-provider.js +4 -0
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +5 -5
- package/dist/{chunk-EUBVBTB3.mjs → chunk-4D7245ZO.mjs} +55 -30
- package/dist/chunk-4D7245ZO.mjs.map +1 -0
- package/dist/{chunk-FXFTA5PZ.mjs → chunk-6DY7W4NK.mjs} +3 -3
- package/dist/{chunk-VTC6AIWY.mjs → chunk-6ITUH375.mjs} +3 -3
- package/dist/{chunk-DCZLPUMY.mjs → chunk-EM2DB6NP.mjs} +53 -9
- package/dist/chunk-EM2DB6NP.mjs.map +1 -0
- package/dist/{chunk-D55E6ZDV.mjs → chunk-HHMGNCBS.mjs} +5 -5
- package/dist/{chunk-6QTTNYF2.mjs → chunk-IDZEEONG.mjs} +2 -2
- package/dist/{chunk-HKQSZALO.mjs → chunk-JURUEF52.mjs} +4 -4
- package/dist/{chunk-IPMTNREZ.mjs → chunk-LWHSOEPR.mjs} +6 -2
- package/dist/{chunk-IPMTNREZ.mjs.map → chunk-LWHSOEPR.mjs.map} +1 -1
- package/dist/{chunk-DPMJELHK.mjs → chunk-U633CJBV.mjs} +22 -10
- package/dist/{chunk-DPMJELHK.mjs.map → chunk-U633CJBV.mjs.map} +1 -1
- package/dist/{chunk-DR4X32D3.mjs → chunk-ZYQJVZK2.mjs} +20 -13
- package/dist/chunk-ZYQJVZK2.mjs.map +1 -0
- package/dist/index.js +138 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/management/management.js +137 -45
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +8 -8
- package/dist/modals/chat-modal/chat-modal.js +4 -0
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +4 -4
- package/dist/{modelStore-FBPBG7TI.mjs → modelStore-KCJPXFKO.mjs} +2 -2
- package/package.json +1 -1
- package/dist/chat-IGKTUDME.mjs +0 -16
- package/dist/chunk-DCZLPUMY.mjs.map +0 -1
- package/dist/chunk-DR4X32D3.mjs.map +0 -1
- package/dist/chunk-EUBVBTB3.mjs.map +0 -1
- /package/dist/{chat-IGKTUDME.mjs.map → chat-IWRBVOVP.mjs.map} +0 -0
- /package/dist/{chunk-FXFTA5PZ.mjs.map → chunk-6DY7W4NK.mjs.map} +0 -0
- /package/dist/{chunk-VTC6AIWY.mjs.map → chunk-6ITUH375.mjs.map} +0 -0
- /package/dist/{chunk-D55E6ZDV.mjs.map → chunk-HHMGNCBS.mjs.map} +0 -0
- /package/dist/{chunk-6QTTNYF2.mjs.map → chunk-IDZEEONG.mjs.map} +0 -0
- /package/dist/{chunk-HKQSZALO.mjs.map → chunk-JURUEF52.mjs.map} +0 -0
- /package/dist/{modelStore-FBPBG7TI.mjs.map → modelStore-KCJPXFKO.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -710,6 +710,8 @@ var init_preferencesStore = __esm({
|
|
|
710
710
|
sttEnabled: true,
|
|
711
711
|
banditModelsEnabled: true,
|
|
712
712
|
feedbackEnabled: true,
|
|
713
|
+
interests: [],
|
|
714
|
+
useKnowledgeForStarters: false,
|
|
713
715
|
homeUrl: ""
|
|
714
716
|
};
|
|
715
717
|
sanitizePreferences = (preferences) => {
|
|
@@ -807,6 +809,8 @@ var init_preferencesStore = __esm({
|
|
|
807
809
|
sttEnabled: typeof mergedPreferences.sttEnabled === "boolean" ? mergedPreferences.sttEnabled : defaultPreferences.sttEnabled,
|
|
808
810
|
banditModelsEnabled: typeof mergedPreferences.banditModelsEnabled === "boolean" ? mergedPreferences.banditModelsEnabled : defaultPreferences.banditModelsEnabled,
|
|
809
811
|
feedbackEnabled: typeof mergedPreferences.feedbackEnabled === "boolean" ? mergedPreferences.feedbackEnabled : defaultPreferences.feedbackEnabled,
|
|
812
|
+
interests: Array.isArray(mergedPreferences.interests) ? mergedPreferences.interests.filter((i) => typeof i === "string") : defaultPreferences.interests,
|
|
813
|
+
useKnowledgeForStarters: typeof mergedPreferences.useKnowledgeForStarters === "boolean" ? mergedPreferences.useKnowledgeForStarters : defaultPreferences.useKnowledgeForStarters,
|
|
810
814
|
homeUrl: typeof mergedPreferences.homeUrl === "string" ? mergedPreferences.homeUrl : defaultPreferences.homeUrl
|
|
811
815
|
};
|
|
812
816
|
set({ preferences: validatedPreferences });
|
|
@@ -6620,7 +6624,7 @@ var init_util = __esm({
|
|
|
6620
6624
|
});
|
|
6621
6625
|
|
|
6622
6626
|
// src/prompts/getStableQuestionPrompt.ts
|
|
6623
|
-
var TOPICS, getRandomTopicOfInterest, getStableQuestionPrompt;
|
|
6627
|
+
var TOPICS, getRandomTopicOfInterest, pickDistinctRandomTopics, getStableQuestionPrompt;
|
|
6624
6628
|
var init_getStableQuestionPrompt = __esm({
|
|
6625
6629
|
"src/prompts/getStableQuestionPrompt.ts"() {
|
|
6626
6630
|
"use strict";
|
|
@@ -6633,42 +6637,65 @@ var init_getStableQuestionPrompt = __esm({
|
|
|
6633
6637
|
const randomTopic = TOPICS[randomIndex];
|
|
6634
6638
|
return randomTopic;
|
|
6635
6639
|
};
|
|
6640
|
+
pickDistinctRandomTopics = (count) => {
|
|
6641
|
+
const pool = [...TOPICS];
|
|
6642
|
+
const picked = [];
|
|
6643
|
+
const n = Math.min(Math.max(count, 0), pool.length);
|
|
6644
|
+
for (let i = 0; i < n; i++) {
|
|
6645
|
+
const idx = randomRange(0, pool.length - 1);
|
|
6646
|
+
picked.push(pool[idx]);
|
|
6647
|
+
pool.splice(idx, 1);
|
|
6648
|
+
}
|
|
6649
|
+
return picked;
|
|
6650
|
+
};
|
|
6636
6651
|
getStableQuestionPrompt = (args) => {
|
|
6637
|
-
const { limit, topicOfInterest, modelSystemPrompt } = args;
|
|
6652
|
+
const { limit, topicOfInterest, modelSystemPrompt, interests, knowledgeTopics, webSearchAvailable } = args;
|
|
6638
6653
|
if (limit < 1 || limit > 10) {
|
|
6639
6654
|
throw new Error("Limit must be between 1 and 10");
|
|
6640
6655
|
}
|
|
6641
6656
|
const seed = generateSeed();
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6657
|
+
const lines = [
|
|
6658
|
+
`You are crafting fresh, engaging conversation starters for a chat app's home screen.`,
|
|
6659
|
+
``,
|
|
6660
|
+
`Variation seed (make this set different from any previous set): "${seed}"`
|
|
6661
|
+
];
|
|
6645
6662
|
if (modelSystemPrompt && modelSystemPrompt.trim()) {
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
Based on this specialized assistant profile: "${modelSystemPrompt.trim()}"`;
|
|
6663
|
+
lines.push(``, `Tailor the questions to this assistant's role and expertise: "${modelSystemPrompt.trim()}"`);
|
|
6649
6664
|
}
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6665
|
+
if (interests && interests.length) {
|
|
6666
|
+
lines.push(
|
|
6667
|
+
``,
|
|
6668
|
+
`The user is especially interested in: ${interests.join(", ")}. Lean toward these, but do NOT make every question about the same one.`
|
|
6669
|
+
);
|
|
6670
|
+
}
|
|
6671
|
+
if (knowledgeTopics && knowledgeTopics.length) {
|
|
6672
|
+
lines.push(
|
|
6673
|
+
``,
|
|
6674
|
+
`The user keeps these documents in their library: ${knowledgeTopics.join("; ")}. Include one or two questions that draw on this material.`
|
|
6675
|
+
);
|
|
6676
|
+
}
|
|
6677
|
+
lines.push(
|
|
6678
|
+
``,
|
|
6679
|
+
`Spread the set across a VARIETY of these topics so it never feels repetitive (do not cluster on one): ${topicOfInterest}.`
|
|
6680
|
+
);
|
|
6681
|
+
if (webSearchAvailable) {
|
|
6682
|
+
lines.push(
|
|
6683
|
+
``,
|
|
6684
|
+
`This assistant can search the web for live information. Include 2\u20133 questions that invite current, up-to-date answers (latest news, recent developments, "today" / "this week") so the user discovers that capability.`
|
|
6685
|
+
);
|
|
6686
|
+
}
|
|
6687
|
+
lines.push(
|
|
6688
|
+
``,
|
|
6689
|
+
`Generate ${limit} concise (5\u201320 words), natural-sounding questions a user might ask${modelSystemPrompt ? " this specialized assistant" : " an AI assistant"}. Requirements:`,
|
|
6690
|
+
`- Each question must explore a DISTINCT topic or angle \u2014 no two may be similar or rephrasings of each other.`,
|
|
6691
|
+
`- Vary the type across the set: practical how-to, curious exploration, current/topical, creative, and learning.`,
|
|
6692
|
+
`- Specific and concrete, easy to understand, not abstract.`,
|
|
6693
|
+
``,
|
|
6694
|
+
`Do not refer to yourself, say "As an AI", add greetings, explanations, jokes, fiction, quotes, or number/bullet the lines.`,
|
|
6695
|
+
``,
|
|
6696
|
+
`Output only ${limit} questions \u2014 one per line, with no leading numbers, bullets, or prefixes.`
|
|
6697
|
+
);
|
|
6698
|
+
return lines.join("\n").trim();
|
|
6672
6699
|
};
|
|
6673
6700
|
}
|
|
6674
6701
|
});
|
|
@@ -11015,8 +11042,8 @@ var init_chat_scroll_to_bottom_button = __esm({
|
|
|
11015
11042
|
drawerOpen = false,
|
|
11016
11043
|
isMobile = false
|
|
11017
11044
|
}) => {
|
|
11018
|
-
const verticalBuffer = isMobile ?
|
|
11019
|
-
const bottomOffset = Math.max(inputHeight + verticalBuffer, verticalBuffer +
|
|
11045
|
+
const verticalBuffer = isMobile ? 44 : 80;
|
|
11046
|
+
const bottomOffset = Math.max(inputHeight + verticalBuffer, verticalBuffer + 72);
|
|
11020
11047
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
11021
11048
|
import_material4.IconButton,
|
|
11022
11049
|
{
|
|
@@ -14491,7 +14518,7 @@ ${sourcesMarkdownList.join("\n")}`;
|
|
|
14491
14518
|
});
|
|
14492
14519
|
|
|
14493
14520
|
// src/components/StreamingMarkdown.tsx
|
|
14494
|
-
var import_react16, import_material9, import_react_markdown2, import_remark_gfm2, import_rehype_raw2, import_rehype_sanitize3, import_styles5, import_jsx_runtime12, StreamingMarkdown, StreamingMarkdown_default;
|
|
14521
|
+
var import_react16, import_material9, import_react_markdown2, import_remark_gfm2, import_rehype_raw2, import_rehype_sanitize3, import_styles5, import_jsx_runtime12, StreamingMarkdown, arePropsEqual, StreamingMarkdown_default;
|
|
14495
14522
|
var init_StreamingMarkdown = __esm({
|
|
14496
14523
|
"src/components/StreamingMarkdown.tsx"() {
|
|
14497
14524
|
"use strict";
|
|
@@ -14925,8 +14952,8 @@ ${listMarkdown}`;
|
|
|
14925
14952
|
{
|
|
14926
14953
|
ref: containerRef,
|
|
14927
14954
|
sx: {
|
|
14928
|
-
//
|
|
14929
|
-
transition: "opacity
|
|
14955
|
+
// Settle the whole block to full color a beat after streaming ends.
|
|
14956
|
+
transition: "opacity 380ms ease-out, transform 220ms ease-out",
|
|
14930
14957
|
"& .cursor": {
|
|
14931
14958
|
display: showCursor ? "inline" : "none",
|
|
14932
14959
|
animation: "blink 1s step-start infinite"
|
|
@@ -14934,16 +14961,18 @@ ${listMarkdown}`;
|
|
|
14934
14961
|
"@keyframes blink": {
|
|
14935
14962
|
"50%": { opacity: 0 }
|
|
14936
14963
|
},
|
|
14964
|
+
// Each newly-written word focuses in — blur→sharp, a tiny rise, and fade —
|
|
14965
|
+
// like ink settling onto the page as the typewriter writes.
|
|
14937
14966
|
"& .bl-fade-word": {
|
|
14938
14967
|
opacity: 0,
|
|
14939
|
-
animation: "bl-fade-in
|
|
14968
|
+
animation: "bl-fade-in 480ms cubic-bezier(0.22, 1, 0.36, 1) forwards"
|
|
14940
14969
|
},
|
|
14941
14970
|
"@keyframes bl-fade-in": {
|
|
14942
|
-
from: { opacity: 0, transform: "translateY(
|
|
14943
|
-
to: { opacity: 1, transform: "translateY(0)" }
|
|
14971
|
+
from: { opacity: 0, filter: "blur(3px)", transform: "translateY(2px)" },
|
|
14972
|
+
to: { opacity: 1, filter: "blur(0)", transform: "translateY(0)" }
|
|
14944
14973
|
},
|
|
14945
|
-
//
|
|
14946
|
-
opacity: isStreaming ? 0.
|
|
14974
|
+
// Dimmed while streaming, then brightens to full color once the answer lands.
|
|
14975
|
+
opacity: isStreaming ? 0.86 : 1,
|
|
14947
14976
|
transform: isStreaming ? "translateY(0.25px)" : "none",
|
|
14948
14977
|
// Reduce layout jumpiness between updates
|
|
14949
14978
|
"& p:last-child": { marginBottom: 0 },
|
|
@@ -14969,7 +14998,17 @@ ${listMarkdown}`;
|
|
|
14969
14998
|
}
|
|
14970
14999
|
);
|
|
14971
15000
|
};
|
|
14972
|
-
|
|
15001
|
+
arePropsEqual = (prev, next) => {
|
|
15002
|
+
if (prev.content !== next.content || prev.isStreaming !== next.isStreaming) {
|
|
15003
|
+
return false;
|
|
15004
|
+
}
|
|
15005
|
+
const a = prev.sources;
|
|
15006
|
+
const b = next.sources;
|
|
15007
|
+
if (a === b) return true;
|
|
15008
|
+
if (!a || !b || a.length !== b.length) return false;
|
|
15009
|
+
return a.every((s, i) => s.id === b[i].id && s.name === b[i].name);
|
|
15010
|
+
};
|
|
15011
|
+
StreamingMarkdown_default = import_react16.default.memo(StreamingMarkdown, arePropsEqual);
|
|
14973
15012
|
}
|
|
14974
15013
|
});
|
|
14975
15014
|
|
|
@@ -25584,6 +25623,9 @@ var init_query_suggestion_picker = __esm({
|
|
|
25584
25623
|
init_prompts();
|
|
25585
25624
|
init_getStableQuestionPrompt();
|
|
25586
25625
|
init_modelStore();
|
|
25626
|
+
init_preferencesStore();
|
|
25627
|
+
init_knowledgeStore();
|
|
25628
|
+
init_mcpToolsStore();
|
|
25587
25629
|
import_jsx_runtime25 = require("react/jsx-runtime");
|
|
25588
25630
|
markdownComponents = {
|
|
25589
25631
|
p: ({ node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { ...props }),
|
|
@@ -25610,13 +25652,19 @@ var init_query_suggestion_picker = __esm({
|
|
|
25610
25652
|
if (hasGenerated.current || isLoading) return;
|
|
25611
25653
|
hasGenerated.current = true;
|
|
25612
25654
|
const currentModel = getCurrentModel();
|
|
25655
|
+
const prefs = usePreferencesStore.getState().preferences;
|
|
25656
|
+
const interests = (prefs.interests ?? []).filter((i) => i && i.trim());
|
|
25657
|
+
const randomTopics = pickDistinctRandomTopics(interests.length ? 3 : 5);
|
|
25658
|
+
const topicOfInterest = Array.from(/* @__PURE__ */ new Set([...interests, ...randomTopics])).join(", ") || getRandomTopicOfInterest();
|
|
25659
|
+
const webSearchAvailable = useMCPToolsStore.getState().getEnabledTools().some((t) => t.name === "web_search");
|
|
25660
|
+
const knowledgeTopics = prefs.useKnowledgeForStarters ? useKnowledgeStore.getState().docs.map((d) => d.name).filter((n) => n && n.trim()).slice(0, 12) : void 0;
|
|
25613
25661
|
const args = {
|
|
25614
|
-
// keep responses quick and snappy, server may be handling concurrent requests adjust as needed
|
|
25615
25662
|
limit: 9,
|
|
25616
|
-
|
|
25617
|
-
|
|
25618
|
-
|
|
25619
|
-
|
|
25663
|
+
topicOfInterest,
|
|
25664
|
+
modelSystemPrompt: currentModel?.systemPrompt,
|
|
25665
|
+
interests,
|
|
25666
|
+
knowledgeTopics,
|
|
25667
|
+
webSearchAvailable
|
|
25620
25668
|
};
|
|
25621
25669
|
generateConversationStarters(args).then((prompts) => {
|
|
25622
25670
|
if (prompts.length > 0) {
|
|
@@ -35290,6 +35338,7 @@ var PersonalitiesTab_default = PersonalitiesTab;
|
|
|
35290
35338
|
var import_react47 = require("react");
|
|
35291
35339
|
var import_material38 = require("@mui/material");
|
|
35292
35340
|
init_preferencesStore();
|
|
35341
|
+
init_getStableQuestionPrompt();
|
|
35293
35342
|
init_modelStore();
|
|
35294
35343
|
init_voiceStore();
|
|
35295
35344
|
init_useFeatures();
|
|
@@ -35747,6 +35796,49 @@ var PreferencesTab = ({
|
|
|
35747
35796
|
children: "Control which AI features are enabled to optimize performance for your device. Disabling features can help reduce resource usage on machines with limited capabilities."
|
|
35748
35797
|
}
|
|
35749
35798
|
),
|
|
35799
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
|
|
35800
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { children: [
|
|
35801
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Conversation Starters" }),
|
|
35802
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Typography, { variant: "body2", color: "text.secondary", children: "Personalize the suggested prompts on your home screen. Pick the topics you care about \u2014 starters lean toward them (blended with fresh ones each time) instead of generic blanket questions." })
|
|
35803
|
+
] }),
|
|
35804
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Box, { sx: { mt: 2, display: "flex", flexWrap: "wrap", gap: 1 }, children: TOPICS.map((topic) => {
|
|
35805
|
+
const selected = (preferences.interests ?? []).includes(topic);
|
|
35806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
35807
|
+
import_material38.Chip,
|
|
35808
|
+
{
|
|
35809
|
+
label: topic,
|
|
35810
|
+
size: "small",
|
|
35811
|
+
color: selected ? "primary" : "default",
|
|
35812
|
+
variant: selected ? "filled" : "outlined",
|
|
35813
|
+
onClick: () => {
|
|
35814
|
+
const current = preferences.interests ?? [];
|
|
35815
|
+
const next = selected ? current.filter((t) => t !== topic) : [...current, topic];
|
|
35816
|
+
updatePreference("interests", next);
|
|
35817
|
+
},
|
|
35818
|
+
sx: { textTransform: "capitalize" }
|
|
35819
|
+
},
|
|
35820
|
+
topic
|
|
35821
|
+
);
|
|
35822
|
+
}) }),
|
|
35823
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Box, { sx: { mt: 2.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
35824
|
+
import_material38.FormControlLabel,
|
|
35825
|
+
{
|
|
35826
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
35827
|
+
import_material38.Switch,
|
|
35828
|
+
{
|
|
35829
|
+
checked: !!preferences.useKnowledgeForStarters,
|
|
35830
|
+
onChange: (e) => updatePreference("useKnowledgeForStarters", e.target.checked),
|
|
35831
|
+
color: "primary"
|
|
35832
|
+
}
|
|
35833
|
+
),
|
|
35834
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { textAlign: "left", children: [
|
|
35835
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Typography, { variant: "body1", sx: { fontWeight: 600, color: "text.primary" }, children: "Use my knowledge documents" }),
|
|
35836
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_material38.Typography, { variant: "body2", color: "text.secondary", children: "Let some starters reference the documents in your library." })
|
|
35837
|
+
] }),
|
|
35838
|
+
sx: { alignSelf: "flex-start", ml: 0 }
|
|
35839
|
+
}
|
|
35840
|
+
) })
|
|
35841
|
+
] }),
|
|
35750
35842
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Paper, { sx: { p: { xs: 1.75, sm: 2.5 }, mb: { xs: 2, md: 3 } }, children: [
|
|
35751
35843
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { sx: { display: "flex", flexDirection: { xs: "column", sm: "row" }, justifyContent: "space-between", gap: 2 }, children: [
|
|
35752
35844
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_material38.Box, { children: [
|