@anuma/sdk 7.0.2 → 7.0.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/react/index.cjs +13 -3
- package/dist/react/index.mjs +13 -3
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -32027,7 +32027,7 @@ function useChatMedia(options) {
|
|
|
32027
32027
|
[mediaCtx, getImageDimensions, mcpR2Domain]
|
|
32028
32028
|
);
|
|
32029
32029
|
const storeUserFilesInOPFS = (0, import_react5.useCallback)(
|
|
32030
|
-
async (files, address, conversationId) => {
|
|
32030
|
+
async (files, address, conversationId, maxFileSizeBytes) => {
|
|
32031
32031
|
const canUseOPFS = isOPFSSupported() && hasEncryptionKey(address);
|
|
32032
32032
|
let encryptionKey;
|
|
32033
32033
|
if (canUseOPFS) {
|
|
@@ -32069,6 +32069,9 @@ function useChatMedia(options) {
|
|
|
32069
32069
|
clearTimeout(timeoutId);
|
|
32070
32070
|
}
|
|
32071
32071
|
}
|
|
32072
|
+
if (maxFileSizeBytes !== void 0 && blob.size > maxFileSizeBytes) {
|
|
32073
|
+
continue;
|
|
32074
|
+
}
|
|
32072
32075
|
size = blob.size;
|
|
32073
32076
|
dimensions = await getImageDimensions(blob);
|
|
32074
32077
|
await writeEncryptedFile(mediaId, blob, encryptionKey, {
|
|
@@ -33709,8 +33712,15 @@ function useChatStorage(options) {
|
|
|
33709
33712
|
messagesToSend = attachFileContextToLastUserMessage(messagesToSend, currentTurnFileText);
|
|
33710
33713
|
}
|
|
33711
33714
|
let userFileIds = [];
|
|
33712
|
-
|
|
33713
|
-
|
|
33715
|
+
const maxFileSizeBytes = fileProcessingOptions?.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE_BYTES;
|
|
33716
|
+
const storableFiles = filesForStorage?.filter((file) => file.size <= maxFileSizeBytes);
|
|
33717
|
+
if (storableFiles && storableFiles.length > 0 && walletAddress && isEncryptionReady()) {
|
|
33718
|
+
userFileIds = await storeUserFilesInOPFS(
|
|
33719
|
+
storableFiles,
|
|
33720
|
+
walletAddress,
|
|
33721
|
+
convId,
|
|
33722
|
+
maxFileSizeBytes
|
|
33723
|
+
);
|
|
33714
33724
|
}
|
|
33715
33725
|
const userMsgOpts = {
|
|
33716
33726
|
conversationId: convId,
|
package/dist/react/index.mjs
CHANGED
|
@@ -30170,7 +30170,7 @@ function useChatMedia(options) {
|
|
|
30170
30170
|
[mediaCtx, getImageDimensions, mcpR2Domain]
|
|
30171
30171
|
);
|
|
30172
30172
|
const storeUserFilesInOPFS = useCallback4(
|
|
30173
|
-
async (files, address, conversationId) => {
|
|
30173
|
+
async (files, address, conversationId, maxFileSizeBytes) => {
|
|
30174
30174
|
const canUseOPFS = isOPFSSupported() && hasEncryptionKey(address);
|
|
30175
30175
|
let encryptionKey;
|
|
30176
30176
|
if (canUseOPFS) {
|
|
@@ -30212,6 +30212,9 @@ function useChatMedia(options) {
|
|
|
30212
30212
|
clearTimeout(timeoutId);
|
|
30213
30213
|
}
|
|
30214
30214
|
}
|
|
30215
|
+
if (maxFileSizeBytes !== void 0 && blob.size > maxFileSizeBytes) {
|
|
30216
|
+
continue;
|
|
30217
|
+
}
|
|
30215
30218
|
size = blob.size;
|
|
30216
30219
|
dimensions = await getImageDimensions(blob);
|
|
30217
30220
|
await writeEncryptedFile(mediaId, blob, encryptionKey, {
|
|
@@ -31852,8 +31855,15 @@ function useChatStorage(options) {
|
|
|
31852
31855
|
messagesToSend = attachFileContextToLastUserMessage(messagesToSend, currentTurnFileText);
|
|
31853
31856
|
}
|
|
31854
31857
|
let userFileIds = [];
|
|
31855
|
-
|
|
31856
|
-
|
|
31858
|
+
const maxFileSizeBytes = fileProcessingOptions?.maxFileSizeBytes ?? DEFAULT_MAX_FILE_SIZE_BYTES;
|
|
31859
|
+
const storableFiles = filesForStorage?.filter((file) => file.size <= maxFileSizeBytes);
|
|
31860
|
+
if (storableFiles && storableFiles.length > 0 && walletAddress && isEncryptionReady()) {
|
|
31861
|
+
userFileIds = await storeUserFilesInOPFS(
|
|
31862
|
+
storableFiles,
|
|
31863
|
+
walletAddress,
|
|
31864
|
+
convId,
|
|
31865
|
+
maxFileSizeBytes
|
|
31866
|
+
);
|
|
31857
31867
|
}
|
|
31858
31868
|
const userMsgOpts = {
|
|
31859
31869
|
conversationId: convId,
|