@burtson-labs/bandit-engine 2.0.39 → 2.0.40
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/{aiProviderStore-XN7GCBHJ.mjs → aiProviderStore-JMA5RWX7.mjs} +2 -2
- package/dist/{chat-5QJNWB7I.mjs → chat-JMWPOSQ4.mjs} +5 -5
- package/dist/chat-provider.js +421 -20
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +4 -4
- package/dist/{chunk-WO5KFNNW.mjs → chunk-26QQ4CLA.mjs} +62 -24
- package/dist/chunk-26QQ4CLA.mjs.map +1 -0
- package/dist/{chunk-CDQYBO3Q.mjs → chunk-2ZCR2TDY.mjs} +27 -5
- package/dist/chunk-2ZCR2TDY.mjs.map +1 -0
- package/dist/{chunk-ECRNIAG6.mjs → chunk-6ELNWXKC.mjs} +4 -4
- package/dist/{chunk-EOKIE5HZ.mjs → chunk-75W5VWPV.mjs} +3 -3
- package/dist/{chunk-JRCDANLN.mjs → chunk-7KEBNVCO.mjs} +67 -9
- package/dist/{chunk-JRCDANLN.mjs.map → chunk-7KEBNVCO.mjs.map} +1 -1
- package/dist/{chunk-3A2527TE.mjs → chunk-D3AGKOM6.mjs} +3 -3
- package/dist/{chunk-QU5S5QQP.mjs → chunk-QJYPWWA5.mjs} +379 -18
- package/dist/chunk-QJYPWWA5.mjs.map +1 -0
- package/dist/{chunk-QYH2T4L5.mjs → chunk-VIYBZO5W.mjs} +3 -3
- package/dist/{cli/cli.js → cli.js} +423 -10
- package/dist/cli.js.map +1 -0
- package/dist/{gateway-B0LJ3-jT.d.ts → gateway-5yt_3QDP.d.mts} +4 -4
- package/dist/{gateway-B0LJ3-jT.d.mts → gateway-5yt_3QDP.d.ts} +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +598 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/management/management.js +596 -99
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +6 -6
- package/dist/modals/chat-modal/chat-modal.js +430 -29
- package/dist/modals/chat-modal/chat-modal.js.map +1 -1
- package/dist/modals/chat-modal/chat-modal.mjs +4 -4
- package/dist/public-types.d.mts +1 -1
- package/dist/public-types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-CDQYBO3Q.mjs.map +0 -1
- package/dist/chunk-QU5S5QQP.mjs.map +0 -1
- package/dist/chunk-WO5KFNNW.mjs.map +0 -1
- package/dist/cli/cli.js.map +0 -1
- /package/dist/{aiProviderStore-XN7GCBHJ.mjs.map → aiProviderStore-JMA5RWX7.mjs.map} +0 -0
- /package/dist/{chat-5QJNWB7I.mjs.map → chat-JMWPOSQ4.mjs.map} +0 -0
- /package/dist/{chunk-ECRNIAG6.mjs.map → chunk-6ELNWXKC.mjs.map} +0 -0
- /package/dist/{chunk-EOKIE5HZ.mjs.map → chunk-75W5VWPV.mjs.map} +0 -0
- /package/dist/{chunk-3A2527TE.mjs.map → chunk-D3AGKOM6.mjs.map} +0 -0
- /package/dist/{chunk-QYH2T4L5.mjs.map → chunk-VIYBZO5W.mjs.map} +0 -0
package/dist/chat-provider.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChatProvider,
|
|
3
3
|
chat_provider_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-D3AGKOM6.mjs";
|
|
5
5
|
import "./chunk-ONQMRE2G.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-75W5VWPV.mjs";
|
|
7
7
|
import "./chunk-RTQDQ6TC.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-2ZCR2TDY.mjs";
|
|
9
9
|
import "./chunk-XUBYA5I7.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-QJYPWWA5.mjs";
|
|
11
11
|
import "./chunk-KCI46M23.mjs";
|
|
12
12
|
import "./chunk-BJTO5JO5.mjs";
|
|
13
13
|
export {
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
useNotificationService,
|
|
20
20
|
useTTS,
|
|
21
21
|
useVoiceStore
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VIYBZO5W.mjs";
|
|
23
23
|
import {
|
|
24
24
|
authenticationService,
|
|
25
25
|
brandingService_default,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
useMemoryStore,
|
|
44
44
|
useProjectStore,
|
|
45
45
|
useVectorStore
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-2ZCR2TDY.mjs";
|
|
47
47
|
import {
|
|
48
48
|
indexedDBService_default,
|
|
49
49
|
useModelStore,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
} from "./chunk-XUBYA5I7.mjs";
|
|
53
53
|
import {
|
|
54
54
|
useAIProviderStore
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-QJYPWWA5.mjs";
|
|
56
56
|
import {
|
|
57
57
|
debugLogger
|
|
58
58
|
} from "./chunk-KCI46M23.mjs";
|
|
@@ -144,6 +144,8 @@ var ChatScrollToBottomButton = ({
|
|
|
144
144
|
drawerOpen = false,
|
|
145
145
|
isMobile = false
|
|
146
146
|
}) => {
|
|
147
|
+
const verticalBuffer = isMobile ? 36 : 56;
|
|
148
|
+
const bottomOffset = Math.max(inputHeight + verticalBuffer, verticalBuffer + 72);
|
|
147
149
|
return /* @__PURE__ */ jsx2(
|
|
148
150
|
IconButton,
|
|
149
151
|
{
|
|
@@ -152,12 +154,12 @@ var ChatScrollToBottomButton = ({
|
|
|
152
154
|
position: "fixed",
|
|
153
155
|
left: drawerOpen && !isMobile ? "calc(50% + 170px)" : "50%",
|
|
154
156
|
transform: "translateX(-50%)",
|
|
155
|
-
bottom:
|
|
157
|
+
bottom: bottomOffset,
|
|
156
158
|
bgcolor: (theme) => theme.palette.background.paper,
|
|
157
159
|
color: (theme) => theme.palette.text.primary,
|
|
158
160
|
border: "1px solid",
|
|
159
161
|
borderColor: (theme) => theme.palette.divider,
|
|
160
|
-
zIndex:
|
|
162
|
+
zIndex: (theme) => Math.max(theme.zIndex.modal + 1, 1400),
|
|
161
163
|
boxShadow: 3,
|
|
162
164
|
transition: "bottom 0.3s ease, left 0.3s ease-in-out",
|
|
163
165
|
"&:hover": {
|
|
@@ -2842,10 +2844,22 @@ var useAIProvider = ({
|
|
|
2842
2844
|
setResponse("");
|
|
2843
2845
|
setStreamBuffer("");
|
|
2844
2846
|
clearFlushTimer();
|
|
2845
|
-
|
|
2847
|
+
const imageList = Array.isArray(images) ? [...images] : [];
|
|
2848
|
+
const conversationStoreState = useConversationStore.getState();
|
|
2849
|
+
const { addToCurrent, replaceLastAnswer, conversations, currentId } = conversationStoreState;
|
|
2850
|
+
const currentConv = conversations.find((c) => c.id === currentId);
|
|
2851
|
+
const lastEntry = currentConv?.history.at(-1);
|
|
2852
|
+
const lastWasPlaceholder = !!lastEntry && lastEntry.answer === "..." && (lastEntry.placeholder === true || lastEntry.rawQuestion === question || lastEntry.question === question);
|
|
2853
|
+
const pendingQuestion = lastWasPlaceholder ? lastEntry?.question ?? question : question;
|
|
2854
|
+
const pendingImagesRaw = lastWasPlaceholder && Array.isArray(lastEntry?.images) && lastEntry.images.length > 0 ? lastEntry.images : imageList;
|
|
2855
|
+
const pendingImages = Array.isArray(pendingImagesRaw) && pendingImagesRaw.length > 0 ? [...pendingImagesRaw] : void 0;
|
|
2856
|
+
setPendingMessage({
|
|
2857
|
+
question: pendingQuestion,
|
|
2858
|
+
images: pendingImages
|
|
2859
|
+
});
|
|
2846
2860
|
const modelName = usePackageSettingsStore.getState().settings?.defaultModel || "bandit-core:4b-it-qat";
|
|
2847
2861
|
const CONFIG = modelConfigs[modelName] ?? modelConfigs["bandit-core:4b-it-qat"];
|
|
2848
|
-
const base64Images =
|
|
2862
|
+
const base64Images = imageList.map((img) => img.split(",")[1]);
|
|
2849
2863
|
const latestEntries = history.slice(-CONFIG.historyMessages);
|
|
2850
2864
|
const contextMessages = latestEntries.flatMap((entry) => [
|
|
2851
2865
|
{ role: "user", content: entry.question },
|
|
@@ -3231,11 +3245,8 @@ ${protocol}`;
|
|
|
3231
3245
|
}, delay);
|
|
3232
3246
|
};
|
|
3233
3247
|
const stream = provider.chat(request);
|
|
3234
|
-
const
|
|
3235
|
-
|
|
3236
|
-
const lastEntry = currentConv?.history.at(-1);
|
|
3237
|
-
const isPlaceholder = lastEntry?.question === question && lastEntry?.answer === "...";
|
|
3238
|
-
lastPartialRef.current = { text: "", images, usedDocs, question };
|
|
3248
|
+
const initialPlaceholderQuestion = lastEntry?.question;
|
|
3249
|
+
lastPartialRef.current = { text: "", images: [...imageList], usedDocs, question };
|
|
3239
3250
|
if (currentSubRef.current) {
|
|
3240
3251
|
try {
|
|
3241
3252
|
currentSubRef.current.unsubscribe();
|
|
@@ -3494,14 +3505,24 @@ ${items.map((item, index) => {
|
|
|
3494
3505
|
} else {
|
|
3495
3506
|
debugLogger.info("Memory scan skipped - disabled in preferences");
|
|
3496
3507
|
}
|
|
3497
|
-
const
|
|
3498
|
-
const
|
|
3499
|
-
const conv = current.conversations.find((c) => c.id === current.currentId);
|
|
3508
|
+
const currentState = useConversationStore.getState();
|
|
3509
|
+
const conv = currentState.conversations.find((c) => c.id === currentState.currentId);
|
|
3500
3510
|
const last = conv?.history.at(-1);
|
|
3501
|
-
|
|
3502
|
-
|
|
3511
|
+
const lastIsPlaceholder = !!last && last.answer === "..." && last.placeholder !== false;
|
|
3512
|
+
const preservedImagesSource = imageList.length > 0 ? imageList : lastPartialRef.current.images.length > 0 ? lastPartialRef.current.images : last?.images;
|
|
3513
|
+
const preservedImages = Array.isArray(preservedImagesSource) && preservedImagesSource.length > 0 ? [...preservedImagesSource] : void 0;
|
|
3514
|
+
if (lastIsPlaceholder) {
|
|
3515
|
+
replaceLastAnswer(enhancedMessage, preservedImages, memoryUpdated, usedDocs);
|
|
3503
3516
|
} else {
|
|
3504
|
-
|
|
3517
|
+
const historyQuestion = last && last.answer === "..." && last.question || initialPlaceholderQuestion || question;
|
|
3518
|
+
addToCurrent({
|
|
3519
|
+
question: historyQuestion,
|
|
3520
|
+
answer: enhancedMessage,
|
|
3521
|
+
images: preservedImages,
|
|
3522
|
+
memoryUpdated,
|
|
3523
|
+
sourceFiles: usedDocs,
|
|
3524
|
+
rawQuestion: question
|
|
3525
|
+
});
|
|
3505
3526
|
}
|
|
3506
3527
|
setInputValue("");
|
|
3507
3528
|
setPastedImages([]);
|
|
@@ -9050,12 +9071,20 @@ var ChatContent = () => {
|
|
|
9050
9071
|
(question, images, displayQuestion) => {
|
|
9051
9072
|
const requestStartTime = trackRequestStart();
|
|
9052
9073
|
const questionForDisplay = displayQuestion || question;
|
|
9053
|
-
|
|
9074
|
+
const pendingImages = images.length > 0 ? [...images] : void 0;
|
|
9075
|
+
setPendingMessage({ question: questionForDisplay, images: pendingImages });
|
|
9054
9076
|
setIsStreaming(true);
|
|
9055
9077
|
setResponseStarted(true);
|
|
9056
9078
|
setStreamBuffer("");
|
|
9057
9079
|
const { addToCurrent } = useConversationStore.getState();
|
|
9058
|
-
|
|
9080
|
+
const placeholderImages = pendingImages ? [...pendingImages] : void 0;
|
|
9081
|
+
addToCurrent({
|
|
9082
|
+
question: questionForDisplay,
|
|
9083
|
+
answer: "...",
|
|
9084
|
+
images: placeholderImages,
|
|
9085
|
+
placeholder: true,
|
|
9086
|
+
rawQuestion: question
|
|
9087
|
+
});
|
|
9059
9088
|
const getCurrentModel = useModelStore.getState().getCurrentModel;
|
|
9060
9089
|
const systemPrompt = getCurrentModel()?.systemPrompt ?? "You are a helpful assistant.";
|
|
9061
9090
|
const { currentId: currentId2, conversations: conversations2, createConversation, renameConversation } = useConversationStore.getState();
|
|
@@ -9069,8 +9098,16 @@ var ChatContent = () => {
|
|
|
9069
9098
|
if (!newCurrentId) return;
|
|
9070
9099
|
setResponse("");
|
|
9071
9100
|
const { addToCurrent: addToNew } = useConversationStore.getState();
|
|
9072
|
-
|
|
9073
|
-
|
|
9101
|
+
const newPlaceholderImages = pendingImages ? [...pendingImages] : void 0;
|
|
9102
|
+
addToNew({
|
|
9103
|
+
question: questionForDisplay,
|
|
9104
|
+
answer: "...",
|
|
9105
|
+
images: newPlaceholderImages,
|
|
9106
|
+
placeholder: true,
|
|
9107
|
+
rawQuestion: question
|
|
9108
|
+
});
|
|
9109
|
+
const providerImages2 = pendingImages ? [...pendingImages] : [];
|
|
9110
|
+
aiProvider(systemPrompt, question, providerImages2);
|
|
9074
9111
|
}, 0);
|
|
9075
9112
|
});
|
|
9076
9113
|
return;
|
|
@@ -9120,7 +9157,8 @@ var ChatContent = () => {
|
|
|
9120
9157
|
}, 50);
|
|
9121
9158
|
}
|
|
9122
9159
|
setResponse("");
|
|
9123
|
-
|
|
9160
|
+
const providerImages = pendingImages ? [...pendingImages] : [];
|
|
9161
|
+
aiProvider(systemPrompt, question, providerImages);
|
|
9124
9162
|
},
|
|
9125
9163
|
[
|
|
9126
9164
|
aiProvider,
|
|
@@ -9507,4 +9545,4 @@ var chat_default = Chat;
|
|
|
9507
9545
|
export {
|
|
9508
9546
|
chat_default
|
|
9509
9547
|
};
|
|
9510
|
-
//# sourceMappingURL=chunk-
|
|
9548
|
+
//# sourceMappingURL=chunk-26QQ4CLA.mjs.map
|