ai 2.2.6 → 2.2.7
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/package.json +1 -1
- package/react/dist/index.js +7 -2
- package/react/dist/index.mjs +7 -2
package/package.json
CHANGED
package/react/dist/index.js
CHANGED
@@ -325,10 +325,12 @@ function useChat({
|
|
325
325
|
sendExtraMessageFields
|
326
326
|
);
|
327
327
|
if ("messages" in messagesAndDataOrJustMessage) {
|
328
|
+
let hasFollowingResponse = false;
|
328
329
|
for (const message of messagesAndDataOrJustMessage.messages) {
|
329
330
|
if (message.function_call === void 0 || typeof message.function_call === "string") {
|
330
|
-
|
331
|
+
continue;
|
331
332
|
}
|
333
|
+
hasFollowingResponse = true;
|
332
334
|
if (experimental_onFunctionCall) {
|
333
335
|
const functionCall = message.function_call;
|
334
336
|
const functionCallResponse = await experimental_onFunctionCall(
|
@@ -340,6 +342,9 @@ function useChat({
|
|
340
342
|
chatRequest = functionCallResponse;
|
341
343
|
}
|
342
344
|
}
|
345
|
+
if (!hasFollowingResponse) {
|
346
|
+
break;
|
347
|
+
}
|
343
348
|
} else {
|
344
349
|
const streamedResponseMessage = messagesAndDataOrJustMessage;
|
345
350
|
if (streamedResponseMessage.function_call === void 0 || typeof streamedResponseMessage.function_call === "string") {
|
@@ -356,8 +361,8 @@ function useChat({
|
|
356
361
|
chatRequest = functionCallResponse;
|
357
362
|
}
|
358
363
|
}
|
359
|
-
abortControllerRef.current = null;
|
360
364
|
}
|
365
|
+
abortControllerRef.current = null;
|
361
366
|
} catch (err) {
|
362
367
|
if (err.name === "AbortError") {
|
363
368
|
abortControllerRef.current = null;
|
package/react/dist/index.mjs
CHANGED
@@ -289,10 +289,12 @@ function useChat({
|
|
289
289
|
sendExtraMessageFields
|
290
290
|
);
|
291
291
|
if ("messages" in messagesAndDataOrJustMessage) {
|
292
|
+
let hasFollowingResponse = false;
|
292
293
|
for (const message of messagesAndDataOrJustMessage.messages) {
|
293
294
|
if (message.function_call === void 0 || typeof message.function_call === "string") {
|
294
|
-
|
295
|
+
continue;
|
295
296
|
}
|
297
|
+
hasFollowingResponse = true;
|
296
298
|
if (experimental_onFunctionCall) {
|
297
299
|
const functionCall = message.function_call;
|
298
300
|
const functionCallResponse = await experimental_onFunctionCall(
|
@@ -304,6 +306,9 @@ function useChat({
|
|
304
306
|
chatRequest = functionCallResponse;
|
305
307
|
}
|
306
308
|
}
|
309
|
+
if (!hasFollowingResponse) {
|
310
|
+
break;
|
311
|
+
}
|
307
312
|
} else {
|
308
313
|
const streamedResponseMessage = messagesAndDataOrJustMessage;
|
309
314
|
if (streamedResponseMessage.function_call === void 0 || typeof streamedResponseMessage.function_call === "string") {
|
@@ -320,8 +325,8 @@ function useChat({
|
|
320
325
|
chatRequest = functionCallResponse;
|
321
326
|
}
|
322
327
|
}
|
323
|
-
abortControllerRef.current = null;
|
324
328
|
}
|
329
|
+
abortControllerRef.current = null;
|
325
330
|
} catch (err) {
|
326
331
|
if (err.name === "AbortError") {
|
327
332
|
abortControllerRef.current = null;
|