@rimori/react-client 0.4.4 → 0.4.5-next.1
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.
|
@@ -12,7 +12,7 @@ export function Avatar({ avatarImageUrl, voiceId, agentTools, autoStartConversat
|
|
|
12
12
|
const { isDark: isDarkThemeValue } = useTheme(plugin.theme);
|
|
13
13
|
const [agentReplying, setAgentReplying] = useState(false);
|
|
14
14
|
const [isProcessingMessage, setIsProcessingMessage] = useState(false);
|
|
15
|
-
const sender = useMemo(() => new MessageSender(ai.getVoice, voiceId), [voiceId]);
|
|
15
|
+
const sender = useMemo(() => new MessageSender((...args) => ai.getVoice(...args), voiceId), [voiceId]);
|
|
16
16
|
const { messages, append, isLoading, lastMessage, setMessages } = useChat(agentTools);
|
|
17
17
|
useEffect(() => {
|
|
18
18
|
console.log('messages', messages);
|
|
@@ -68,6 +68,25 @@ export const PluginProvider = ({ children, pluginId, settings }) => {
|
|
|
68
68
|
return result;
|
|
69
69
|
};
|
|
70
70
|
}, [client, isSidebar]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!client)
|
|
73
|
+
return;
|
|
74
|
+
const checkScrollbar = () => {
|
|
75
|
+
const hasScrollbar = document.documentElement.scrollHeight > window.innerHeight;
|
|
76
|
+
client.event.emit('session.triggerScrollbarChange', { hasScrollbar });
|
|
77
|
+
};
|
|
78
|
+
// Check initially
|
|
79
|
+
checkScrollbar();
|
|
80
|
+
// Listen for window resize
|
|
81
|
+
window.addEventListener('resize', checkScrollbar);
|
|
82
|
+
// Listen for content changes using ResizeObserver
|
|
83
|
+
const resizeObserver = new ResizeObserver(() => checkScrollbar());
|
|
84
|
+
resizeObserver.observe(document.body);
|
|
85
|
+
return () => {
|
|
86
|
+
window.removeEventListener('resize', checkScrollbar);
|
|
87
|
+
resizeObserver.disconnect();
|
|
88
|
+
};
|
|
89
|
+
}, [client]);
|
|
71
90
|
if (standaloneClient instanceof StandaloneClient) {
|
|
72
91
|
return (_jsx(StandaloneAuth, { onLogin: (email, password) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
92
|
if (yield standaloneClient.login(email, password))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rimori/react-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5-next.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"format": "prettier --write ."
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@rimori/client": "
|
|
26
|
+
"@rimori/client": "2.5.6-next.1",
|
|
27
27
|
"react": "^18.1.0",
|
|
28
28
|
"react-dom": "^18.1.0"
|
|
29
29
|
},
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@eslint/js": "^9.37.0",
|
|
37
|
-
"@rimori/client": "
|
|
37
|
+
"@rimori/client": "2.5.6-next.1",
|
|
38
38
|
"@types/react": "^18.3.21",
|
|
39
39
|
"eslint-config-prettier": "^10.1.8",
|
|
40
40
|
"eslint-plugin-prettier": "^5.5.4",
|
|
@@ -32,7 +32,7 @@ export function Avatar({
|
|
|
32
32
|
const { isDark: isDarkThemeValue } = useTheme(plugin.theme);
|
|
33
33
|
const [agentReplying, setAgentReplying] = useState(false);
|
|
34
34
|
const [isProcessingMessage, setIsProcessingMessage] = useState(false);
|
|
35
|
-
const sender = useMemo(() => new MessageSender(ai.getVoice, voiceId), [voiceId]);
|
|
35
|
+
const sender = useMemo(() => new MessageSender((...args) => ai.getVoice(...args), voiceId), [voiceId]);
|
|
36
36
|
const { messages, append, isLoading, lastMessage, setMessages } = useChat(agentTools);
|
|
37
37
|
|
|
38
38
|
useEffect(() => {
|
|
@@ -85,6 +85,31 @@ export const PluginProvider: React.FC<PluginProviderProps> = ({ children, plugin
|
|
|
85
85
|
};
|
|
86
86
|
}, [client, isSidebar]);
|
|
87
87
|
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (!client) return;
|
|
90
|
+
|
|
91
|
+
const checkScrollbar = (): void => {
|
|
92
|
+
const hasScrollbar = document.documentElement.scrollHeight > window.innerHeight;
|
|
93
|
+
|
|
94
|
+
client.event.emit('session.triggerScrollbarChange', { hasScrollbar });
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Check initially
|
|
98
|
+
checkScrollbar();
|
|
99
|
+
|
|
100
|
+
// Listen for window resize
|
|
101
|
+
window.addEventListener('resize', checkScrollbar);
|
|
102
|
+
|
|
103
|
+
// Listen for content changes using ResizeObserver
|
|
104
|
+
const resizeObserver = new ResizeObserver(() => checkScrollbar());
|
|
105
|
+
resizeObserver.observe(document.body);
|
|
106
|
+
|
|
107
|
+
return (): void => {
|
|
108
|
+
window.removeEventListener('resize', checkScrollbar);
|
|
109
|
+
resizeObserver.disconnect();
|
|
110
|
+
};
|
|
111
|
+
}, [client]);
|
|
112
|
+
|
|
88
113
|
if (standaloneClient instanceof StandaloneClient) {
|
|
89
114
|
return (
|
|
90
115
|
<StandaloneAuth
|
|
@@ -216,5 +241,3 @@ function StandaloneAuth({ onLogin }: { onLogin: (user: string, password: string)
|
|
|
216
241
|
</div>
|
|
217
242
|
);
|
|
218
243
|
}
|
|
219
|
-
|
|
220
|
-
// test 123
|