@burtson-labs/bandit-engine 2.0.35 → 2.0.36
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/README.md +3 -2
- package/dist/{aiProviderStore-3YS2BZU3.mjs → aiProviderStore-UJRDUYOF.mjs} +2 -2
- package/dist/{chat-2LYIZNWZ.mjs → chat-SZK3EBDO.mjs} +5 -5
- package/dist/chat-provider.js +227 -11
- package/dist/chat-provider.js.map +1 -1
- package/dist/chat-provider.mjs +4 -4
- package/dist/{chunk-6PQRG6W4.mjs → chunk-2ZZA2IFL.mjs} +3 -3
- package/dist/{chunk-GBANNFRD.mjs → chunk-ED5NNDKO.mjs} +3 -3
- package/dist/{chunk-XD5VJCFN.mjs → chunk-FJO5ZWYU.mjs} +3 -3
- package/dist/{chunk-XXMCI2WK.mjs → chunk-G4OXOTNJ.mjs} +41 -8
- package/dist/{chunk-XXMCI2WK.mjs.map → chunk-G4OXOTNJ.mjs.map} +1 -1
- package/dist/{chunk-LG2JCTOE.mjs → chunk-PLNFTIGX.mjs} +4 -4
- package/dist/{chunk-7RLN6ZGT.mjs → chunk-S635Q6OQ.mjs} +3 -3
- package/dist/{chunk-IGD4KGB5.mjs → chunk-ZAVV2AT5.mjs} +4 -4
- package/dist/{chunk-IHJPVIGB.mjs → chunk-ZNNOTDRD.mjs} +208 -1
- package/dist/chunk-ZNNOTDRD.mjs.map +1 -0
- package/dist/cli/cli.js +1078 -62
- package/dist/cli/cli.js.map +1 -1
- package/dist/{gateway-BiHRHJMM.d.ts → gateway-Ckf_KusF.d.mts} +4 -4
- package/dist/{gateway-BiHRHJMM.d.mts → gateway-Ckf_KusF.d.ts} +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +318 -69
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/management/management.js +316 -67
- package/dist/management/management.js.map +1 -1
- package/dist/management/management.mjs +6 -6
- package/dist/modals/chat-modal/chat-modal.js +236 -20
- 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-IHJPVIGB.mjs.map +0 -1
- /package/dist/{aiProviderStore-3YS2BZU3.mjs.map → aiProviderStore-UJRDUYOF.mjs.map} +0 -0
- /package/dist/{chat-2LYIZNWZ.mjs.map → chat-SZK3EBDO.mjs.map} +0 -0
- /package/dist/{chunk-6PQRG6W4.mjs.map → chunk-2ZZA2IFL.mjs.map} +0 -0
- /package/dist/{chunk-GBANNFRD.mjs.map → chunk-ED5NNDKO.mjs.map} +0 -0
- /package/dist/{chunk-XD5VJCFN.mjs.map → chunk-FJO5ZWYU.mjs.map} +0 -0
- /package/dist/{chunk-LG2JCTOE.mjs.map → chunk-PLNFTIGX.mjs.map} +0 -0
- /package/dist/{chunk-7RLN6ZGT.mjs.map → chunk-S635Q6OQ.mjs.map} +0 -0
- /package/dist/{chunk-IGD4KGB5.mjs.map → chunk-ZAVV2AT5.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -12,11 +12,11 @@ var __export = (target, all) => {
|
|
|
12
12
|
for (var name in all)
|
|
13
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
14
|
};
|
|
15
|
-
var __copyProps = (to,
|
|
16
|
-
if (
|
|
17
|
-
for (let key of __getOwnPropNames(
|
|
15
|
+
var __copyProps = (to, from9, except, desc) => {
|
|
16
|
+
if (from9 && typeof from9 === "object" || typeof from9 === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from9))
|
|
18
18
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () =>
|
|
19
|
+
__defProp(to, key, { get: () => from9[key], enumerable: !(desc = __getOwnPropDesc(from9, key)) || desc.enumerable });
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
@@ -5587,6 +5587,216 @@ var init_playground_provider = __esm({
|
|
|
5587
5587
|
}
|
|
5588
5588
|
});
|
|
5589
5589
|
|
|
5590
|
+
// src/services/ai-provider/providers/xai.provider.ts
|
|
5591
|
+
var import_rxjs9, XAIProvider;
|
|
5592
|
+
var init_xai_provider = __esm({
|
|
5593
|
+
"src/services/ai-provider/providers/xai.provider.ts"() {
|
|
5594
|
+
"use strict";
|
|
5595
|
+
import_rxjs9 = require("rxjs");
|
|
5596
|
+
init_common_types();
|
|
5597
|
+
init_debugLogger();
|
|
5598
|
+
XAIProvider = class {
|
|
5599
|
+
config;
|
|
5600
|
+
baseUrl;
|
|
5601
|
+
constructor(config) {
|
|
5602
|
+
this.config = config;
|
|
5603
|
+
this.baseUrl = config.baseUrl || "https://api.x.ai/v1";
|
|
5604
|
+
}
|
|
5605
|
+
chat(request) {
|
|
5606
|
+
const url = `${this.baseUrl}/chat/completions`;
|
|
5607
|
+
const payload = {
|
|
5608
|
+
model: request.model,
|
|
5609
|
+
messages: request.messages,
|
|
5610
|
+
stream: Boolean(request.stream),
|
|
5611
|
+
temperature: request.temperature,
|
|
5612
|
+
max_tokens: request.maxTokens
|
|
5613
|
+
};
|
|
5614
|
+
if (request.stream) {
|
|
5615
|
+
return this.streamChatRequest(url, payload);
|
|
5616
|
+
} else {
|
|
5617
|
+
return this.nonStreamChatRequest(url, payload);
|
|
5618
|
+
}
|
|
5619
|
+
}
|
|
5620
|
+
generate(request) {
|
|
5621
|
+
const chatRequest = {
|
|
5622
|
+
model: request.model,
|
|
5623
|
+
messages: [{ role: "user", content: request.prompt }],
|
|
5624
|
+
stream: request.stream,
|
|
5625
|
+
options: request.options
|
|
5626
|
+
};
|
|
5627
|
+
return this.chat(chatRequest).pipe(
|
|
5628
|
+
(0, import_rxjs9.map)((response) => ({
|
|
5629
|
+
response: response.message.content,
|
|
5630
|
+
done: response.done
|
|
5631
|
+
}))
|
|
5632
|
+
);
|
|
5633
|
+
}
|
|
5634
|
+
listModels() {
|
|
5635
|
+
const url = `${this.baseUrl}/models`;
|
|
5636
|
+
return (0, import_rxjs9.from)(fetch(url, {
|
|
5637
|
+
headers: this.getHeaders()
|
|
5638
|
+
})).pipe(
|
|
5639
|
+
(0, import_rxjs9.switchMap)((response) => {
|
|
5640
|
+
if (!response.ok) {
|
|
5641
|
+
return (0, import_rxjs9.throwError)(() => new Error(`Failed to list models: ${response.status}`));
|
|
5642
|
+
}
|
|
5643
|
+
return (0, import_rxjs9.from)(response.json());
|
|
5644
|
+
}),
|
|
5645
|
+
(0, import_rxjs9.map)(
|
|
5646
|
+
(data) => data.data.map((model) => ({
|
|
5647
|
+
name: model.id,
|
|
5648
|
+
details: {
|
|
5649
|
+
format: "xai",
|
|
5650
|
+
family: model.object
|
|
5651
|
+
}
|
|
5652
|
+
}))
|
|
5653
|
+
)
|
|
5654
|
+
);
|
|
5655
|
+
}
|
|
5656
|
+
async validateServiceAvailability(args) {
|
|
5657
|
+
try {
|
|
5658
|
+
const controller = new AbortController();
|
|
5659
|
+
const timeoutId = setTimeout(() => controller.abort(), args.timeoutMs);
|
|
5660
|
+
const response = await fetch(`${this.baseUrl}/models`, {
|
|
5661
|
+
headers: this.getHeaders(),
|
|
5662
|
+
signal: controller.signal
|
|
5663
|
+
});
|
|
5664
|
+
clearTimeout(timeoutId);
|
|
5665
|
+
return {
|
|
5666
|
+
url: this.baseUrl,
|
|
5667
|
+
isAvailable: response.ok
|
|
5668
|
+
};
|
|
5669
|
+
} catch (error) {
|
|
5670
|
+
if (args.fallbackUrl) {
|
|
5671
|
+
try {
|
|
5672
|
+
const controller = new AbortController();
|
|
5673
|
+
const timeoutId = setTimeout(() => controller.abort(), args.timeoutMs);
|
|
5674
|
+
const response = await fetch(`${args.fallbackUrl}/models`, {
|
|
5675
|
+
headers: this.getHeaders(),
|
|
5676
|
+
signal: controller.signal
|
|
5677
|
+
});
|
|
5678
|
+
clearTimeout(timeoutId);
|
|
5679
|
+
if (response.ok) {
|
|
5680
|
+
this.baseUrl = args.fallbackUrl;
|
|
5681
|
+
return {
|
|
5682
|
+
url: args.fallbackUrl,
|
|
5683
|
+
isAvailable: true
|
|
5684
|
+
};
|
|
5685
|
+
}
|
|
5686
|
+
} catch (fallbackError) {
|
|
5687
|
+
debugLogger.warn("xAI fallback validation failed", { error: fallbackError });
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
return {
|
|
5691
|
+
url: this.baseUrl,
|
|
5692
|
+
isAvailable: false
|
|
5693
|
+
};
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
getProviderType() {
|
|
5697
|
+
return "xai" /* XAI */;
|
|
5698
|
+
}
|
|
5699
|
+
getConfig() {
|
|
5700
|
+
return this.config;
|
|
5701
|
+
}
|
|
5702
|
+
streamChatRequest(url, payload) {
|
|
5703
|
+
return new import_rxjs9.Observable((observer) => {
|
|
5704
|
+
const task = fetch(url, {
|
|
5705
|
+
method: "POST",
|
|
5706
|
+
headers: {
|
|
5707
|
+
...this.getHeaders(),
|
|
5708
|
+
"Content-Type": "application/json"
|
|
5709
|
+
},
|
|
5710
|
+
body: JSON.stringify(payload)
|
|
5711
|
+
});
|
|
5712
|
+
task.then((response) => {
|
|
5713
|
+
if (!response.ok) {
|
|
5714
|
+
observer.error(new Error(`xAI request failed: ${response.status}`));
|
|
5715
|
+
return;
|
|
5716
|
+
}
|
|
5717
|
+
const reader = response.body?.getReader();
|
|
5718
|
+
const decoder = new TextDecoder();
|
|
5719
|
+
let buffer = "";
|
|
5720
|
+
const read = () => {
|
|
5721
|
+
reader?.read().then(({ done, value }) => {
|
|
5722
|
+
if (done) {
|
|
5723
|
+
observer.next({
|
|
5724
|
+
message: { content: "", role: "assistant" },
|
|
5725
|
+
done: true
|
|
5726
|
+
});
|
|
5727
|
+
observer.complete();
|
|
5728
|
+
return;
|
|
5729
|
+
}
|
|
5730
|
+
buffer += decoder.decode(value, { stream: true });
|
|
5731
|
+
const lines = buffer.split("\n");
|
|
5732
|
+
buffer = lines.pop() ?? "";
|
|
5733
|
+
for (const line of lines) {
|
|
5734
|
+
if (line.trim() && line.startsWith("data: ")) {
|
|
5735
|
+
const data = line.slice(6).trim();
|
|
5736
|
+
if (data === "[DONE]") {
|
|
5737
|
+
observer.next({
|
|
5738
|
+
message: { content: "", role: "assistant" },
|
|
5739
|
+
done: true
|
|
5740
|
+
});
|
|
5741
|
+
observer.complete();
|
|
5742
|
+
return;
|
|
5743
|
+
}
|
|
5744
|
+
try {
|
|
5745
|
+
const parsed = JSON.parse(data);
|
|
5746
|
+
const content = parsed.choices?.[0]?.delta?.content ?? "";
|
|
5747
|
+
if (content) {
|
|
5748
|
+
observer.next({
|
|
5749
|
+
message: { content, role: "assistant" },
|
|
5750
|
+
done: false
|
|
5751
|
+
});
|
|
5752
|
+
}
|
|
5753
|
+
} catch (err) {
|
|
5754
|
+
debugLogger.error("Error parsing xAI stream data:", { data, error: err });
|
|
5755
|
+
}
|
|
5756
|
+
}
|
|
5757
|
+
}
|
|
5758
|
+
read();
|
|
5759
|
+
}).catch((err) => observer.error(err));
|
|
5760
|
+
};
|
|
5761
|
+
read();
|
|
5762
|
+
}).catch((err) => observer.error(err));
|
|
5763
|
+
});
|
|
5764
|
+
}
|
|
5765
|
+
nonStreamChatRequest(url, payload) {
|
|
5766
|
+
return (0, import_rxjs9.from)(fetch(url, {
|
|
5767
|
+
method: "POST",
|
|
5768
|
+
headers: {
|
|
5769
|
+
...this.getHeaders(),
|
|
5770
|
+
"Content-Type": "application/json"
|
|
5771
|
+
},
|
|
5772
|
+
body: JSON.stringify(payload)
|
|
5773
|
+
})).pipe(
|
|
5774
|
+
(0, import_rxjs9.switchMap)((response) => {
|
|
5775
|
+
if (!response.ok) {
|
|
5776
|
+
return (0, import_rxjs9.throwError)(() => new Error(`xAI request failed: ${response.status}`));
|
|
5777
|
+
}
|
|
5778
|
+
return (0, import_rxjs9.from)(response.json());
|
|
5779
|
+
}),
|
|
5780
|
+
(0, import_rxjs9.map)((data) => ({
|
|
5781
|
+
message: {
|
|
5782
|
+
content: data.choices?.[0]?.message?.content ?? "",
|
|
5783
|
+
role: "assistant"
|
|
5784
|
+
},
|
|
5785
|
+
done: true
|
|
5786
|
+
}))
|
|
5787
|
+
);
|
|
5788
|
+
}
|
|
5789
|
+
getHeaders() {
|
|
5790
|
+
const headers = {};
|
|
5791
|
+
if (this.config.apiKey) {
|
|
5792
|
+
headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
5793
|
+
}
|
|
5794
|
+
return headers;
|
|
5795
|
+
}
|
|
5796
|
+
};
|
|
5797
|
+
}
|
|
5798
|
+
});
|
|
5799
|
+
|
|
5590
5800
|
// src/services/ai-provider/ai-provider.factory.ts
|
|
5591
5801
|
var AIProviderFactory;
|
|
5592
5802
|
var init_ai_provider_factory = __esm({
|
|
@@ -5599,6 +5809,7 @@ var init_ai_provider_factory = __esm({
|
|
|
5599
5809
|
init_anthropic_provider();
|
|
5600
5810
|
init_gateway_provider();
|
|
5601
5811
|
init_playground_provider();
|
|
5812
|
+
init_xai_provider();
|
|
5602
5813
|
AIProviderFactory = class {
|
|
5603
5814
|
static createProvider(config) {
|
|
5604
5815
|
switch (config.type) {
|
|
@@ -5610,6 +5821,8 @@ var init_ai_provider_factory = __esm({
|
|
|
5610
5821
|
return new AzureOpenAIProvider(config);
|
|
5611
5822
|
case "anthropic" /* ANTHROPIC */:
|
|
5612
5823
|
return new AnthropicProvider(config);
|
|
5824
|
+
case "xai" /* XAI */:
|
|
5825
|
+
return new XAIProvider(config);
|
|
5613
5826
|
case "gateway" /* GATEWAY */:
|
|
5614
5827
|
return new GatewayProvider(config);
|
|
5615
5828
|
case "playground" /* PLAYGROUND */:
|
|
@@ -5624,6 +5837,7 @@ var init_ai_provider_factory = __esm({
|
|
|
5624
5837
|
"openai" /* OPENAI */,
|
|
5625
5838
|
"azure-openai" /* AZURE_OPENAI */,
|
|
5626
5839
|
"anthropic" /* ANTHROPIC */,
|
|
5840
|
+
"xai" /* XAI */,
|
|
5627
5841
|
"gateway" /* GATEWAY */,
|
|
5628
5842
|
"playground" /* PLAYGROUND */
|
|
5629
5843
|
];
|
|
@@ -5639,6 +5853,8 @@ var init_ai_provider_factory = __esm({
|
|
|
5639
5853
|
return !!(config.baseUrl && config.apiKey && config.apiVersion && config.deploymentName);
|
|
5640
5854
|
case "anthropic" /* ANTHROPIC */:
|
|
5641
5855
|
return !!config.apiKey;
|
|
5856
|
+
case "xai" /* XAI */:
|
|
5857
|
+
return !!config.apiKey;
|
|
5642
5858
|
case "gateway" /* GATEWAY */:
|
|
5643
5859
|
return !!(config.gatewayUrl && config.provider);
|
|
5644
5860
|
case "playground" /* PLAYGROUND */:
|
|
@@ -5997,11 +6213,11 @@ var init_notificationService = __esm({
|
|
|
5997
6213
|
});
|
|
5998
6214
|
|
|
5999
6215
|
// src/services/prompts/conversationStarters.ts
|
|
6000
|
-
var
|
|
6216
|
+
var import_rxjs10, generateConversationStarters;
|
|
6001
6217
|
var init_conversationStarters = __esm({
|
|
6002
6218
|
"src/services/prompts/conversationStarters.ts"() {
|
|
6003
6219
|
"use strict";
|
|
6004
|
-
|
|
6220
|
+
import_rxjs10 = require("rxjs");
|
|
6005
6221
|
init_aiProviderStore();
|
|
6006
6222
|
init_packageSettingsStore();
|
|
6007
6223
|
init_getStableQuestionPrompt();
|
|
@@ -6022,13 +6238,13 @@ var init_conversationStarters = __esm({
|
|
|
6022
6238
|
stream: false,
|
|
6023
6239
|
options: { temperature: 1.5, num_predict: 250 }
|
|
6024
6240
|
});
|
|
6025
|
-
const questions$ = data$.pipe((0,
|
|
6241
|
+
const questions$ = data$.pipe((0, import_rxjs10.map)((d) => {
|
|
6026
6242
|
const lines = d.response.split("\n").map((line) => line.trim()).filter((line) => {
|
|
6027
6243
|
return line.length > 10 && !line.toLowerCase().includes("sorry") && !line.toLowerCase().includes("i cannot") && !line.toLowerCase().includes("i can't") && !line.toLowerCase().includes("unable to") && !line.toLowerCase().startsWith("as an ai") && line.includes("?");
|
|
6028
6244
|
});
|
|
6029
6245
|
return lines;
|
|
6030
6246
|
}));
|
|
6031
|
-
const starters = await (0,
|
|
6247
|
+
const starters = await (0, import_rxjs10.lastValueFrom)(questions$);
|
|
6032
6248
|
if (starters.length === 0) {
|
|
6033
6249
|
debugLogger.warn("No meaningful conversation starters generated");
|
|
6034
6250
|
return [];
|
|
@@ -6044,11 +6260,11 @@ var init_conversationStarters = __esm({
|
|
|
6044
6260
|
});
|
|
6045
6261
|
|
|
6046
6262
|
// src/services/prompts/moodDetection.ts
|
|
6047
|
-
var
|
|
6263
|
+
var import_rxjs11, detectMessageMood;
|
|
6048
6264
|
var init_moodDetection = __esm({
|
|
6049
6265
|
"src/services/prompts/moodDetection.ts"() {
|
|
6050
6266
|
"use strict";
|
|
6051
|
-
|
|
6267
|
+
import_rxjs11 = require("rxjs");
|
|
6052
6268
|
init_aiProviderStore();
|
|
6053
6269
|
init_packageSettingsStore();
|
|
6054
6270
|
init_debugLogger();
|
|
@@ -6079,8 +6295,8 @@ Response:`;
|
|
|
6079
6295
|
options: { temperature: 0.3, num_predict: 10 }
|
|
6080
6296
|
});
|
|
6081
6297
|
const chunks$ = response$.pipe(
|
|
6082
|
-
(0,
|
|
6083
|
-
(0,
|
|
6298
|
+
(0, import_rxjs11.map)((chunk) => chunk.response.trim().toLowerCase()),
|
|
6299
|
+
(0, import_rxjs11.toArray)()
|
|
6084
6300
|
);
|
|
6085
6301
|
const result = await chunks$.toPromise();
|
|
6086
6302
|
const finalResult = (result || []).join("").trim();
|
|
@@ -6097,11 +6313,11 @@ Response:`;
|
|
|
6097
6313
|
});
|
|
6098
6314
|
|
|
6099
6315
|
// src/services/prompts/detectUserInterestAndExcitement.ts
|
|
6100
|
-
var
|
|
6316
|
+
var import_rxjs12, detectUserInterestAndExcitement;
|
|
6101
6317
|
var init_detectUserInterestAndExcitement = __esm({
|
|
6102
6318
|
"src/services/prompts/detectUserInterestAndExcitement.ts"() {
|
|
6103
6319
|
"use strict";
|
|
6104
|
-
|
|
6320
|
+
import_rxjs12 = require("rxjs");
|
|
6105
6321
|
init_aiProviderStore();
|
|
6106
6322
|
init_packageSettingsStore();
|
|
6107
6323
|
init_debugLogger();
|
|
@@ -6148,10 +6364,10 @@ var init_detectUserInterestAndExcitement = __esm({
|
|
|
6148
6364
|
options: { temperature: 0.1, num_predict: 5 }
|
|
6149
6365
|
});
|
|
6150
6366
|
const chunks$ = response$.pipe(
|
|
6151
|
-
(0,
|
|
6152
|
-
(0,
|
|
6367
|
+
(0, import_rxjs12.map)((chunk) => chunk.response.trim().toUpperCase()),
|
|
6368
|
+
(0, import_rxjs12.toArray)()
|
|
6153
6369
|
);
|
|
6154
|
-
const result = await (0,
|
|
6370
|
+
const result = await (0, import_rxjs12.lastValueFrom)(chunks$);
|
|
6155
6371
|
const decision = result.join("").trim();
|
|
6156
6372
|
debugLogger.llmDebug("detectUserInterestAndExcitement result", { decision });
|
|
6157
6373
|
return decision.includes("YES");
|
|
@@ -6164,11 +6380,11 @@ var init_detectUserInterestAndExcitement = __esm({
|
|
|
6164
6380
|
});
|
|
6165
6381
|
|
|
6166
6382
|
// src/services/prompts/documentSummarization.ts
|
|
6167
|
-
var
|
|
6383
|
+
var import_rxjs13, summarizeDocument;
|
|
6168
6384
|
var init_documentSummarization = __esm({
|
|
6169
6385
|
"src/services/prompts/documentSummarization.ts"() {
|
|
6170
6386
|
"use strict";
|
|
6171
|
-
|
|
6387
|
+
import_rxjs13 = require("rxjs");
|
|
6172
6388
|
init_aiProviderStore();
|
|
6173
6389
|
init_packageSettingsStore();
|
|
6174
6390
|
init_debugLogger();
|
|
@@ -6196,8 +6412,8 @@ ${content.slice(0, 4e3)}
|
|
|
6196
6412
|
stream: false,
|
|
6197
6413
|
options: { temperature: 0.3, num_predict: 100 }
|
|
6198
6414
|
});
|
|
6199
|
-
const summary$ = data$.pipe((0,
|
|
6200
|
-
const summary = await (0,
|
|
6415
|
+
const summary$ = data$.pipe((0, import_rxjs13.map)((d) => d.response.trim()));
|
|
6416
|
+
const summary = await (0, import_rxjs13.lastValueFrom)(summary$);
|
|
6201
6417
|
debugLogger.ragDebug("summarizeDocument result", { name, summary });
|
|
6202
6418
|
return summary || `Document summary for ${name}`;
|
|
6203
6419
|
} catch (error) {
|
|
@@ -6209,11 +6425,11 @@ ${content.slice(0, 4e3)}
|
|
|
6209
6425
|
});
|
|
6210
6426
|
|
|
6211
6427
|
// src/services/prompts/documentRelevance.ts
|
|
6212
|
-
var
|
|
6428
|
+
var import_rxjs14, determineRelevantDocuments;
|
|
6213
6429
|
var init_documentRelevance = __esm({
|
|
6214
6430
|
"src/services/prompts/documentRelevance.ts"() {
|
|
6215
6431
|
"use strict";
|
|
6216
|
-
|
|
6432
|
+
import_rxjs14 = require("rxjs");
|
|
6217
6433
|
init_aiProviderStore();
|
|
6218
6434
|
init_packageSettingsStore();
|
|
6219
6435
|
init_debugLogger();
|
|
@@ -6254,10 +6470,10 @@ Response:`;
|
|
|
6254
6470
|
options: { temperature: 0.2, num_predict: 50 }
|
|
6255
6471
|
});
|
|
6256
6472
|
const chunks$ = response$.pipe(
|
|
6257
|
-
(0,
|
|
6258
|
-
(0,
|
|
6473
|
+
(0, import_rxjs14.map)((chunk) => chunk.response.trim()),
|
|
6474
|
+
(0, import_rxjs14.toArray)()
|
|
6259
6475
|
);
|
|
6260
|
-
const result = await (0,
|
|
6476
|
+
const result = await (0, import_rxjs14.lastValueFrom)(chunks$);
|
|
6261
6477
|
const vetResult = result.join("").trim().toLowerCase();
|
|
6262
6478
|
debugLogger.ragDebug("determineRelevantDocuments result", { vetResult });
|
|
6263
6479
|
if (vetResult.includes("none") || !vetResult) {
|
|
@@ -11645,11 +11861,11 @@ var init_ttsSanitizer = __esm({
|
|
|
11645
11861
|
});
|
|
11646
11862
|
|
|
11647
11863
|
// src/services/tts/tts-client.ts
|
|
11648
|
-
var
|
|
11864
|
+
var import_rxjs15, getOrAppendAuthHeader;
|
|
11649
11865
|
var init_tts_client = __esm({
|
|
11650
11866
|
"src/services/tts/tts-client.ts"() {
|
|
11651
11867
|
"use strict";
|
|
11652
|
-
|
|
11868
|
+
import_rxjs15 = require("rxjs");
|
|
11653
11869
|
init_authenticationService();
|
|
11654
11870
|
init_voiceStore();
|
|
11655
11871
|
init_ttsSanitizer();
|
|
@@ -11669,11 +11885,11 @@ var init_tts_client = __esm({
|
|
|
11669
11885
|
});
|
|
11670
11886
|
|
|
11671
11887
|
// src/services/tts/streaming-tts.ts
|
|
11672
|
-
var
|
|
11888
|
+
var import_rxjs16, TTSState, StreamingTTSClient, getStreamingTTSClient, speakStream, stopTTS, pauseTTS, resumeTTS, getTTSState;
|
|
11673
11889
|
var init_streaming_tts = __esm({
|
|
11674
11890
|
"src/services/tts/streaming-tts.ts"() {
|
|
11675
11891
|
"use strict";
|
|
11676
|
-
|
|
11892
|
+
import_rxjs16 = require("rxjs");
|
|
11677
11893
|
init_debugLogger();
|
|
11678
11894
|
init_packageSettingsStore();
|
|
11679
11895
|
init_tts_client();
|
|
@@ -11693,8 +11909,8 @@ var init_streaming_tts = __esm({
|
|
|
11693
11909
|
// Store event handler references for proper cleanup
|
|
11694
11910
|
audioHandlers = /* @__PURE__ */ new Map();
|
|
11695
11911
|
// State management
|
|
11696
|
-
stateSubject = new
|
|
11697
|
-
progressSubject = new
|
|
11912
|
+
stateSubject = new import_rxjs16.BehaviorSubject("IDLE" /* IDLE */);
|
|
11913
|
+
progressSubject = new import_rxjs16.Subject();
|
|
11698
11914
|
constructor() {
|
|
11699
11915
|
}
|
|
11700
11916
|
static getInstance() {
|
|
@@ -11725,7 +11941,7 @@ var init_streaming_tts = __esm({
|
|
|
11725
11941
|
* Speak text with simple streaming
|
|
11726
11942
|
*/
|
|
11727
11943
|
speakStream(text, voice, options = {}) {
|
|
11728
|
-
return new
|
|
11944
|
+
return new import_rxjs16.Observable((subscriber) => {
|
|
11729
11945
|
this.performSimpleStreaming(text, voice, options, subscriber);
|
|
11730
11946
|
});
|
|
11731
11947
|
}
|
|
@@ -14254,28 +14470,28 @@ var init_create_audio_blob = __esm({
|
|
|
14254
14470
|
});
|
|
14255
14471
|
|
|
14256
14472
|
// src/services/stt/sound-recorder.service.ts
|
|
14257
|
-
var
|
|
14473
|
+
var import_rxjs17, SoundRecorderService;
|
|
14258
14474
|
var init_sound_recorder_service = __esm({
|
|
14259
14475
|
"src/services/stt/sound-recorder.service.ts"() {
|
|
14260
14476
|
"use strict";
|
|
14261
|
-
|
|
14477
|
+
import_rxjs17 = require("rxjs");
|
|
14262
14478
|
init_create_audio_blob();
|
|
14263
14479
|
SoundRecorderService = class {
|
|
14264
14480
|
_mediaRecorder;
|
|
14265
14481
|
start() {
|
|
14266
|
-
const mediaStream = (0,
|
|
14267
|
-
this._mediaRecorder = mediaStream.pipe((0,
|
|
14482
|
+
const mediaStream = (0, import_rxjs17.from)(navigator.mediaDevices.getUserMedia({ audio: true }));
|
|
14483
|
+
this._mediaRecorder = mediaStream.pipe((0, import_rxjs17.map)((stream) => {
|
|
14268
14484
|
const rec = new MediaRecorder(stream);
|
|
14269
14485
|
rec.start();
|
|
14270
14486
|
return rec;
|
|
14271
|
-
}), (0,
|
|
14487
|
+
}), (0, import_rxjs17.shareReplay)(1));
|
|
14272
14488
|
const dataAvailableEvent = this._mediaRecorder.pipe(
|
|
14273
|
-
(0,
|
|
14489
|
+
(0, import_rxjs17.switchMap)((recorder) => (0, import_rxjs17.fromEvent)(recorder, "dataavailable"))
|
|
14274
14490
|
);
|
|
14275
14491
|
const blob = dataAvailableEvent.pipe(
|
|
14276
|
-
(0,
|
|
14277
|
-
(0,
|
|
14278
|
-
(0,
|
|
14492
|
+
(0, import_rxjs17.first)(),
|
|
14493
|
+
(0, import_rxjs17.map)((event) => createAudioBlob(event.data)),
|
|
14494
|
+
(0, import_rxjs17.shareReplay)(1)
|
|
14279
14495
|
);
|
|
14280
14496
|
return blob;
|
|
14281
14497
|
}
|
|
@@ -14283,7 +14499,7 @@ var init_sound_recorder_service = __esm({
|
|
|
14283
14499
|
if (!this._mediaRecorder) {
|
|
14284
14500
|
return;
|
|
14285
14501
|
}
|
|
14286
|
-
this._mediaRecorder.pipe((0,
|
|
14502
|
+
this._mediaRecorder.pipe((0, import_rxjs17.first)()).subscribe((recorder) => {
|
|
14287
14503
|
recorder.stop();
|
|
14288
14504
|
});
|
|
14289
14505
|
}
|
|
@@ -14403,7 +14619,7 @@ var init_stt_client = __esm({
|
|
|
14403
14619
|
});
|
|
14404
14620
|
|
|
14405
14621
|
// src/services/stt/transcriber.tsx
|
|
14406
|
-
var import_react16, import_Mic, import_Check4, import_Close3, import_material10,
|
|
14622
|
+
var import_react16, import_Mic, import_Check4, import_Close3, import_material10, import_rxjs18, import_jsx_runtime13, initialButtonStyles, Transcriber, transcriber_default;
|
|
14407
14623
|
var init_transcriber = __esm({
|
|
14408
14624
|
"src/services/stt/transcriber.tsx"() {
|
|
14409
14625
|
"use strict";
|
|
@@ -14414,7 +14630,7 @@ var init_transcriber = __esm({
|
|
|
14414
14630
|
init_sound_recorder_service();
|
|
14415
14631
|
init_stt_client();
|
|
14416
14632
|
import_material10 = require("@mui/material");
|
|
14417
|
-
|
|
14633
|
+
import_rxjs18 = require("rxjs");
|
|
14418
14634
|
init_debugLogger();
|
|
14419
14635
|
import_jsx_runtime13 = require("react/jsx-runtime");
|
|
14420
14636
|
initialButtonStyles = (badgeBackground, fileText, hoverBadgeBackground) => ({
|
|
@@ -14433,14 +14649,14 @@ var init_transcriber = __esm({
|
|
|
14433
14649
|
const [status, setStatus] = (0, import_react16.useState)("IDLE");
|
|
14434
14650
|
const recorderRef = (0, import_react16.useRef)(new SoundRecorderService());
|
|
14435
14651
|
const [iconButtonStyles] = (0, import_react16.useState)(() => initialButtonStyles(badgeBackground, fileText, hoverBadgeBackground));
|
|
14436
|
-
const [recordingSub, setRecordingSub] = (0, import_react16.useState)(() => new
|
|
14652
|
+
const [recordingSub, setRecordingSub] = (0, import_react16.useState)(() => new import_rxjs18.Subscription());
|
|
14437
14653
|
const start = () => {
|
|
14438
14654
|
recordingSub.unsubscribe();
|
|
14439
14655
|
const recording = recorderRef.current.start();
|
|
14440
14656
|
const text = recording.pipe(
|
|
14441
|
-
(0,
|
|
14657
|
+
(0, import_rxjs18.switchMap)((blob) => {
|
|
14442
14658
|
debugLogger.debug("Processing audio blob for transcription");
|
|
14443
|
-
return (0,
|
|
14659
|
+
return (0, import_rxjs18.from)(STTClient.transcribe(blob));
|
|
14444
14660
|
})
|
|
14445
14661
|
);
|
|
14446
14662
|
const sub = text.subscribe({
|
|
@@ -18054,11 +18270,11 @@ ${sanitize(
|
|
|
18054
18270
|
});
|
|
18055
18271
|
|
|
18056
18272
|
// src/chat/hooks/useMemoryEnhancer.tsx
|
|
18057
|
-
var
|
|
18273
|
+
var import_rxjs19, MEMORY_LIMIT, MIN_MEMORY_WORDS, MERGE_THRESHOLD, REJECT_ECHO_THRESHOLD, REJECT_DUPLICATE_THRESHOLD, CONTEXTUAL_DIVERGENCE_THRESHOLD, normalizeText, isStructurallyDuplicate, isAboutBandit, hasEngagementValue, isMemoryTooShortOrGeneric, isPersonalText, mergeMemory, isVoiceShifted, sanitizeMemory, sanitizeMemoryText, shouldAcceptMemory, isContextuallyDivergent, useMemoryEnhancer;
|
|
18058
18274
|
var init_useMemoryEnhancer = __esm({
|
|
18059
18275
|
"src/chat/hooks/useMemoryEnhancer.tsx"() {
|
|
18060
18276
|
"use strict";
|
|
18061
|
-
|
|
18277
|
+
import_rxjs19 = require("rxjs");
|
|
18062
18278
|
init_memoryStore();
|
|
18063
18279
|
init_aiProviderStore();
|
|
18064
18280
|
init_packageSettingsStore();
|
|
@@ -18450,8 +18666,8 @@ var init_useMemoryEnhancer = __esm({
|
|
|
18450
18666
|
stream: false,
|
|
18451
18667
|
options: { temperature: 0.1, num_predict: 150 }
|
|
18452
18668
|
});
|
|
18453
|
-
const suggestion = await (0,
|
|
18454
|
-
result$.pipe((0,
|
|
18669
|
+
const suggestion = await (0, import_rxjs19.lastValueFrom)(
|
|
18670
|
+
result$.pipe((0, import_rxjs19.map)((chunk) => chunk.response))
|
|
18455
18671
|
);
|
|
18456
18672
|
debugLogger.memoryDebug(`LLM memory suggestion received (${attempt})`, {
|
|
18457
18673
|
suggestion: typeof suggestion === "string" ? suggestion.slice(0, 200) : suggestion,
|
|
@@ -24044,14 +24260,14 @@ var init_chat_app_bar = __esm({
|
|
|
24044
24260
|
});
|
|
24045
24261
|
|
|
24046
24262
|
// src/chat/hooks/useConversationNameGenerator.tsx
|
|
24047
|
-
var
|
|
24263
|
+
var import_rxjs20, import_operators5, useConversationNameGenerator;
|
|
24048
24264
|
var init_useConversationNameGenerator = __esm({
|
|
24049
24265
|
"src/chat/hooks/useConversationNameGenerator.tsx"() {
|
|
24050
24266
|
"use strict";
|
|
24051
24267
|
init_aiProviderStore();
|
|
24052
24268
|
init_packageSettingsStore();
|
|
24053
24269
|
init_debugLogger();
|
|
24054
|
-
|
|
24270
|
+
import_rxjs20 = require("rxjs");
|
|
24055
24271
|
import_operators5 = require("rxjs/operators");
|
|
24056
24272
|
init_conversationStore();
|
|
24057
24273
|
useConversationNameGenerator = () => {
|
|
@@ -24087,7 +24303,7 @@ Respond with just the title and nothing else.
|
|
|
24087
24303
|
num_predict: 20
|
|
24088
24304
|
}
|
|
24089
24305
|
});
|
|
24090
|
-
const title = await (0,
|
|
24306
|
+
const title = await (0, import_rxjs20.lastValueFrom)(
|
|
24091
24307
|
result$.pipe((0, import_operators5.map)((d) => d.response?.trim().replace(/["']/g, "")))
|
|
24092
24308
|
);
|
|
24093
24309
|
if (title && title.length > 0) {
|
|
@@ -29360,7 +29576,7 @@ init_modelStore();
|
|
|
29360
29576
|
init_ai_response_text_field();
|
|
29361
29577
|
init_memory_modal();
|
|
29362
29578
|
init_streaming_tts();
|
|
29363
|
-
var
|
|
29579
|
+
var import_rxjs21 = require("rxjs");
|
|
29364
29580
|
init_debugLogger();
|
|
29365
29581
|
init_util();
|
|
29366
29582
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
@@ -29389,7 +29605,7 @@ var AIQueriesDrawer = ({ drawerOpen, onClose, onClearComplete, onNavigateToMain
|
|
|
29389
29605
|
const [memoryModalOpen, setMemoryModalOpen] = (0, import_react39.useState)(false);
|
|
29390
29606
|
const [contextMode, setContextMode] = (0, import_react39.useState)("local");
|
|
29391
29607
|
const [expandedSections, setExpandedSections] = (0, import_react39.useState)(/* @__PURE__ */ new Set(["history", "voice"]));
|
|
29392
|
-
const [audioSub, setAudioSub] = (0, import_react39.useState)(new
|
|
29608
|
+
const [audioSub, setAudioSub] = (0, import_react39.useState)(new import_rxjs21.Subscription());
|
|
29393
29609
|
const [isContextSwitching, setIsContextSwitching] = (0, import_react39.useState)(false);
|
|
29394
29610
|
const [isDrawerLoading, setIsDrawerLoading] = (0, import_react39.useState)(false);
|
|
29395
29611
|
(0, import_react39.useEffect)(() => {
|
|
@@ -31052,7 +31268,7 @@ init_debugLogger();
|
|
|
31052
31268
|
init_banditTheme();
|
|
31053
31269
|
init_themeMap();
|
|
31054
31270
|
init_useTTS();
|
|
31055
|
-
var
|
|
31271
|
+
var import_rxjs22 = require("rxjs");
|
|
31056
31272
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
31057
31273
|
var FULL_SCREEN_THRESHOLD = 100;
|
|
31058
31274
|
var CDN_BASE2 = "https://cdn.burtson.ai/";
|
|
@@ -31119,7 +31335,7 @@ var ChatModal = ({
|
|
|
31119
31335
|
const [modalLogo, setModalLogo] = (0, import_react42.useState)("https://cdn.burtson.ai/logos/bandit-ai-logo.png");
|
|
31120
31336
|
const [modelAnchorEl, setModelAnchorEl] = (0, import_react42.useState)(null);
|
|
31121
31337
|
const [voiceAnchorEl, setVoiceAnchorEl] = (0, import_react42.useState)(null);
|
|
31122
|
-
const [audioSub, setAudioSub] = (0, import_react42.useState)(new
|
|
31338
|
+
const [audioSub, setAudioSub] = (0, import_react42.useState)(new import_rxjs22.Subscription());
|
|
31123
31339
|
const [selectedTheme, setSelectedTheme] = (0, import_react42.useState)(null);
|
|
31124
31340
|
const [themeLoading, setThemeLoading] = (0, import_react42.useState)(true);
|
|
31125
31341
|
const [autoFullscreenTriggered, setAutoFullscreenTriggered] = (0, import_react42.useState)(false);
|
|
@@ -33660,7 +33876,7 @@ init_conversationSyncStore();
|
|
|
33660
33876
|
|
|
33661
33877
|
// src/hooks/useGatewayQueries.ts
|
|
33662
33878
|
var import_react45 = require("react");
|
|
33663
|
-
var
|
|
33879
|
+
var import_rxjs23 = require("rxjs");
|
|
33664
33880
|
var import_react_query2 = require("@tanstack/react-query");
|
|
33665
33881
|
init_packageSettingsStore();
|
|
33666
33882
|
init_gateway_service();
|
|
@@ -33691,7 +33907,7 @@ var useGatewayHealth = (options) => {
|
|
|
33691
33907
|
if (!service) {
|
|
33692
33908
|
throw new Error("Gateway service is not configured");
|
|
33693
33909
|
}
|
|
33694
|
-
return (0,
|
|
33910
|
+
return (0, import_rxjs23.lastValueFrom)(service.getHealth());
|
|
33695
33911
|
},
|
|
33696
33912
|
enabled
|
|
33697
33913
|
});
|
|
@@ -33706,7 +33922,7 @@ var useGatewayModels = (options) => {
|
|
|
33706
33922
|
if (!service) {
|
|
33707
33923
|
throw new Error("Gateway service is not configured");
|
|
33708
33924
|
}
|
|
33709
|
-
return (0,
|
|
33925
|
+
return (0, import_rxjs23.lastValueFrom)(service.listModels());
|
|
33710
33926
|
},
|
|
33711
33927
|
enabled
|
|
33712
33928
|
});
|
|
@@ -33721,7 +33937,7 @@ var useGatewayMemory = (options) => {
|
|
|
33721
33937
|
if (!service) {
|
|
33722
33938
|
throw new Error("Gateway service is not configured");
|
|
33723
33939
|
}
|
|
33724
|
-
return (0,
|
|
33940
|
+
return (0, import_rxjs23.lastValueFrom)(service.getMemory());
|
|
33725
33941
|
},
|
|
33726
33942
|
enabled
|
|
33727
33943
|
});
|
|
@@ -38543,6 +38759,13 @@ var ProviderTab = () => {
|
|
|
38543
38759
|
apiKey: ""
|
|
38544
38760
|
});
|
|
38545
38761
|
break;
|
|
38762
|
+
case "xai" /* XAI */:
|
|
38763
|
+
setProviderConfig({
|
|
38764
|
+
...baseConfig,
|
|
38765
|
+
baseUrl: "https://api.x.ai/v1",
|
|
38766
|
+
apiKey: ""
|
|
38767
|
+
});
|
|
38768
|
+
break;
|
|
38546
38769
|
case "gateway" /* GATEWAY */:
|
|
38547
38770
|
setProviderConfig({
|
|
38548
38771
|
...baseConfig,
|
|
@@ -38675,6 +38898,7 @@ var ProviderTab = () => {
|
|
|
38675
38898
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
38676
38899
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
38677
38900
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "anthropic", children: "Anthropic" }),
|
|
38901
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "xai", children: "xAI" }),
|
|
38678
38902
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "playground", children: "Playground (Mock Demo)" })
|
|
38679
38903
|
]
|
|
38680
38904
|
}
|
|
@@ -38707,7 +38931,8 @@ var ProviderTab = () => {
|
|
|
38707
38931
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "openai", children: "OpenAI" }),
|
|
38708
38932
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "azure-openai", children: "Azure OpenAI" }),
|
|
38709
38933
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "anthropic", children: "Anthropic" }),
|
|
38710
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "ollama", children: "Ollama" })
|
|
38934
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "ollama", children: "Ollama" }),
|
|
38935
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_material43.MenuItem, { value: "xai", children: "xAI" })
|
|
38711
38936
|
]
|
|
38712
38937
|
}
|
|
38713
38938
|
)
|
|
@@ -38791,6 +39016,30 @@ var ProviderTab = () => {
|
|
|
38791
39016
|
}
|
|
38792
39017
|
)
|
|
38793
39018
|
] }),
|
|
39019
|
+
providerConfig.type === "xai" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_material43.Box, { children: [
|
|
39020
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
39021
|
+
import_material43.TextField,
|
|
39022
|
+
{
|
|
39023
|
+
label: "API Base URL",
|
|
39024
|
+
value: providerConfig.baseUrl || "",
|
|
39025
|
+
onChange: (e) => setProviderConfig({ ...providerConfig, baseUrl: e.target.value }),
|
|
39026
|
+
fullWidth: true,
|
|
39027
|
+
sx: { mb: 2 },
|
|
39028
|
+
placeholder: "https://api.x.ai/v1"
|
|
39029
|
+
}
|
|
39030
|
+
),
|
|
39031
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
39032
|
+
import_material43.TextField,
|
|
39033
|
+
{
|
|
39034
|
+
label: "API Key",
|
|
39035
|
+
type: "password",
|
|
39036
|
+
value: providerConfig.apiKey || "",
|
|
39037
|
+
onChange: (e) => setProviderConfig({ ...providerConfig, apiKey: e.target.value }),
|
|
39038
|
+
fullWidth: true,
|
|
39039
|
+
placeholder: "xai-..."
|
|
39040
|
+
}
|
|
39041
|
+
)
|
|
39042
|
+
] }),
|
|
38794
39043
|
providerConfig.type === "anthropic" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_material43.Box, { children: [
|
|
38795
39044
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
38796
39045
|
import_material43.TextField,
|
|
@@ -39019,20 +39268,20 @@ var MCPToolsTabV2 = () => {
|
|
|
39019
39268
|
}
|
|
39020
39269
|
}, [isLoaded]);
|
|
39021
39270
|
const localEnabledMap = (0, import_react54.useMemo)(() => {
|
|
39022
|
-
const
|
|
39271
|
+
const map21 = /* @__PURE__ */ new Map();
|
|
39023
39272
|
const sortedTools = [...localTools].sort((a, b) => {
|
|
39024
39273
|
if (a.isBuiltIn && !b.isBuiltIn) return -1;
|
|
39025
39274
|
if (!a.isBuiltIn && b.isBuiltIn) return 1;
|
|
39026
39275
|
return a.id.length - b.id.length;
|
|
39027
39276
|
});
|
|
39028
39277
|
sortedTools.forEach((t) => {
|
|
39029
|
-
|
|
39030
|
-
|
|
39278
|
+
map21.set(t.function.name, t.enabled);
|
|
39279
|
+
map21.set(t.id, t.enabled);
|
|
39031
39280
|
if (t.name) {
|
|
39032
|
-
|
|
39281
|
+
map21.set(t.name, t.enabled);
|
|
39033
39282
|
}
|
|
39034
39283
|
});
|
|
39035
|
-
return
|
|
39284
|
+
return map21;
|
|
39036
39285
|
}, [localTools]);
|
|
39037
39286
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { children: [
|
|
39038
39287
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_material44.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|