@bytexbyte/nxtlinq-ai-agent-sdk 1.2.4 → 1.2.6
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 +204 -55
- package/dist/components/context/ChatBotContext.d.ts.map +1 -1
- package/dist/components/context/ChatBotContext.js +320 -86
- package/dist/components/types/ChatBotTypes.d.ts +4 -2
- 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 +73 -8
- package/dist/components/ui/MessageInput.d.ts.map +1 -1
- package/dist/components/ui/MessageInput.js +7 -4
- package/dist/components/ui/MessageList.d.ts.map +1 -1
- package/dist/components/ui/MessageList.js +40 -11
- package/dist/components/ui/PermissionForm.d.ts.map +1 -1
- package/dist/components/ui/PermissionForm.js +60 -23
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/types/ait-api.d.ts +2 -0
- package/dist/types/ait-api.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,81 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useChatBot } from '../context/ChatBotContext';
|
|
4
|
-
import { NotificationModal } from './NotificationModal';
|
|
5
4
|
import { PermissionForm } from './PermissionForm';
|
|
6
5
|
import { MessageList } from './MessageList';
|
|
7
6
|
import { MessageInput } from './MessageInput';
|
|
8
7
|
import { PresetMessages } from './PresetMessages';
|
|
9
8
|
import { ModelSelector } from './ModelSelector';
|
|
9
|
+
// Toast Notification Component
|
|
10
|
+
const ToastNotification = ({ type, message, onClose, isChatOpen = false }) => {
|
|
11
|
+
const getStyles = () => {
|
|
12
|
+
const baseStyles = {
|
|
13
|
+
position: 'fixed',
|
|
14
|
+
padding: '12px 24px',
|
|
15
|
+
borderRadius: 8,
|
|
16
|
+
zIndex: 2000,
|
|
17
|
+
fontWeight: 600,
|
|
18
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
|
|
19
|
+
transition: 'all 0.3s ease',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
gap: '12px',
|
|
23
|
+
minWidth: '300px',
|
|
24
|
+
maxWidth: '500px'
|
|
25
|
+
};
|
|
26
|
+
// Dynamically adjust position based on chat window state
|
|
27
|
+
if (isChatOpen) {
|
|
28
|
+
// When chat window is open, show notification above the chat window
|
|
29
|
+
Object.assign(baseStyles, {
|
|
30
|
+
top: 20,
|
|
31
|
+
right: 20, // Align with the right edge of chat window
|
|
32
|
+
maxWidth: '480px', // Slightly smaller than chat window width
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// When chat window is closed, show notification in bottom right corner
|
|
37
|
+
Object.assign(baseStyles, {
|
|
38
|
+
bottom: 20,
|
|
39
|
+
right: 20,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
switch (type) {
|
|
43
|
+
case 'success':
|
|
44
|
+
return { ...baseStyles, background: '#4caf50', color: 'white' };
|
|
45
|
+
case 'error':
|
|
46
|
+
return { ...baseStyles, background: '#f44336', color: 'white' };
|
|
47
|
+
case 'warning':
|
|
48
|
+
return { ...baseStyles, background: '#ff9800', color: 'white' };
|
|
49
|
+
default:
|
|
50
|
+
return { ...baseStyles, background: '#2196f3', color: 'white' };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const getIcon = () => {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case 'success':
|
|
56
|
+
return '✅';
|
|
57
|
+
case 'error':
|
|
58
|
+
return '❌';
|
|
59
|
+
case 'warning':
|
|
60
|
+
return '⚠️';
|
|
61
|
+
default:
|
|
62
|
+
return 'ℹ️';
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return (_jsxs("div", { style: getStyles(), children: [_jsx("span", { style: { fontSize: '18px' }, children: getIcon() }), _jsx("span", { style: { flex: 1 }, children: message }), _jsx("button", { onClick: onClose, style: {
|
|
66
|
+
background: 'none',
|
|
67
|
+
border: 'none',
|
|
68
|
+
color: 'white',
|
|
69
|
+
fontSize: '18px',
|
|
70
|
+
cursor: 'pointer',
|
|
71
|
+
padding: '4px',
|
|
72
|
+
display: 'flex',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
justifyContent: 'center',
|
|
75
|
+
borderRadius: '4px',
|
|
76
|
+
transition: 'background-color 0.2s'
|
|
77
|
+
}, onMouseOver: (e) => e.currentTarget.style.backgroundColor = 'rgba(255, 255, 255, 0.2)', onMouseOut: (e) => e.currentTarget.style.backgroundColor = 'transparent', children: "\u00D7" })] }));
|
|
78
|
+
};
|
|
10
79
|
export const ChatBotUI = () => {
|
|
11
80
|
const { isOpen, setIsOpen, showPermissionForm, setShowPermissionForm, notification, setNotification, isAITLoading, props: { className = '' } } = useChatBot();
|
|
12
81
|
// Add CSS animation for loading spinner
|
|
@@ -58,9 +127,7 @@ export const ChatBotUI = () => {
|
|
|
58
127
|
}, onMouseOut: (e) => {
|
|
59
128
|
e.currentTarget.style.backgroundColor = '#007bff';
|
|
60
129
|
e.currentTarget.style.transform = 'translateY(0)';
|
|
61
|
-
}, title: "Open AI Agent Chat", children: "AI Agent" }), notification.show && (_jsx(
|
|
62
|
-
notification.type === 'error' ? 'Error' :
|
|
63
|
-
notification.type === 'warning' ? 'Warning' : 'Info', message: notification.message, onClose: handleCloseNotification }))] }));
|
|
130
|
+
}, title: "Open AI Agent Chat", children: "AI Agent" }), notification.show && (_jsx(ToastNotification, { type: notification.type, message: notification.message, onClose: handleCloseNotification, isChatOpen: isOpen }))] }));
|
|
64
131
|
}
|
|
65
132
|
return (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
|
|
66
133
|
position: 'fixed',
|
|
@@ -141,7 +208,5 @@ export const ChatBotUI = () => {
|
|
|
141
208
|
alignItems: 'center',
|
|
142
209
|
justifyContent: 'center',
|
|
143
210
|
zIndex: 1002
|
|
144
|
-
}, children: _jsx(PermissionForm, { onClose: () => setShowPermissionForm(false), onOpen: () => setShowPermissionForm(true) }) })), notification.show && (_jsx(
|
|
145
|
-
notification.type === 'error' ? 'Error' :
|
|
146
|
-
notification.type === 'warning' ? 'Warning' : 'Info', message: notification.message, onClose: handleCloseNotification }))] }));
|
|
211
|
+
}, children: _jsx(PermissionForm, { onClose: () => setShowPermissionForm(false), onOpen: () => setShowPermissionForm(true) }) })), notification.show && (_jsx(ToastNotification, { type: notification.type, message: notification.message, onClose: handleCloseNotification, isChatOpen: isOpen }))] }));
|
|
147
212
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAsFhC,CAAC"}
|
|
@@ -3,7 +3,6 @@ import { useChatBot } from '../context/ChatBotContext';
|
|
|
3
3
|
export const MessageInput = () => {
|
|
4
4
|
const { inputValue, setInputValue, isLoading, isAITLoading, handleSubmit, props: { placeholder = 'Type a message...' } } = useChatBot();
|
|
5
5
|
const isDisabled = isLoading || isAITLoading;
|
|
6
|
-
const buttonText = isLoading ? 'Sending...' : isAITLoading ? 'Loading...' : 'Send';
|
|
7
6
|
const inputPlaceholder = isAITLoading ? 'Loading wallet configuration...' : placeholder;
|
|
8
7
|
const handleKeyPress = (e) => {
|
|
9
8
|
if (e.key === 'Enter' && !e.shiftKey) {
|
|
@@ -24,7 +23,7 @@ export const MessageInput = () => {
|
|
|
24
23
|
outline: 'none',
|
|
25
24
|
fontSize: '14px',
|
|
26
25
|
backgroundColor: isDisabled ? '#f8f9fa' : '#fff'
|
|
27
|
-
} }),
|
|
26
|
+
} }), _jsxs("button", { onClick: (e) => handleSubmit(e), disabled: isDisabled || !inputValue.trim(), style: {
|
|
28
27
|
backgroundColor: isDisabled || !inputValue.trim() ? '#e9ecef' : '#007bff',
|
|
29
28
|
color: isDisabled || !inputValue.trim() ? '#6c757d' : 'white',
|
|
30
29
|
border: 'none',
|
|
@@ -33,7 +32,11 @@ export const MessageInput = () => {
|
|
|
33
32
|
cursor: isDisabled || !inputValue.trim() ? 'not-allowed' : 'pointer',
|
|
34
33
|
fontSize: '14px',
|
|
35
34
|
fontWeight: '500',
|
|
36
|
-
transition: 'background-color 0.3s'
|
|
35
|
+
transition: 'background-color 0.3s',
|
|
36
|
+
position: 'relative',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center'
|
|
37
40
|
}, onMouseOver: (e) => {
|
|
38
41
|
if (!isDisabled && inputValue.trim()) {
|
|
39
42
|
e.currentTarget.style.backgroundColor = '#0056b3';
|
|
@@ -42,5 +45,5 @@ export const MessageInput = () => {
|
|
|
42
45
|
if (!isDisabled && inputValue.trim()) {
|
|
43
46
|
e.currentTarget.style.backgroundColor = '#007bff';
|
|
44
47
|
}
|
|
45
|
-
}, children:
|
|
48
|
+
}, children: ["Send", (isLoading || isAITLoading) && (_jsx("span", { style: { marginLeft: 8, display: 'flex', alignItems: 'center' }, children: _jsx("svg", { width: "16", height: "16", viewBox: "0 0 50 50", children: _jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: "#fff", strokeWidth: "4", strokeDasharray: "31.4 31.4", strokeLinecap: "round", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 25 25", to: "360 25 25", dur: "1s", repeatCount: "indefinite" }) }) }) }))] })] }));
|
|
46
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EA6K/B,CAAC"}
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useChatBot } from '../context/ChatBotContext';
|
|
4
4
|
import { AI_MODEL_MAP } from '../types/ChatBotTypes';
|
|
5
5
|
export const MessageList = () => {
|
|
6
|
-
const { messages, isLoading, connectWallet, signInWallet, hitAddress, ait, setShowPermissionForm, isWalletLoading } = useChatBot();
|
|
6
|
+
const { messages, isLoading, connectWallet, signInWallet, hitAddress, ait, setShowPermissionForm, isWalletLoading, isAutoConnecting, isNeedSignInWithWallet, autoEnableAIT, isAITLoading } = useChatBot();
|
|
7
7
|
const messagesEndRef = React.useRef(null);
|
|
8
8
|
const scrollToBottom = () => {
|
|
9
9
|
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
|
@@ -11,13 +11,23 @@ export const MessageList = () => {
|
|
|
11
11
|
React.useEffect(() => {
|
|
12
12
|
scrollToBottom();
|
|
13
13
|
}, [messages]);
|
|
14
|
-
const handleButtonClick = (buttonType) => {
|
|
14
|
+
const handleButtonClick = async (buttonType, message) => {
|
|
15
15
|
if (buttonType === 'connect') {
|
|
16
16
|
connectWallet(true);
|
|
17
17
|
}
|
|
18
18
|
else if (buttonType === 'signIn') {
|
|
19
19
|
signInWallet(true);
|
|
20
20
|
}
|
|
21
|
+
else if (buttonType === 'enableAIT') {
|
|
22
|
+
const toolName = message.metadata?.toolName;
|
|
23
|
+
if (toolName) {
|
|
24
|
+
const success = await autoEnableAIT(toolName);
|
|
25
|
+
if (success) {
|
|
26
|
+
// If AIT is successfully enabled, you can choose to resend the user's last message
|
|
27
|
+
// Here you can add logic to reprocess the user's request
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
21
31
|
};
|
|
22
32
|
const getModelDisplayName = (modelValue) => {
|
|
23
33
|
if (!modelValue)
|
|
@@ -36,22 +46,41 @@ export const MessageList = () => {
|
|
|
36
46
|
maxWidth: '80%',
|
|
37
47
|
marginBottom: '10px'
|
|
38
48
|
}, children: [_jsxs("div", { style: {
|
|
39
|
-
backgroundColor: message.role === 'user' ? '#007bff' :
|
|
40
|
-
|
|
49
|
+
backgroundColor: message.role === 'user' ? '#007bff' :
|
|
50
|
+
message.metadata?.isRetry ? '#fff3cd' : '#f1f1f1',
|
|
51
|
+
color: message.role === 'user' ? 'white' :
|
|
52
|
+
message.metadata?.isRetry ? '#856404' : '#333',
|
|
41
53
|
padding: '10px 15px',
|
|
42
54
|
borderRadius: '15px',
|
|
43
55
|
wordWrap: 'break-word',
|
|
44
|
-
position: 'relative'
|
|
45
|
-
|
|
56
|
+
position: 'relative',
|
|
57
|
+
border: message.metadata?.isRetry ? '1px solid #ffeaa7' : 'none'
|
|
58
|
+
}, children: [message.metadata?.isRetry && (_jsx("span", { style: { marginRight: '8px', fontSize: '14px' }, children: "\uD83D\uDD04" })), message.content, message.button && (_jsx("div", { style: { marginTop: '10px' }, children: _jsx("button", { onClick: () => handleButtonClick(message.button, message), disabled: isAutoConnecting ||
|
|
59
|
+
(message.button === 'connect' && Boolean(hitAddress)) ||
|
|
60
|
+
(message.button === 'signIn' && !isNeedSignInWithWallet) ||
|
|
61
|
+
(message.button === 'enableAIT' && isAITLoading), style: {
|
|
46
62
|
padding: '8px 16px',
|
|
47
|
-
backgroundColor: message.role === 'user' ? 'rgba(255, 255, 255, 0.2)' :
|
|
63
|
+
backgroundColor: message.role === 'user' ? 'rgba(255, 255, 255, 0.2)' :
|
|
64
|
+
isAutoConnecting ? '#6c757d' :
|
|
65
|
+
(message.button === 'connect' && Boolean(hitAddress)) ? '#28a745' :
|
|
66
|
+
(message.button === 'signIn' && !isNeedSignInWithWallet) ? '#28a745' :
|
|
67
|
+
(message.button === 'enableAIT' && isAITLoading) ? '#6c757d' : '#007bff',
|
|
48
68
|
color: message.role === 'user' ? 'white' : 'white',
|
|
49
69
|
border: 'none',
|
|
50
70
|
borderRadius: '5px',
|
|
51
|
-
cursor:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
cursor: (isAutoConnecting ||
|
|
72
|
+
(message.button === 'connect' && Boolean(hitAddress)) ||
|
|
73
|
+
(message.button === 'signIn' && !isNeedSignInWithWallet) ||
|
|
74
|
+
(message.button === 'enableAIT' && isAITLoading)) ? 'not-allowed' : 'pointer',
|
|
75
|
+
fontSize: '14px',
|
|
76
|
+
opacity: (isAutoConnecting ||
|
|
77
|
+
(message.button === 'connect' && Boolean(hitAddress)) ||
|
|
78
|
+
(message.button === 'signIn' && !isNeedSignInWithWallet) ||
|
|
79
|
+
(message.button === 'enableAIT' && isAITLoading)) ? 0.8 : 1
|
|
80
|
+
}, children: isAutoConnecting ? 'Connecting...' :
|
|
81
|
+
message.button === 'connect' ? (Boolean(hitAddress) ? 'Connected' : 'Connect Wallet') :
|
|
82
|
+
message.button === 'signIn' ? (!isNeedSignInWithWallet ? 'Signed In' : 'Sign In') :
|
|
83
|
+
message.button === 'enableAIT' ? (isAITLoading ? 'Enabling...' : 'Enable AIT Permissions') : message.button }) }))] }), message.role === 'assistant' && message.metadata?.model && (_jsx("div", { style: {
|
|
55
84
|
display: 'flex',
|
|
56
85
|
alignItems: 'center',
|
|
57
86
|
marginTop: '4px',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAifxD,CAAC"}
|
|
@@ -5,6 +5,11 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
5
5
|
const { hitAddress, permissions, setPermissions, setIsDisabled, onSave, onConnectWallet, onSignIn, isNeedSignInWithWallet, walletInfo, onVerifyWallet, serviceId, nxtlinqApi, permissionGroup, isAITLoading, isWalletLoading = false } = useChatBot();
|
|
6
6
|
const [availablePermissions, setAvailablePermissions] = React.useState([]);
|
|
7
7
|
const [isSaving, setIsSaving] = React.useState(false);
|
|
8
|
+
const [tempPermissions, setTempPermissions] = React.useState(permissions);
|
|
9
|
+
// Update temp permissions when permissions change
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
setTempPermissions(permissions);
|
|
12
|
+
}, [permissions]);
|
|
8
13
|
const fetchAvailablePermissions = async () => {
|
|
9
14
|
if (!serviceId)
|
|
10
15
|
return;
|
|
@@ -30,12 +35,26 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
30
35
|
const handleSave = async () => {
|
|
31
36
|
setIsSaving(true);
|
|
32
37
|
try {
|
|
33
|
-
|
|
38
|
+
// Update the actual permissions with temp permissions
|
|
39
|
+
setPermissions(tempPermissions);
|
|
40
|
+
await onSave(tempPermissions);
|
|
34
41
|
}
|
|
35
42
|
finally {
|
|
36
43
|
setIsSaving(false);
|
|
37
44
|
}
|
|
38
45
|
};
|
|
46
|
+
const handleCancel = () => {
|
|
47
|
+
// Reset temp permissions to original permissions
|
|
48
|
+
setTempPermissions(permissions);
|
|
49
|
+
onClose();
|
|
50
|
+
};
|
|
51
|
+
// Check if permissions have changed
|
|
52
|
+
const hasPermissionChanges = () => {
|
|
53
|
+
if (tempPermissions.length !== permissions.length)
|
|
54
|
+
return true;
|
|
55
|
+
return tempPermissions.some(p => !permissions.includes(p)) ||
|
|
56
|
+
permissions.some(p => !tempPermissions.includes(p));
|
|
57
|
+
};
|
|
39
58
|
// Show loading state while checking wallet status
|
|
40
59
|
if (isWalletLoading) {
|
|
41
60
|
return (_jsxs("div", { style: {
|
|
@@ -132,17 +151,26 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
132
151
|
marginBottom: '24px',
|
|
133
152
|
fontSize: '16px',
|
|
134
153
|
color: '#666'
|
|
135
|
-
}, children: "Please connect your wallet first" }), _jsx("button", { onClick: onConnectWallet, style: {
|
|
154
|
+
}, children: "Please connect your wallet first" }), _jsx("button", { onClick: onConnectWallet, disabled: Boolean(hitAddress), style: {
|
|
136
155
|
padding: '12px 24px',
|
|
137
|
-
backgroundColor: '#007bff',
|
|
156
|
+
backgroundColor: Boolean(hitAddress) ? '#28a745' : '#007bff',
|
|
138
157
|
color: 'white',
|
|
139
158
|
border: 'none',
|
|
140
159
|
borderRadius: '8px',
|
|
141
|
-
cursor: 'pointer',
|
|
160
|
+
cursor: Boolean(hitAddress) ? 'not-allowed' : 'pointer',
|
|
142
161
|
fontSize: '16px',
|
|
143
162
|
fontWeight: '500',
|
|
144
|
-
transition: 'background-color 0.2s'
|
|
145
|
-
|
|
163
|
+
transition: 'background-color 0.2s',
|
|
164
|
+
opacity: Boolean(hitAddress) ? 0.8 : 1
|
|
165
|
+
}, onMouseOver: (e) => {
|
|
166
|
+
if (!Boolean(hitAddress)) {
|
|
167
|
+
e.currentTarget.style.backgroundColor = '#0056b3';
|
|
168
|
+
}
|
|
169
|
+
}, onMouseOut: (e) => {
|
|
170
|
+
if (!Boolean(hitAddress)) {
|
|
171
|
+
e.currentTarget.style.backgroundColor = '#007bff';
|
|
172
|
+
}
|
|
173
|
+
}, children: Boolean(hitAddress) ? 'Connected' : 'Connect Wallet' })] })) : isNeedSignInWithWallet ? (_jsxs("div", { style: { textAlign: 'center', padding: '32px 0' }, children: [_jsxs("div", { style: { marginBottom: '24px' }, children: [_jsx("h4", { style: {
|
|
146
174
|
marginBottom: '12px',
|
|
147
175
|
fontSize: '16px',
|
|
148
176
|
color: '#666'
|
|
@@ -158,17 +186,26 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
158
186
|
marginBottom: '24px',
|
|
159
187
|
fontSize: '16px',
|
|
160
188
|
color: '#666'
|
|
161
|
-
}, children: "Please sign in to continue" }), _jsx("button", { onClick: onSignIn, style: {
|
|
189
|
+
}, children: "Please sign in to continue" }), _jsx("button", { onClick: onSignIn, disabled: !isNeedSignInWithWallet, style: {
|
|
162
190
|
padding: '12px 24px',
|
|
163
|
-
backgroundColor: '#007bff',
|
|
191
|
+
backgroundColor: !isNeedSignInWithWallet ? '#28a745' : '#007bff',
|
|
164
192
|
color: 'white',
|
|
165
193
|
border: 'none',
|
|
166
194
|
borderRadius: '8px',
|
|
167
|
-
cursor: 'pointer',
|
|
195
|
+
cursor: !isNeedSignInWithWallet ? 'not-allowed' : 'pointer',
|
|
168
196
|
fontSize: '16px',
|
|
169
197
|
fontWeight: '500',
|
|
170
|
-
transition: 'background-color 0.2s'
|
|
171
|
-
|
|
198
|
+
transition: 'background-color 0.2s',
|
|
199
|
+
opacity: !isNeedSignInWithWallet ? 0.8 : 1
|
|
200
|
+
}, onMouseOver: (e) => {
|
|
201
|
+
if (isNeedSignInWithWallet) {
|
|
202
|
+
e.currentTarget.style.backgroundColor = '#0056b3';
|
|
203
|
+
}
|
|
204
|
+
}, onMouseOut: (e) => {
|
|
205
|
+
if (isNeedSignInWithWallet) {
|
|
206
|
+
e.currentTarget.style.backgroundColor = '#007bff';
|
|
207
|
+
}
|
|
208
|
+
}, children: !isNeedSignInWithWallet ? 'Signed In' : 'Sign In' })] })) : !isWalletVerified ? (_jsxs("div", { style: { textAlign: 'center', padding: '32px 0' }, children: [_jsxs("div", { style: { marginBottom: '24px' }, children: [_jsx("h4", { style: {
|
|
172
209
|
marginBottom: '12px',
|
|
173
210
|
fontSize: '16px',
|
|
174
211
|
color: '#666'
|
|
@@ -239,12 +276,12 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
239
276
|
if (!isAITLoading) {
|
|
240
277
|
e.currentTarget.style.backgroundColor = 'transparent';
|
|
241
278
|
}
|
|
242
|
-
}, children: [_jsx("input", { type: "checkbox", checked:
|
|
279
|
+
}, children: [_jsx("input", { type: "checkbox", checked: tempPermissions.includes(permission.label), onChange: () => {
|
|
243
280
|
if (!isAITLoading) {
|
|
244
|
-
const newPermissions =
|
|
245
|
-
?
|
|
246
|
-
: [...
|
|
247
|
-
|
|
281
|
+
const newPermissions = tempPermissions.includes(permission.label)
|
|
282
|
+
? tempPermissions.filter(p => p !== permission.label)
|
|
283
|
+
: [...tempPermissions, permission.label].sort();
|
|
284
|
+
setTempPermissions(newPermissions);
|
|
248
285
|
setIsDisabled(false);
|
|
249
286
|
}
|
|
250
287
|
}, disabled: isAITLoading, style: {
|
|
@@ -261,7 +298,7 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
261
298
|
gap: '12px',
|
|
262
299
|
borderTop: '1px solid #e9ecef',
|
|
263
300
|
paddingTop: '24px'
|
|
264
|
-
}, children: [_jsx("button", { onClick:
|
|
301
|
+
}, children: [_jsx("button", { onClick: handleCancel, style: {
|
|
265
302
|
padding: '10px 20px',
|
|
266
303
|
backgroundColor: '#f8f9fa',
|
|
267
304
|
color: '#666',
|
|
@@ -277,22 +314,22 @@ export const PermissionForm = ({ onClose, onOpen }) => {
|
|
|
277
314
|
}, onMouseOut: (e) => {
|
|
278
315
|
e.currentTarget.style.backgroundColor = '#f8f9fa';
|
|
279
316
|
e.currentTarget.style.borderColor = '#dee2e6';
|
|
280
|
-
}, children: "Cancel" }), _jsx("button", { onClick: handleSave, disabled:
|
|
317
|
+
}, children: "Cancel" }), _jsx("button", { onClick: handleSave, disabled: !hasPermissionChanges() || isSaving || isAITLoading, style: {
|
|
281
318
|
padding: '10px 20px',
|
|
282
|
-
backgroundColor:
|
|
283
|
-
color:
|
|
319
|
+
backgroundColor: !hasPermissionChanges() || isSaving || isAITLoading ? '#e9ecef' : '#007bff',
|
|
320
|
+
color: !hasPermissionChanges() || isSaving || isAITLoading ? '#6c757d' : 'white',
|
|
284
321
|
border: 'none',
|
|
285
322
|
borderRadius: '8px',
|
|
286
|
-
cursor:
|
|
323
|
+
cursor: !hasPermissionChanges() || isSaving || isAITLoading ? 'not-allowed' : 'pointer',
|
|
287
324
|
fontSize: '14px',
|
|
288
325
|
fontWeight: '500',
|
|
289
326
|
transition: 'background-color 0.2s'
|
|
290
327
|
}, onMouseOver: (e) => {
|
|
291
|
-
if (
|
|
328
|
+
if (hasPermissionChanges() && !isSaving && !isAITLoading) {
|
|
292
329
|
e.currentTarget.style.backgroundColor = '#0056b3';
|
|
293
330
|
}
|
|
294
331
|
}, onMouseOut: (e) => {
|
|
295
|
-
if (
|
|
332
|
+
if (hasPermissionChanges() && !isSaving && !isAITLoading) {
|
|
296
333
|
e.currentTarget.style.backgroundColor = '#007bff';
|
|
297
334
|
}
|
|
298
335
|
}, children: isSaving ? 'Saving...' : 'Save' })] })] }))] }));
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export { PresetMessages } from './components/ui/PresetMessages';
|
|
|
7
7
|
export { PermissionForm } from './components/ui/PermissionForm';
|
|
8
8
|
export { NotificationModal } from './components/ui/NotificationModal';
|
|
9
9
|
export { ModelSelector } from './components/ui/ModelSelector';
|
|
10
|
-
export type { ChatBotProps, ChatBotContextType, PresetMessage, ToolUse, ToolCall, NovaResponse, NovaError, AITMetadata, AIModel
|
|
10
|
+
export type { ChatBotProps, ChatBotContextType, PresetMessage, ToolUse, ToolCall, NovaResponse, NovaError, AITMetadata, AIModel } from './components/types/ChatBotTypes';
|
|
11
|
+
export { DEFAULT_AI_MODELS, AI_MODEL_MAP } from './components/types/ChatBotTypes';
|
|
11
12
|
export { connectWallet, disconnectWallet, validateToken } from './core/utils/walletUtils';
|
|
12
13
|
export { generateAITId, createAITMetadata, prepareAITCreation } from './core/utils/aitUtils';
|
|
13
14
|
export { createNotification, getNotificationIcon } from './core/utils/notificationUtils';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,WAAW,EAEX,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGlF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAG9D,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,WAAW,EAEX,OAAO,EACR,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACb,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,aAAa,EACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,YAAY,EACV,OAAO,EACP,GAAG,EACH,iBAAiB,EACjB,MAAM,EACP,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,8 @@ export { PresetMessages } from './components/ui/PresetMessages';
|
|
|
10
10
|
export { PermissionForm } from './components/ui/PermissionForm';
|
|
11
11
|
export { NotificationModal } from './components/ui/NotificationModal';
|
|
12
12
|
export { ModelSelector } from './components/ui/ModelSelector';
|
|
13
|
+
// AI Model constants
|
|
14
|
+
export { DEFAULT_AI_MODELS, AI_MODEL_MAP } from './components/types/ChatBotTypes';
|
|
13
15
|
// Utility functions
|
|
14
16
|
export { connectWallet, disconnectWallet, validateToken } from './core/utils/walletUtils';
|
|
15
17
|
export { generateAITId, createAITMetadata, prepareAITCreation } from './core/utils/aitUtils';
|
package/dist/types/ait-api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ait-api.d.ts","sourceRoot":"","sources":["../../src/types/ait-api.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE;YACR,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;SAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"ait-api.d.ts","sourceRoot":"","sources":["../../src/types/ait-api.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE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