@meetsmore-oss/use-ai-client 1.9.1 → 1.9.3
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/bundled.js +22 -1
- package/dist/bundled.js.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3213,6 +3213,19 @@ var UseAIClient = class {
|
|
|
3213
3213
|
}
|
|
3214
3214
|
});
|
|
3215
3215
|
}
|
|
3216
|
+
} else if (event.type === EventType.TOOL_CALL_RESULT) {
|
|
3217
|
+
const e = event;
|
|
3218
|
+
const alreadyTracked = this._pendingToolResults.some(
|
|
3219
|
+
(r) => "toolCallId" in r && r.toolCallId === e.toolCallId
|
|
3220
|
+
);
|
|
3221
|
+
if (!alreadyTracked) {
|
|
3222
|
+
this._pendingToolResults.push({
|
|
3223
|
+
id: e.messageId,
|
|
3224
|
+
role: "tool",
|
|
3225
|
+
content: e.content,
|
|
3226
|
+
toolCallId: e.toolCallId
|
|
3227
|
+
});
|
|
3228
|
+
}
|
|
3216
3229
|
} else if (event.type === EventType.RUN_FINISHED) {
|
|
3217
3230
|
if (this._currentAssistantMessage) {
|
|
3218
3231
|
if (this._currentAssistantToolCalls.length > 0) {
|
|
@@ -5162,7 +5175,15 @@ function UseAIProvider({
|
|
|
5162
5175
|
const lastRegisteredToolsRef = useRef12("");
|
|
5163
5176
|
useEffect11(() => {
|
|
5164
5177
|
const client = clientRef.current;
|
|
5165
|
-
if (!client || !client.isConnected()
|
|
5178
|
+
if (!client || !client.isConnected()) return;
|
|
5179
|
+
if (!toolSystem.hasTools) {
|
|
5180
|
+
if (lastRegisteredToolsRef.current !== "") {
|
|
5181
|
+
lastRegisteredToolsRef.current = "";
|
|
5182
|
+
client.registerTools([]);
|
|
5183
|
+
console.log("[Provider] All tools unregistered, clearing client tools");
|
|
5184
|
+
}
|
|
5185
|
+
return;
|
|
5186
|
+
}
|
|
5166
5187
|
const toolKeys = Object.keys(toolSystem.aggregatedTools).sort().join(",");
|
|
5167
5188
|
if (toolKeys === lastRegisteredToolsRef.current) {
|
|
5168
5189
|
console.log("[Provider] Skipping re-registration, tools unchanged");
|