@usecrow/ui 0.1.25 → 0.1.26
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/index.cjs +13 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -78,6 +78,7 @@ function useChat({
|
|
|
78
78
|
onConversationId,
|
|
79
79
|
onWorkflowEvent,
|
|
80
80
|
onToolCall,
|
|
81
|
+
onToolResult,
|
|
81
82
|
onRestoredConversation
|
|
82
83
|
}) {
|
|
83
84
|
const effectiveWelcomeMessage = welcomeMessage || DEFAULT_WELCOME_MESSAGE;
|
|
@@ -290,6 +291,11 @@ function useChat({
|
|
|
290
291
|
);
|
|
291
292
|
}
|
|
292
293
|
break;
|
|
294
|
+
case "tool_result":
|
|
295
|
+
if (parsed.tool_name && parsed.result) {
|
|
296
|
+
onToolResult?.(parsed.tool_name, parsed.result);
|
|
297
|
+
}
|
|
298
|
+
break;
|
|
293
299
|
case "client_tool_call":
|
|
294
300
|
pendingClientTools.push({
|
|
295
301
|
toolName: parsed.tool_name,
|
|
@@ -349,7 +355,7 @@ function useChat({
|
|
|
349
355
|
abortControllerRef.current = null;
|
|
350
356
|
}
|
|
351
357
|
},
|
|
352
|
-
[apiUrl, productId, conversationId, selectedModel, persistAnonymousConversations, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall]
|
|
358
|
+
[apiUrl, productId, conversationId, selectedModel, persistAnonymousConversations, onVerificationStatus, onConversationId, onWorkflowEvent, onToolCall, onToolResult]
|
|
353
359
|
);
|
|
354
360
|
const sendMessage = React3.useCallback(
|
|
355
361
|
(content) => {
|
|
@@ -2773,7 +2779,8 @@ function CrowWidget({
|
|
|
2773
2779
|
welcomeMessage: welcomeMessageProp,
|
|
2774
2780
|
onReady,
|
|
2775
2781
|
onIdentify,
|
|
2776
|
-
tools
|
|
2782
|
+
tools,
|
|
2783
|
+
onToolResult
|
|
2777
2784
|
}) {
|
|
2778
2785
|
const {
|
|
2779
2786
|
styles,
|
|
@@ -2851,6 +2858,7 @@ function CrowWidget({
|
|
|
2851
2858
|
break;
|
|
2852
2859
|
}
|
|
2853
2860
|
},
|
|
2861
|
+
onToolResult,
|
|
2854
2862
|
onToolCall: async (event) => {
|
|
2855
2863
|
if (event.type === "client_call" && event.toolName && event.toolCallId) {
|
|
2856
2864
|
try {
|
|
@@ -3290,7 +3298,8 @@ function CrowCopilot({
|
|
|
3290
3298
|
styles: propStyles,
|
|
3291
3299
|
previewMode = false,
|
|
3292
3300
|
className,
|
|
3293
|
-
onReady
|
|
3301
|
+
onReady,
|
|
3302
|
+
onToolResult
|
|
3294
3303
|
}) {
|
|
3295
3304
|
const {
|
|
3296
3305
|
styles,
|
|
@@ -3331,6 +3340,7 @@ function CrowCopilot({
|
|
|
3331
3340
|
},
|
|
3332
3341
|
onConversationId: () => {
|
|
3333
3342
|
},
|
|
3343
|
+
onToolResult,
|
|
3334
3344
|
onToolCall: (event) => {
|
|
3335
3345
|
if (event.type === "client_call" && event.toolName) {
|
|
3336
3346
|
console.log(
|