@reverbia/sdk 1.0.0-next.20251127132400 → 1.0.0-next.20251127161729
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/react/index.cjs +6 -3
- package/dist/react/index.mjs +6 -3
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -937,7 +937,7 @@ function useChat(options) {
|
|
|
937
937
|
let accumulatedContent = "";
|
|
938
938
|
let completionId = "";
|
|
939
939
|
let completionModel = "";
|
|
940
|
-
let
|
|
940
|
+
let accumulatedUsage = {};
|
|
941
941
|
let finishReason;
|
|
942
942
|
for await (const chunk of sseResult.stream) {
|
|
943
943
|
if (typeof chunk === "string" && (chunk.trim() === "[DONE]" || chunk.includes("[DONE]"))) {
|
|
@@ -952,7 +952,10 @@ function useChat(options) {
|
|
|
952
952
|
completionModel = chunkData.model;
|
|
953
953
|
}
|
|
954
954
|
if (chunkData.usage) {
|
|
955
|
-
|
|
955
|
+
accumulatedUsage = {
|
|
956
|
+
...accumulatedUsage,
|
|
957
|
+
...chunkData.usage
|
|
958
|
+
};
|
|
956
959
|
}
|
|
957
960
|
if (chunkData.choices && Array.isArray(chunkData.choices) && chunkData.choices.length > 0) {
|
|
958
961
|
const choice = chunkData.choices[0];
|
|
@@ -985,7 +988,7 @@ function useChat(options) {
|
|
|
985
988
|
finish_reason: finishReason
|
|
986
989
|
}
|
|
987
990
|
],
|
|
988
|
-
usage
|
|
991
|
+
usage: Object.keys(accumulatedUsage).length > 0 ? accumulatedUsage : void 0
|
|
989
992
|
};
|
|
990
993
|
setIsLoading(false);
|
|
991
994
|
if (onFinish) {
|
package/dist/react/index.mjs
CHANGED
|
@@ -893,7 +893,7 @@ function useChat(options) {
|
|
|
893
893
|
let accumulatedContent = "";
|
|
894
894
|
let completionId = "";
|
|
895
895
|
let completionModel = "";
|
|
896
|
-
let
|
|
896
|
+
let accumulatedUsage = {};
|
|
897
897
|
let finishReason;
|
|
898
898
|
for await (const chunk of sseResult.stream) {
|
|
899
899
|
if (typeof chunk === "string" && (chunk.trim() === "[DONE]" || chunk.includes("[DONE]"))) {
|
|
@@ -908,7 +908,10 @@ function useChat(options) {
|
|
|
908
908
|
completionModel = chunkData.model;
|
|
909
909
|
}
|
|
910
910
|
if (chunkData.usage) {
|
|
911
|
-
|
|
911
|
+
accumulatedUsage = {
|
|
912
|
+
...accumulatedUsage,
|
|
913
|
+
...chunkData.usage
|
|
914
|
+
};
|
|
912
915
|
}
|
|
913
916
|
if (chunkData.choices && Array.isArray(chunkData.choices) && chunkData.choices.length > 0) {
|
|
914
917
|
const choice = chunkData.choices[0];
|
|
@@ -941,7 +944,7 @@ function useChat(options) {
|
|
|
941
944
|
finish_reason: finishReason
|
|
942
945
|
}
|
|
943
946
|
],
|
|
944
|
-
usage
|
|
947
|
+
usage: Object.keys(accumulatedUsage).length > 0 ? accumulatedUsage : void 0
|
|
945
948
|
};
|
|
946
949
|
setIsLoading(false);
|
|
947
950
|
if (onFinish) {
|