@bytexbyte/nxtlinq-ai-agent-sdk 1.6.29 → 1.6.30
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/components/context/ChatBotContext.d.ts.map +1 -1
- package/dist/components/context/ChatBotContext.js +204 -66
- package/dist/components/types/ChatBotTypes.d.ts +8 -1
- package/dist/components/types/ChatBotTypes.d.ts.map +1 -1
- package/dist/components/ui/ChatBotUI.d.ts.map +1 -1
- package/dist/components/ui/ChatBotUI.js +255 -16
- package/dist/components/ui/MessageList.d.ts.map +1 -1
- package/dist/components/ui/MessageList.js +6 -2
- package/dist/components/ui/styles/isolatedStyles.d.ts +14 -0
- package/dist/components/ui/styles/isolatedStyles.d.ts.map +1 -1
- package/dist/components/ui/styles/isolatedStyles.js +138 -7
- package/dist/core/lib/textToSpeech.js +1 -1
- package/dist/core/lib/useDraggable.d.ts +15 -0
- package/dist/core/lib/useDraggable.d.ts.map +1 -0
- package/dist/core/lib/useDraggable.js +158 -0
- package/dist/core/lib/useResizable.d.ts +16 -0
- package/dist/core/lib/useResizable.d.ts.map +1 -0
- package/dist/core/lib/useResizable.js +180 -0
- package/dist/core/lib/useSpeechToTextFromMic/helper.d.ts.map +1 -1
- package/dist/core/lib/useSpeechToTextFromMic/helper.js +13 -1
- package/dist/types/ait-api.d.ts +6 -0
- package/dist/types/ait-api.d.ts.map +1 -1
- package/package.json +1 -1
- package/umd/nxtlinq-ai-agent.umd.js +1 -1
- package/dist/assets/images/adilasDogHeadTiltDataUri.d.ts +0 -2
- package/dist/assets/images/adilasDogHeadTiltDataUri.d.ts.map +0 -1
- package/dist/assets/images/adilasDogHeadTiltDataUri.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA8rFlD,CAAC"}
|
|
@@ -34,7 +34,9 @@ customUsername,
|
|
|
34
34
|
// IDV suggestion banner configuration
|
|
35
35
|
idvBannerDismissSeconds = 86400,
|
|
36
36
|
// 24 hours in seconds
|
|
37
|
-
isStopRecordingOnSend = false,
|
|
37
|
+
isStopRecordingOnSend = false,
|
|
38
|
+
// Custom error message to display in chat
|
|
39
|
+
customError, }) => {
|
|
38
40
|
// Set API hosts immediately based on environment (before any API calls)
|
|
39
41
|
setApiHosts(environment);
|
|
40
42
|
const nxtlinqApi = React.useMemo(() => createNxtlinqApi(apiKey, apiSecret), [apiKey, apiSecret]);
|
|
@@ -121,6 +123,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
121
123
|
const lastPartialRangeRef = React.useRef(null);
|
|
122
124
|
const lastAutoSentTranscriptRef = React.useRef('');
|
|
123
125
|
const autoSendTimerRef = React.useRef(null);
|
|
126
|
+
const lastCustomErrorRef = React.useRef(undefined);
|
|
124
127
|
function insertPartial(input, partial, caret) {
|
|
125
128
|
let start = caret;
|
|
126
129
|
let end = caret;
|
|
@@ -1544,46 +1547,114 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1544
1547
|
}]);
|
|
1545
1548
|
return;
|
|
1546
1549
|
}
|
|
1547
|
-
|
|
1550
|
+
// Create streaming message for tool execution
|
|
1551
|
+
const streamingMessageId = `streaming-${Date.now()}`;
|
|
1552
|
+
const streamingMessage = {
|
|
1553
|
+
id: streamingMessageId,
|
|
1554
|
+
content: '',
|
|
1555
|
+
role: 'assistant',
|
|
1556
|
+
timestamp: new Date().toISOString(),
|
|
1557
|
+
isStreaming: true,
|
|
1558
|
+
streamingToolName: toolUse.name,
|
|
1559
|
+
streamingStatus: `Starting ${toolUse.name}...`,
|
|
1560
|
+
streamingProgress: 0,
|
|
1561
|
+
streamingSteps: [],
|
|
1562
|
+
metadata: {
|
|
1563
|
+
model: actualModelUsed,
|
|
1564
|
+
permissions: permissions,
|
|
1565
|
+
issuedBy: hitAddress || '',
|
|
1566
|
+
toolUse: toolUse
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
// Add streaming message to chat
|
|
1570
|
+
setMessages(prev => [...prev, streamingMessage]);
|
|
1571
|
+
// Execute tool with streaming updates
|
|
1572
|
+
const toolResult = await onToolUse(toolUse, (update) => {
|
|
1573
|
+
// Update streaming message with progress
|
|
1574
|
+
setMessages(prev => prev.map(msg => msg.id === streamingMessageId
|
|
1575
|
+
? {
|
|
1576
|
+
...msg,
|
|
1577
|
+
content: update.partialResult || msg.content,
|
|
1578
|
+
partialContent: update.partialContent, // Token-level streaming
|
|
1579
|
+
streamingProgress: update.progress,
|
|
1580
|
+
streamingStatus: update.status,
|
|
1581
|
+
streamingSteps: update.steps || msg.streamingSteps
|
|
1582
|
+
}
|
|
1583
|
+
: msg));
|
|
1584
|
+
});
|
|
1548
1585
|
toolMsg = toolResult?.content || `Tool ${toolUse.name} executed successfully`;
|
|
1586
|
+
// Merge AI original reply
|
|
1587
|
+
let replyText = '';
|
|
1588
|
+
if (response.reply) {
|
|
1589
|
+
replyText = Array.isArray(response.reply)
|
|
1590
|
+
? response.reply
|
|
1591
|
+
.map((item) => item.text)
|
|
1592
|
+
.join(' ') || ''
|
|
1593
|
+
: response.reply || '';
|
|
1594
|
+
}
|
|
1595
|
+
else if (response.fullResponse?.output?.message?.content) {
|
|
1596
|
+
replyText = response.fullResponse.output.message.content
|
|
1597
|
+
?.find((item) => item.text)?.text || '';
|
|
1598
|
+
}
|
|
1599
|
+
let finalContent = toolMsg;
|
|
1600
|
+
if (replyText && replyText.trim()) {
|
|
1601
|
+
finalContent += `\n\n${replyText}`;
|
|
1602
|
+
}
|
|
1603
|
+
// Mark streaming as complete with final content
|
|
1604
|
+
setMessages(prev => prev.map(msg => msg.id === streamingMessageId
|
|
1605
|
+
? {
|
|
1606
|
+
...msg,
|
|
1607
|
+
isStreaming: false,
|
|
1608
|
+
streamingProgress: 100,
|
|
1609
|
+
content: finalContent,
|
|
1610
|
+
metadata: {
|
|
1611
|
+
...msg.metadata,
|
|
1612
|
+
model: actualModelUsed,
|
|
1613
|
+
toolUse: toolUse
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
: msg));
|
|
1617
|
+
updateSuggestions(pseudoId, localStorage.getItem('walletAddress') || undefined);
|
|
1618
|
+
// Skip creating a new botResponse since we already updated the streaming message
|
|
1549
1619
|
}
|
|
1550
1620
|
else {
|
|
1551
1621
|
toolMsg = `Tool ${toolUse.name} executed successfully`;
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
.
|
|
1560
|
-
: response.reply || '';
|
|
1561
|
-
}
|
|
1562
|
-
else if (response.fullResponse?.output?.message?.content) {
|
|
1563
|
-
replyText = response.fullResponse.output.message.content
|
|
1564
|
-
?.find((item) => item.text)?.text || '';
|
|
1565
|
-
}
|
|
1566
|
-
let mergedContent = '';
|
|
1567
|
-
if (toolMsg) {
|
|
1568
|
-
mergedContent += toolMsg;
|
|
1569
|
-
}
|
|
1570
|
-
if (replyText && replyText.trim()) {
|
|
1571
|
-
mergedContent += `\n\n${replyText}`;
|
|
1572
|
-
}
|
|
1573
|
-
updateSuggestions(pseudoId, localStorage.getItem('walletAddress') || undefined);
|
|
1574
|
-
botResponse = {
|
|
1575
|
-
id: (Date.now() + 1).toString(),
|
|
1576
|
-
content: mergedContent,
|
|
1577
|
-
role: 'assistant',
|
|
1578
|
-
timestamp: new Date().toISOString(),
|
|
1579
|
-
metadata: {
|
|
1580
|
-
model: actualModelUsed,
|
|
1581
|
-
permissions: permissions,
|
|
1582
|
-
issuedBy: hitAddress || '',
|
|
1583
|
-
toolUse: toolUse
|
|
1622
|
+
// No onToolUse callback - create message without streaming
|
|
1623
|
+
let replyText = '';
|
|
1624
|
+
if (response.reply) {
|
|
1625
|
+
replyText = Array.isArray(response.reply)
|
|
1626
|
+
? response.reply
|
|
1627
|
+
.map((item) => item.text)
|
|
1628
|
+
.join(' ') || ''
|
|
1629
|
+
: response.reply || '';
|
|
1584
1630
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1631
|
+
else if (response.fullResponse?.output?.message?.content) {
|
|
1632
|
+
replyText = response.fullResponse.output.message.content
|
|
1633
|
+
?.find((item) => item.text)?.text || '';
|
|
1634
|
+
}
|
|
1635
|
+
let mergedContent = '';
|
|
1636
|
+
if (toolMsg) {
|
|
1637
|
+
mergedContent += toolMsg;
|
|
1638
|
+
}
|
|
1639
|
+
if (replyText && replyText.trim()) {
|
|
1640
|
+
mergedContent += `\n\n${replyText}`;
|
|
1641
|
+
}
|
|
1642
|
+
updateSuggestions(pseudoId, localStorage.getItem('walletAddress') || undefined);
|
|
1643
|
+
const newBotResponse = {
|
|
1644
|
+
id: (Date.now() + 1).toString(),
|
|
1645
|
+
content: mergedContent,
|
|
1646
|
+
role: 'assistant',
|
|
1647
|
+
timestamp: new Date().toISOString(),
|
|
1648
|
+
metadata: {
|
|
1649
|
+
model: actualModelUsed,
|
|
1650
|
+
permissions: permissions,
|
|
1651
|
+
issuedBy: hitAddress || '',
|
|
1652
|
+
toolUse: toolUse
|
|
1653
|
+
}
|
|
1654
|
+
};
|
|
1655
|
+
setMessages(prev => [...prev, newBotResponse]);
|
|
1656
|
+
botResponse = newBotResponse;
|
|
1657
|
+
}
|
|
1587
1658
|
}
|
|
1588
1659
|
else if (response.reply) {
|
|
1589
1660
|
const replyText = Array.isArray(response.reply)
|
|
@@ -1592,7 +1663,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1592
1663
|
.join(' ') || 'Sorry, I cannot understand your question'
|
|
1593
1664
|
: response.reply || 'Sorry, I cannot understand your question';
|
|
1594
1665
|
updateSuggestions(pseudoId, localStorage.getItem('walletAddress') || undefined);
|
|
1595
|
-
|
|
1666
|
+
const newBotResponse = {
|
|
1596
1667
|
id: (Date.now() + 1).toString(),
|
|
1597
1668
|
content: replyText,
|
|
1598
1669
|
role: 'assistant',
|
|
@@ -1603,12 +1674,13 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1603
1674
|
issuedBy: hitAddress || ''
|
|
1604
1675
|
}
|
|
1605
1676
|
};
|
|
1606
|
-
setMessages(prev => [...prev,
|
|
1677
|
+
setMessages(prev => [...prev, newBotResponse]);
|
|
1678
|
+
botResponse = newBotResponse;
|
|
1607
1679
|
}
|
|
1608
1680
|
else {
|
|
1609
1681
|
const replyText = response.fullResponse?.output?.message?.content
|
|
1610
1682
|
?.find((item) => item.text)?.text || 'Sorry, I cannot understand your question';
|
|
1611
|
-
|
|
1683
|
+
const newBotResponse = {
|
|
1612
1684
|
id: (Date.now() + 1).toString(),
|
|
1613
1685
|
content: replyText,
|
|
1614
1686
|
role: 'assistant',
|
|
@@ -1619,7 +1691,8 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1619
1691
|
issuedBy: hitAddress || ''
|
|
1620
1692
|
}
|
|
1621
1693
|
};
|
|
1622
|
-
setMessages(prev => [...prev,
|
|
1694
|
+
setMessages(prev => [...prev, newBotResponse]);
|
|
1695
|
+
botResponse = newBotResponse;
|
|
1623
1696
|
}
|
|
1624
1697
|
// Execute redirect after all message processing is complete
|
|
1625
1698
|
if (redirectUrl) {
|
|
@@ -1692,14 +1765,22 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1692
1765
|
if (isMicEnabledRef.current) {
|
|
1693
1766
|
await sleep(1000);
|
|
1694
1767
|
clearRecording();
|
|
1695
|
-
// Reset auto-sent transcript ref when clearing recording
|
|
1696
|
-
lastAutoSentTranscriptRef.current = '';
|
|
1697
1768
|
}
|
|
1698
1769
|
}
|
|
1699
1770
|
if (!textInputRef.current)
|
|
1700
1771
|
return;
|
|
1701
1772
|
if (!textInputRef.current.value.trim() || isLoading)
|
|
1702
1773
|
return;
|
|
1774
|
+
// 如果此時有語音自動發送的計時器,優先取消,避免與手動發送同內容時重複送出
|
|
1775
|
+
if (autoSendTimerRef.current) {
|
|
1776
|
+
clearTimeout(autoSendTimerRef.current);
|
|
1777
|
+
autoSendTimerRef.current = null;
|
|
1778
|
+
}
|
|
1779
|
+
// 標記這次手動送出的內容,讓語音自動發送邏輯視為已送出,避免同一段文字再自動發送一次
|
|
1780
|
+
const manualContent = textInputRef.current.value.trim();
|
|
1781
|
+
if (manualContent) {
|
|
1782
|
+
lastAutoSentTranscriptRef.current = manualContent;
|
|
1783
|
+
}
|
|
1703
1784
|
// Stop current speech playback when user sends new message
|
|
1704
1785
|
stopTextToSpeechAndReset();
|
|
1705
1786
|
// Show loading message if AIT is still loading
|
|
@@ -1767,6 +1848,12 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1767
1848
|
setIsTtsProcessing(false);
|
|
1768
1849
|
pendingTtsRef.current = null;
|
|
1769
1850
|
}, [stopTextToSpeech]);
|
|
1851
|
+
// When TTS is disabled during playback, stop immediately
|
|
1852
|
+
React.useEffect(() => {
|
|
1853
|
+
if (!textToSpeechEnabled) {
|
|
1854
|
+
stopTextToSpeechAndReset();
|
|
1855
|
+
}
|
|
1856
|
+
}, [textToSpeechEnabled, stopTextToSpeechAndReset]);
|
|
1770
1857
|
// Play text-to-speech (simplified, no queue)
|
|
1771
1858
|
const playTextToSpeech = React.useCallback(async (text, messageIndex) => {
|
|
1772
1859
|
if (!textToSpeechEnabled || !text.trim())
|
|
@@ -1794,13 +1881,57 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1794
1881
|
console.error('TTS playback failed after retries:', lastError);
|
|
1795
1882
|
setIsTtsProcessing(false);
|
|
1796
1883
|
}, [textToSpeechEnabled, stopTextToSpeech, playTextToSpeechWithRetry]);
|
|
1884
|
+
const retryTtsWithGesture = React.useCallback(async () => {
|
|
1885
|
+
try {
|
|
1886
|
+
setRequiresGesture(false);
|
|
1887
|
+
// Try to resume audio context
|
|
1888
|
+
if (audioCtxRef.current) {
|
|
1889
|
+
try {
|
|
1890
|
+
await audioCtxRef.current.resume();
|
|
1891
|
+
}
|
|
1892
|
+
catch { }
|
|
1893
|
+
}
|
|
1894
|
+
const pending = pendingTtsRef.current;
|
|
1895
|
+
if (pending && textToSpeechEnabled) {
|
|
1896
|
+
setIsTtsProcessing(true);
|
|
1897
|
+
await playTextToSpeech(pending);
|
|
1898
|
+
pendingTtsRef.current = null;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
catch (err) {
|
|
1902
|
+
console.error('Retry TTS with gesture failed:', err);
|
|
1903
|
+
setIsTtsProcessing(false);
|
|
1904
|
+
}
|
|
1905
|
+
}, [textToSpeechEnabled, playTextToSpeech]);
|
|
1906
|
+
// When browser blocks autoplay (requires gesture), retry on next user interaction
|
|
1907
|
+
React.useEffect(() => {
|
|
1908
|
+
if (!requiresGesture || !textToSpeechEnabled || !pendingTtsRef.current)
|
|
1909
|
+
return;
|
|
1910
|
+
const handleUserGesture = () => {
|
|
1911
|
+
retryTtsWithGesture();
|
|
1912
|
+
};
|
|
1913
|
+
window.addEventListener('pointerdown', handleUserGesture, { once: true });
|
|
1914
|
+
return () => window.removeEventListener('pointerdown', handleUserGesture);
|
|
1915
|
+
}, [requiresGesture, textToSpeechEnabled, retryTtsWithGesture]);
|
|
1797
1916
|
// Handle preset message
|
|
1798
1917
|
const handlePresetMessage = (message) => {
|
|
1918
|
+
// If preset is configured as auto-send, avoid duplicate sends when user clicks repeatedly
|
|
1799
1919
|
if (message.autoSend) {
|
|
1920
|
+
const trimmedText = (message.text || '').trim();
|
|
1921
|
+
if (!trimmedText)
|
|
1922
|
+
return;
|
|
1923
|
+
// Prevent sending messages while AI Agent is processing
|
|
1924
|
+
if (isLoading) {
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1927
|
+
// If this exact preset text was just sent (by auto-send / manual / preset), skip to prevent duplicates
|
|
1928
|
+
if (lastAutoSentTranscriptRef.current === trimmedText) {
|
|
1929
|
+
return;
|
|
1930
|
+
}
|
|
1800
1931
|
// For preset messages, we need to add the user message first since sendMessage won't add it on retries
|
|
1801
1932
|
const userMessage = {
|
|
1802
1933
|
id: Date.now().toString(),
|
|
1803
|
-
content:
|
|
1934
|
+
content: trimmedText,
|
|
1804
1935
|
role: 'user',
|
|
1805
1936
|
timestamp: new Date().toISOString(),
|
|
1806
1937
|
metadata: {
|
|
@@ -1810,8 +1941,10 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1810
1941
|
}
|
|
1811
1942
|
};
|
|
1812
1943
|
setMessages(prev => [...prev, userMessage]);
|
|
1944
|
+
// Mark as last sent to guard against rapid re-clicks and other duplicate flows
|
|
1945
|
+
lastAutoSentTranscriptRef.current = trimmedText;
|
|
1813
1946
|
// Pass a flag to indicate this is a preset message so sendMessage won't add user message again
|
|
1814
|
-
sendMessage(
|
|
1947
|
+
sendMessage(trimmedText, 0, true);
|
|
1815
1948
|
}
|
|
1816
1949
|
else {
|
|
1817
1950
|
setInputValue(message.text);
|
|
@@ -2233,6 +2366,31 @@ isStopRecordingOnSend = false, }) => {
|
|
|
2233
2366
|
}
|
|
2234
2367
|
}
|
|
2235
2368
|
}, [hitAddress]);
|
|
2369
|
+
// Handle custom error message display
|
|
2370
|
+
React.useEffect(() => {
|
|
2371
|
+
const trimmedError = customError?.trim();
|
|
2372
|
+
// Only display error if it's a new value (different from last displayed error)
|
|
2373
|
+
if (trimmedError && trimmedError !== lastCustomErrorRef.current) {
|
|
2374
|
+
lastCustomErrorRef.current = trimmedError;
|
|
2375
|
+
const errorMessage = {
|
|
2376
|
+
id: `custom-error-${Date.now()}`,
|
|
2377
|
+
content: trimmedError,
|
|
2378
|
+
role: 'assistant',
|
|
2379
|
+
timestamp: new Date().toISOString(),
|
|
2380
|
+
metadata: {
|
|
2381
|
+
model: getCurrentModel().value,
|
|
2382
|
+
permissions: permissions,
|
|
2383
|
+
issuedBy: hitAddress || ''
|
|
2384
|
+
}
|
|
2385
|
+
};
|
|
2386
|
+
setMessages(prev => [...prev, errorMessage]);
|
|
2387
|
+
onMessage?.(errorMessage);
|
|
2388
|
+
}
|
|
2389
|
+
else if (!trimmedError) {
|
|
2390
|
+
// Reset ref when customError is cleared
|
|
2391
|
+
lastCustomErrorRef.current = undefined;
|
|
2392
|
+
}
|
|
2393
|
+
}, [customError, getCurrentModel, permissions, hitAddress, onMessage]);
|
|
2236
2394
|
React.useEffect(() => {
|
|
2237
2395
|
if (messages.length > 0) {
|
|
2238
2396
|
const lastMessage = messages[messages.length - 1];
|
|
@@ -2337,28 +2495,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
2337
2495
|
// Speech related functions
|
|
2338
2496
|
playTextToSpeech,
|
|
2339
2497
|
stopTextToSpeech,
|
|
2340
|
-
retryTtsWithGesture
|
|
2341
|
-
try {
|
|
2342
|
-
setRequiresGesture(false);
|
|
2343
|
-
// Try to resume audio context
|
|
2344
|
-
if (audioCtxRef.current) {
|
|
2345
|
-
try {
|
|
2346
|
-
await audioCtxRef.current.resume();
|
|
2347
|
-
}
|
|
2348
|
-
catch { }
|
|
2349
|
-
}
|
|
2350
|
-
const pending = pendingTtsRef.current;
|
|
2351
|
-
if (pending && textToSpeechEnabled) {
|
|
2352
|
-
setIsTtsProcessing(true);
|
|
2353
|
-
await playTextToSpeech(pending);
|
|
2354
|
-
pendingTtsRef.current = null;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
catch (err) {
|
|
2358
|
-
console.error('Retry TTS with gesture failed:', err);
|
|
2359
|
-
setIsTtsProcessing(false);
|
|
2360
|
-
}
|
|
2361
|
-
},
|
|
2498
|
+
retryTtsWithGesture,
|
|
2362
2499
|
// Additional properties for PermissionForm
|
|
2363
2500
|
onSave: savePermissions,
|
|
2364
2501
|
onConnectWallet: () => connectWallet(false),
|
|
@@ -2390,6 +2527,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
2390
2527
|
customUsername,
|
|
2391
2528
|
idvBannerDismissSeconds,
|
|
2392
2529
|
isStopRecordingOnSend,
|
|
2530
|
+
customError,
|
|
2393
2531
|
},
|
|
2394
2532
|
nxtlinqApi
|
|
2395
2533
|
};
|
|
@@ -31,7 +31,13 @@ export interface AIModel {
|
|
|
31
31
|
export interface ChatBotProps {
|
|
32
32
|
onMessage?: (message: Message) => void;
|
|
33
33
|
onError?: (error: Error) => void;
|
|
34
|
-
onToolUse?: (toolUse: ToolUse
|
|
34
|
+
onToolUse?: (toolUse: ToolUse, onProgress?: (update: {
|
|
35
|
+
status?: string;
|
|
36
|
+
progress?: number;
|
|
37
|
+
partialResult?: string;
|
|
38
|
+
steps?: string[];
|
|
39
|
+
partialContent?: string;
|
|
40
|
+
}) => void) => Promise<Message | void>;
|
|
35
41
|
presetMessages?: PresetMessage[];
|
|
36
42
|
placeholder?: string;
|
|
37
43
|
className?: string;
|
|
@@ -55,6 +61,7 @@ export interface ChatBotProps {
|
|
|
55
61
|
idvBannerDismissSeconds?: number;
|
|
56
62
|
berifymeMode?: 'built-in' | 'external';
|
|
57
63
|
isStopRecordingOnSend?: boolean;
|
|
64
|
+
customError?: string;
|
|
58
65
|
}
|
|
59
66
|
export interface ChatBotContextType {
|
|
60
67
|
messages: Message[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotTypes.d.ts","sourceRoot":"","sources":["../../../src/components/types/ChatBotTypes.ts"],"names":[],"mappings":"AAAA,OAA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x"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatBotUI.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ChatBotUI.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8F/B,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAooB7B,CAAC"}
|