@memori.ai/memori-react 8.45.1 → 8.45.4
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/CHANGELOG.md +27 -0
- package/dist/components/Chat/Chat.js +4 -1
- package/dist/components/Chat/Chat.js.map +1 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.d.ts +4 -1
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js +7 -57
- package/dist/components/ChatHistoryDrawer/ChatResumeDrawer.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +2 -1
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/PositionPopover/PositionPopover.js +38 -25
- package/dist/components/PositionPopover/PositionPopover.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +3 -0
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js +14 -2
- package/dist/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/dist/components/layouts/chat.css +27 -4
- package/dist/context/widgetSurfaceContext.js +2 -2
- package/dist/context/widgetSurfaceContext.js.map +1 -1
- package/dist/helpers/constants.d.ts +3 -2
- package/dist/helpers/constants.js +19 -20
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/positionPopover.d.ts +2 -1
- package/dist/helpers/positionPopover.js +12 -3
- package/dist/helpers/positionPopover.js.map +1 -1
- package/dist/helpers/tts/muteSpeaker.js +4 -3
- package/dist/helpers/tts/muteSpeaker.js.map +1 -1
- package/dist/helpers/usePressTooltip.js +2 -1
- package/dist/helpers/usePressTooltip.js.map +1 -1
- package/dist/helpers/utils.d.ts +2 -1
- package/dist/helpers/utils.js +7 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/icons/MemoriIcon.js +1 -1
- package/dist/icons/MemoriIcon.js.map +1 -1
- package/dist/styles.css +1 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/Chat/Chat.js +4 -1
- package/esm/components/Chat/Chat.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +2 -1
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.js +4 -1
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js +16 -4
- package/esm/components/UploadButton/UploadDocuments/UploadDocuments.js.map +1 -1
- package/esm/components/layouts/chat.css +27 -4
- package/esm/helpers/constants.d.ts +3 -2
- package/esm/helpers/constants.js +18 -19
- package/esm/helpers/constants.js.map +1 -1
- package/esm/helpers/utils.d.ts +2 -1
- package/esm/helpers/utils.js +6 -1
- package/esm/helpers/utils.js.map +1 -1
- package/esm/styles.css +1 -2
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +6 -7
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +0 -3
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +0 -64
- package/dist/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +0 -1
- package/dist/testUtils.d.ts +0 -5
- package/dist/testUtils.js +0 -18
- package/dist/testUtils.js.map +0 -1
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.d.ts +0 -3
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js +0 -62
- package/esm/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.js.map +0 -1
- package/src/I18nWrapper.tsx +0 -13
- package/src/__snapshots__/index.test.tsx.snap +0 -96
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +0 -95
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +0 -46
- package/src/components/AgeVerificationModal/AgeVerificationModal.test.tsx +0 -33
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +0 -99
- package/src/components/AgeVerificationModal/__snapshots__/AgeVerificationModal.test.tsx.snap +0 -19
- package/src/components/Auth/Auth.css +0 -57
- package/src/components/Auth/Auth.stories.tsx +0 -90
- package/src/components/Auth/Auth.test.tsx +0 -63
- package/src/components/Auth/Auth.tsx +0 -201
- package/src/components/Auth/__snapshots__/Auth.test.tsx.snap +0 -143
- package/src/components/Avatar/Avatar.css +0 -151
- package/src/components/Avatar/Avatar.stories.tsx +0 -160
- package/src/components/Avatar/Avatar.test.tsx +0 -158
- package/src/components/Avatar/Avatar.tsx +0 -245
- package/src/components/Avatar/AvatarView/AvatarComponent/Shadow/DynamicShadow.tsx +0 -103
- package/src/components/Avatar/AvatarView/AvatarComponent/avatarComponent.tsx +0 -105
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/fullbodyAvatar.tsx +0 -338
- package/src/components/Avatar/AvatarView/AvatarComponent/components/FullbodyAvatar/types.ts +0 -44
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarAnimator.ts +0 -1091
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/AvatarPositionController.ts +0 -83
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controllers/MorphTargetController.ts +0 -301
- package/src/components/Avatar/AvatarView/AvatarComponent/components/controls.tsx +0 -100
- package/src/components/Avatar/AvatarView/AvatarComponent/components/halfbodyAvatar.tsx +0 -152
- package/src/components/Avatar/AvatarView/AvatarComponent/components/loader.tsx +0 -31
- package/src/components/Avatar/AvatarView/AvatarComponent/constants.ts +0 -141
- package/src/components/Avatar/AvatarView/AvatarComponent/lights/Lights.tsx +0 -145
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.css +0 -111
- package/src/components/Avatar/AvatarView/AvatarComponent/positionControls/positionControls.tsx +0 -201
- package/src/components/Avatar/AvatarView/AvatarView.stories.tsx +0 -254
- package/src/components/Avatar/AvatarView/index.tsx +0 -194
- package/src/components/Avatar/AvatarView/utils/hideHands.ts +0 -11
- package/src/components/Avatar/AvatarView/utils/useEyeBlink.ts +0 -100
- package/src/components/Avatar/AvatarView/utils/useHeadMovement.ts +0 -72
- package/src/components/Avatar/AvatarView/utils/useLoadingMorphAnim.ts +0 -38
- package/src/components/Avatar/AvatarView/utils/useMouthAnimation.ts +0 -93
- package/src/components/Avatar/AvatarView/utils/useSmile.ts +0 -39
- package/src/components/Avatar/AvatarView/utils/utils.ts +0 -55
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +0 -246
- package/src/components/Blob/Blob.css +0 -286
- package/src/components/Blob/Blob.stories.tsx +0 -53
- package/src/components/Blob/Blob.test.tsx +0 -18
- package/src/components/Blob/Blob.tsx +0 -26
- package/src/components/Blob/__snapshots__/Blob.test.tsx.snap +0 -80
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.css +0 -40
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.tsx +0 -58
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.test.tsx +0 -53
- package/src/components/BlockedMemoriBadge/BlockedMemoriBadge.tsx +0 -74
- package/src/components/BlockedMemoriBadge/__snapshots__/BlockedMemoriBadge.test.tsx.snap +0 -181
- package/src/components/ChangeMode/ChangeMode.css +0 -22
- package/src/components/ChangeMode/ChangeMode.stories.tsx +0 -50
- package/src/components/ChangeMode/ChangeMode.test.tsx +0 -24
- package/src/components/ChangeMode/ChangeMode.tsx +0 -51
- package/src/components/ChangeMode/__snapshots__/ChangeMode.test.tsx.snap +0 -107
- package/src/components/Chat/Chat.css +0 -285
- package/src/components/Chat/Chat.stories.tsx +0 -1684
- package/src/components/Chat/Chat.test.tsx +0 -372
- package/src/components/Chat/Chat.tsx +0 -778
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +0 -6816
- package/src/components/ChatBubble/ChatBubble.css +0 -430
- package/src/components/ChatBubble/ChatBubble.stories.tsx +0 -1192
- package/src/components/ChatBubble/ChatBubble.test.tsx +0 -481
- package/src/components/ChatBubble/ChatBubble.tsx +0 -776
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +0 -8734
- package/src/components/ChatHistoryDrawer/ChatHistory.css +0 -587
- package/src/components/ChatHistoryDrawer/ChatHistory.stories.tsx +0 -410
- package/src/components/ChatHistoryDrawer/ChatHistory.test.tsx +0 -107
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +0 -1298
- package/src/components/ChatHistoryDrawer/__snapshots__/ChatHistory.test.tsx.snap +0 -27
- package/src/components/ChatInputs/ChatInputs.css +0 -340
- package/src/components/ChatInputs/ChatInputs.stories.tsx +0 -251
- package/src/components/ChatInputs/ChatInputs.tsx +0 -487
- package/src/components/ChatTextArea/ChatTextArea.css +0 -185
- package/src/components/ChatTextArea/ChatTextArea.stories.tsx +0 -55
- package/src/components/ChatTextArea/ChatTextArea.test.tsx +0 -28
- package/src/components/ChatTextArea/ChatTextArea.tsx +0 -171
- package/src/components/ChatTextArea/__snapshots__/ChatTextArea.test.tsx.snap +0 -68
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.css +0 -36
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.stories.tsx +0 -296
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.test.tsx +0 -31
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +0 -232
- package/src/components/CompletionProviderStatus/__snapshots__/CompletionProviderStatus.test.tsx.snap +0 -96
- package/src/components/ContentPreviewModal/ContentPreviewModal.css +0 -128
- package/src/components/ContentPreviewModal/ContentPreviewModal.tsx +0 -67
- package/src/components/ContentPreviewModal/index.ts +0 -2
- package/src/components/CustomGLBModelViewer/ModelViewer.css +0 -11
- package/src/components/CustomGLBModelViewer/ModelViewer.stories.tsx +0 -58
- package/src/components/CustomGLBModelViewer/ModelViewer.test.tsx +0 -13
- package/src/components/CustomGLBModelViewer/ModelViewer.tsx +0 -37
- package/src/components/CustomGLBModelViewer/__snapshots__/ModelViewer.test.tsx.snap +0 -20
- package/src/components/DateSelector/DateSelector.css +0 -158
- package/src/components/DateSelector/DateSelector.stories.tsx +0 -47
- package/src/components/DateSelector/DateSelector.test.tsx +0 -149
- package/src/components/DateSelector/DateSelector.tsx +0 -251
- package/src/components/DateSelector/__snapshots__/DateSelector.test.tsx.snap +0 -1954
- package/src/components/ErrorBoundary/ErrorBoundary.tsx +0 -54
- package/src/components/ExpertsDrawer/ExpertsDrawer.css +0 -67
- package/src/components/ExpertsDrawer/ExpertsDrawer.stories.tsx +0 -54
- package/src/components/ExpertsDrawer/ExpertsDrawer.test.tsx +0 -53
- package/src/components/ExpertsDrawer/ExpertsDrawer.tsx +0 -69
- package/src/components/ExpertsDrawer/__snapshots__/ExpertsDrawer.test.tsx.snap +0 -11
- package/src/components/ExportHistoryButton/ExportHistoryButton.css +0 -22
- package/src/components/FeedbackButtons/FeedbackButtons.css +0 -107
- package/src/components/FeedbackButtons/FeedbackButtons.stories.tsx +0 -52
- package/src/components/FeedbackButtons/FeedbackButtons.test.tsx +0 -11
- package/src/components/FeedbackButtons/FeedbackButtons.tsx +0 -152
- package/src/components/FeedbackButtons/__snapshots__/FeedbackButtons.test.tsx.snap +0 -42
- package/src/components/FilePreview/FilePreview.css +0 -358
- package/src/components/FilePreview/FilePreview.stories.tsx +0 -63
- package/src/components/FilePreview/FilePreview.test.tsx +0 -26
- package/src/components/FilePreview/FilePreview.tsx +0 -277
- package/src/components/FilePreview/__snapshots__/FilePreview.test.tsx.snap +0 -185
- package/src/components/Header/ChatConsumptionDropdown.test.tsx +0 -117
- package/src/components/Header/ChatConsumptionDropdown.tsx +0 -275
- package/src/components/Header/Header.css +0 -282
- package/src/components/Header/Header.stories.tsx +0 -338
- package/src/components/Header/Header.test.tsx +0 -371
- package/src/components/Header/Header.tsx +0 -442
- package/src/components/Header/__snapshots__/Header.test.tsx.snap +0 -964
- package/src/components/KnownFacts/KnownFacts.css +0 -19
- package/src/components/KnownFacts/KnownFacts.stories.tsx +0 -80
- package/src/components/KnownFacts/KnownFacts.test.tsx +0 -57
- package/src/components/KnownFacts/KnownFacts.tsx +0 -376
- package/src/components/KnownFacts/__snapshots__/KnownFacts.test.tsx.snap +0 -19
- package/src/components/LoginDrawer/LoginDrawer.css +0 -1616
- package/src/components/LoginDrawer/LoginDrawer.stories.tsx +0 -102
- package/src/components/LoginDrawer/LoginDrawer.test.tsx +0 -199
- package/src/components/LoginDrawer/LoginDrawer.tsx +0 -600
- package/src/components/LoginDrawer/__snapshots__/LoginDrawer.test.tsx.snap +0 -91
- package/src/components/MediaWidget/DocumentCard.test.tsx +0 -45
- package/src/components/MediaWidget/DocumentCard.tsx +0 -19
- package/src/components/MediaWidget/MediaItemWidget.css +0 -1398
- package/src/components/MediaWidget/MediaItemWidget.stories.tsx +0 -423
- package/src/components/MediaWidget/MediaItemWidget.test.tsx +0 -248
- package/src/components/MediaWidget/MediaItemWidget.tsx +0 -997
- package/src/components/MediaWidget/MediaItemWidget.types.ts +0 -65
- package/src/components/MediaWidget/MediaItemWidget.utils.test.ts +0 -367
- package/src/components/MediaWidget/MediaItemWidget.utils.ts +0 -227
- package/src/components/MediaWidget/MediaPreviewModal.test.tsx +0 -271
- package/src/components/MediaWidget/MediaPreviewModal.tsx +0 -425
- package/src/components/MediaWidget/MediaWidget.css +0 -131
- package/src/components/MediaWidget/MediaWidget.stories.tsx +0 -319
- package/src/components/MediaWidget/MediaWidget.test.tsx +0 -41
- package/src/components/MediaWidget/MediaWidget.tsx +0 -107
- package/src/components/MediaWidget/__snapshots__/DocumentCard.test.tsx.snap +0 -24
- package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +0 -791
- package/src/components/MediaWidget/__snapshots__/MediaWidget.test.tsx.snap +0 -154
- package/src/components/MemoriArtifactSystem/ArtifactDrawer.stories.tsx +0 -2299
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.css +0 -163
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/ArtifactActions.tsx +0 -250
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/CopyButton.stories.tsx +0 -30
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyButtonWithDropdown.tsx +0 -467
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/components/CopyMenuItem.tsx +0 -89
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/hooks/useCopyArtifact.ts +0 -619
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/index.ts +0 -9
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/styles.css +0 -489
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/test/CopyButtonTest.tsx +0 -90
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/types.ts +0 -73
- package/src/components/MemoriArtifactSystem/components/ArtifactActions/utils/PDFExporter.ts +0 -454
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.css +0 -1059
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/ArtifactDrawer.tsx +0 -431
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.css +0 -150
- package/src/components/MemoriArtifactSystem/components/ArtifactDrawer/components/TabSwitch.tsx +0 -79
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.css +0 -253
- package/src/components/MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler.tsx +0 -561
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.css +0 -355
- package/src/components/MemoriArtifactSystem/components/ArtifactPreview/ArtifactPreview.tsx +0 -160
- package/src/components/MemoriArtifactSystem/context/ArtifactContext.tsx +0 -167
- package/src/components/MemoriArtifactSystem/types/artifact.types.ts +0 -35
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.test.tsx +0 -308
- package/src/components/MemoriArtifactSystem/utils/ArtifactAPI.tsx +0 -379
- package/src/components/MemoriArtifactSystem/utils/applyEdits.test.ts +0 -85
- package/src/components/MemoriArtifactSystem/utils/applyEdits.ts +0 -173
- package/src/components/MemoriWidget/MemoriWidget.css +0 -220
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +0 -274
- package/src/components/MemoriWidget/MemoriWidget.tsx +0 -3930
- package/src/components/MicrophoneButton/MicrophoneButton.css +0 -142
- package/src/components/MicrophoneButton/MicrophoneButton.stories.tsx +0 -52
- package/src/components/MicrophoneButton/MicrophoneButton.tsx +0 -128
- package/src/components/PositionDrawer/PositionDrawer.stories.tsx +0 -51
- package/src/components/PositionDrawer/PositionDrawer.test.tsx +0 -39
- package/src/components/PositionDrawer/PositionDrawer.tsx +0 -50
- package/src/components/PositionDrawer/__snapshots__/PositionDrawer.test.tsx.snap +0 -17
- package/src/components/PoweredBy/PoweredBy.css +0 -47
- package/src/components/PoweredBy/PoweredBy.stories.tsx +0 -75
- package/src/components/PoweredBy/PoweredBy.test.tsx +0 -15
- package/src/components/PoweredBy/PoweredBy.tsx +0 -44
- package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +0 -55
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.css +0 -47
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.stories.tsx +0 -58
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.test.tsx +0 -17
- package/src/components/SendOnEnterMenu/SendOnEnterMenu.tsx +0 -82
- package/src/components/SendOnEnterMenu/__snapshots__/SendOnEnterMenu.test.tsx.snap +0 -57
- package/src/components/SettingsDrawer/SettingsDrawer.css +0 -24
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +0 -94
- package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +0 -202
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +0 -255
- package/src/components/SettingsDrawer/__snapshots__/SettingsDrawer.test.tsx.snap +0 -59
- package/src/components/ShareButton/ShareButton.css +0 -73
- package/src/components/ShareButton/ShareButton.stories.tsx +0 -98
- package/src/components/ShareButton/ShareButton.test.tsx +0 -53
- package/src/components/ShareButton/ShareButton.tsx +0 -395
- package/src/components/ShareButton/__snapshots__/ShareButton.test.tsx.snap +0 -316
- package/src/components/Snippet/Snippet.css +0 -142
- package/src/components/Snippet/Snippet.stories.tsx +0 -286
- package/src/components/Snippet/Snippet.test.tsx +0 -176
- package/src/components/Snippet/Snippet.tsx +0 -148
- package/src/components/Snippet/__snapshots__/Snippet.test.tsx.snap +0 -603
- package/src/components/StartPanel/StartPanel.css +0 -273
- package/src/components/StartPanel/StartPanel.stories.tsx +0 -404
- package/src/components/StartPanel/StartPanel.test.tsx +0 -360
- package/src/components/StartPanel/StartPanel.tsx +0 -426
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +0 -1986
- package/src/components/Typing/Typing.stories.tsx +0 -130
- package/src/components/Typing/Typing.test.tsx +0 -62
- package/src/components/Typing/Typing.tsx +0 -154
- package/src/components/Typing/__snapshots__/Typing.test.tsx.snap +0 -133
- package/src/components/UploadButton/UploadButton.css +0 -542
- package/src/components/UploadButton/UploadButton.stories.tsx +0 -376
- package/src/components/UploadButton/UploadButton.test.tsx +0 -11
- package/src/components/UploadButton/UploadButton.tsx +0 -684
- package/src/components/UploadButton/UploadDocuments/UploadDocuments.tsx +0 -405
- package/src/components/UploadButton/UploadImages/UploadImages.tsx +0 -538
- package/src/components/UploadButton/__snapshots__/UploadButton.test.tsx.snap +0 -165
- package/src/components/VenueWidget/VenueWidget.css +0 -163
- package/src/components/VenueWidget/VenueWidget.stories.tsx +0 -66
- package/src/components/VenueWidget/VenueWidget.test.tsx +0 -49
- package/src/components/VenueWidget/VenueWidget.tsx +0 -458
- package/src/components/VenueWidget/__snapshots__/VenueWidget.test.tsx.snap +0 -370
- package/src/components/WhyThisAnswer/WhyThisAnswer.css +0 -171
- package/src/components/WhyThisAnswer/WhyThisAnswer.stories.tsx +0 -285
- package/src/components/WhyThisAnswer/WhyThisAnswer.test.tsx +0 -245
- package/src/components/WhyThisAnswer/WhyThisAnswer.tsx +0 -233
- package/src/components/WhyThisAnswer/__snapshots__/WhyThisAnswer.test.tsx.snap +0 -27
- package/src/components/icons/AI.tsx +0 -34
- package/src/components/icons/Alert.tsx +0 -31
- package/src/components/icons/ArrowUp.tsx +0 -28
- package/src/components/icons/Bug.tsx +0 -81
- package/src/components/icons/Chat.tsx +0 -30
- package/src/components/icons/ChevronDown.tsx +0 -26
- package/src/components/icons/ChevronLeft.tsx +0 -28
- package/src/components/icons/ChevronRight.tsx +0 -28
- package/src/components/icons/ChevronUp.tsx +0 -24
- package/src/components/icons/Clear.tsx +0 -23
- package/src/components/icons/Close.tsx +0 -30
- package/src/components/icons/Code.tsx +0 -24
- package/src/components/icons/Copy.tsx +0 -23
- package/src/components/icons/DeepThought.tsx +0 -38
- package/src/components/icons/Delete.tsx +0 -23
- package/src/components/icons/Document.tsx +0 -50
- package/src/components/icons/Download.tsx +0 -23
- package/src/components/icons/Edit.tsx +0 -17
- package/src/components/icons/Expand.tsx +0 -23
- package/src/components/icons/Eye.tsx +0 -17
- package/src/components/icons/EyeInvisible.tsx +0 -24
- package/src/components/icons/Facebook.tsx +0 -23
- package/src/components/icons/Feedback.tsx +0 -24
- package/src/components/icons/File.tsx +0 -17
- package/src/components/icons/FileExcel.tsx +0 -23
- package/src/components/icons/FilePdf.tsx +0 -23
- package/src/components/icons/FileWord.tsx +0 -23
- package/src/components/icons/Fullscreen.tsx +0 -23
- package/src/components/icons/FullscreenExit.tsx +0 -23
- package/src/components/icons/GasStation.tsx +0 -36
- package/src/components/icons/Group.tsx +0 -30
- package/src/components/icons/History.tsx +0 -33
- package/src/components/icons/Image.tsx +0 -37
- package/src/components/icons/Info.tsx +0 -31
- package/src/components/icons/Link.tsx +0 -17
- package/src/components/icons/Linkedin.tsx +0 -23
- package/src/components/icons/Loading.tsx +0 -28
- package/src/components/icons/Logout.tsx +0 -27
- package/src/components/icons/Mail.tsx +0 -17
- package/src/components/icons/MapMarker.tsx +0 -26
- package/src/components/icons/MenuHorizontal.tsx +0 -29
- package/src/components/icons/MenuVertical.tsx +0 -29
- package/src/components/icons/Message.tsx +0 -23
- package/src/components/icons/Microphone.tsx +0 -23
- package/src/components/icons/Minus.tsx +0 -23
- package/src/components/icons/MinusCircle.tsx +0 -24
- package/src/components/icons/PaperClip.tsx +0 -23
- package/src/components/icons/Picture.tsx +0 -23
- package/src/components/icons/Plus.tsx +0 -18
- package/src/components/icons/Preview.tsx +0 -29
- package/src/components/icons/Print.tsx +0 -38
- package/src/components/icons/QuestionHelp.tsx +0 -30
- package/src/components/icons/Refresh.tsx +0 -30
- package/src/components/icons/SelectIcon.tsx +0 -28
- package/src/components/icons/Send.tsx +0 -17
- package/src/components/icons/Setting.tsx +0 -23
- package/src/components/icons/Share.tsx +0 -23
- package/src/components/icons/Sound.tsx +0 -23
- package/src/components/icons/SoundDeactivated.tsx +0 -27
- package/src/components/icons/Telegram.tsx +0 -26
- package/src/components/icons/ThumbDown.tsx +0 -29
- package/src/components/icons/ThumbUp.tsx +0 -29
- package/src/components/icons/Translation.tsx +0 -24
- package/src/components/icons/Twitter.tsx +0 -23
- package/src/components/icons/Upload.tsx +0 -34
- package/src/components/icons/User.tsx +0 -17
- package/src/components/icons/Warning.tsx +0 -24
- package/src/components/icons/WhatsApp.tsx +0 -24
- package/src/components/icons/icons.stories.css +0 -5
- package/src/components/icons/icons.stories.tsx +0 -81
- package/src/components/icons/loading.css +0 -14
- package/src/components/layouts/Chat.test.tsx +0 -40
- package/src/components/layouts/Chat.tsx +0 -69
- package/src/components/layouts/FullBody/FullBody.stories.tsx +0 -110
- package/src/components/layouts/FullPage.test.tsx +0 -65
- package/src/components/layouts/FullPage.tsx +0 -80
- package/src/components/layouts/HiddenChat.test.tsx +0 -40
- package/src/components/layouts/HiddenChat.tsx +0 -233
- package/src/components/layouts/Totem/Totem.stories.tsx +0 -131
- package/src/components/layouts/Totem.test.tsx +0 -40
- package/src/components/layouts/Totem.tsx +0 -49
- package/src/components/layouts/WebsiteAssistant.test.tsx +0 -40
- package/src/components/layouts/WebsiteAssistant.tsx +0 -132
- package/src/components/layouts/ZoomedFullBody/ZoomedFullBody.stories.tsx +0 -131
- package/src/components/layouts/ZoomedFullBody.test.tsx +0 -40
- package/src/components/layouts/ZoomedFullBody.tsx +0 -81
- package/src/components/layouts/__snapshots__/Chat.test.tsx.snap +0 -457
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +0 -1045
- package/src/components/layouts/__snapshots__/HiddenChat.test.tsx.snap +0 -460
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +0 -566
- package/src/components/layouts/__snapshots__/WebsiteAssistant.test.tsx.snap +0 -59
- package/src/components/layouts/__snapshots__/ZoomedFullBody.test.tsx.snap +0 -523
- package/src/components/layouts/chat.css +0 -451
- package/src/components/layouts/hidden-chat.css +0 -276
- package/src/components/layouts/layouts.stories.tsx +0 -231
- package/src/components/layouts/totem.css +0 -221
- package/src/components/layouts/website-assistant.css +0 -677
- package/src/components/layouts/zoomed-full-body.css +0 -18
- package/src/components/ui/Alert.css +0 -93
- package/src/components/ui/Alert.stories.tsx +0 -137
- package/src/components/ui/Alert.test.tsx +0 -129
- package/src/components/ui/Alert.tsx +0 -123
- package/src/components/ui/Button.css +0 -167
- package/src/components/ui/Button.stories.tsx +0 -156
- package/src/components/ui/Button.test.tsx +0 -74
- package/src/components/ui/Button.tsx +0 -107
- package/src/components/ui/Card.css +0 -65
- package/src/components/ui/Card.stories.tsx +0 -95
- package/src/components/ui/Card.test.tsx +0 -47
- package/src/components/ui/Card.tsx +0 -48
- package/src/components/ui/Checkbox.css +0 -116
- package/src/components/ui/Checkbox.stories.tsx +0 -74
- package/src/components/ui/Checkbox.test.tsx +0 -28
- package/src/components/ui/Checkbox.tsx +0 -58
- package/src/components/ui/ConfirmDialog.css +0 -42
- package/src/components/ui/ConfirmDialog.stories.tsx +0 -216
- package/src/components/ui/ConfirmDialog.test.tsx +0 -124
- package/src/components/ui/ConfirmDialog.tsx +0 -58
- package/src/components/ui/Details.css +0 -66
- package/src/components/ui/Drawer.css +0 -270
- package/src/components/ui/Drawer.stories.tsx +0 -267
- package/src/components/ui/Drawer.test.tsx +0 -130
- package/src/components/ui/Drawer.tsx +0 -293
- package/src/components/ui/Dropdown.css +0 -173
- package/src/components/ui/Dropdown.tsx +0 -63
- package/src/components/ui/Expandable.css +0 -15
- package/src/components/ui/Expandable.stories.tsx +0 -180
- package/src/components/ui/Expandable.test.tsx +0 -107
- package/src/components/ui/Expandable.tsx +0 -121
- package/src/components/ui/Modal.css +0 -98
- package/src/components/ui/Modal.stories.tsx +0 -171
- package/src/components/ui/Modal.test.tsx +0 -111
- package/src/components/ui/Modal.tsx +0 -117
- package/src/components/ui/Select.css +0 -138
- package/src/components/ui/Select.stories.tsx +0 -79
- package/src/components/ui/Select.test.tsx +0 -84
- package/src/components/ui/Select.tsx +0 -79
- package/src/components/ui/Slider.css +0 -192
- package/src/components/ui/Slider.stories.tsx +0 -63
- package/src/components/ui/Slider.tsx +0 -142
- package/src/components/ui/Spin.css +0 -31
- package/src/components/ui/Spin.stories.tsx +0 -64
- package/src/components/ui/Spin.test.tsx +0 -41
- package/src/components/ui/Spin.tsx +0 -31
- package/src/components/ui/Table.css +0 -132
- package/src/components/ui/Tooltip.css +0 -171
- package/src/components/ui/Tooltip.stories.tsx +0 -109
- package/src/components/ui/Tooltip.test.tsx +0 -102
- package/src/components/ui/Tooltip.tsx +0 -163
- package/src/components/ui/__snapshots__/Alert.test.tsx.snap +0 -59
- package/src/components/ui/__snapshots__/Button.test.tsx.snap +0 -204
- package/src/components/ui/__snapshots__/Card.test.tsx.snap +0 -321
- package/src/components/ui/__snapshots__/Checkbox.test.tsx.snap +0 -131
- package/src/components/ui/__snapshots__/ConfirmDialog.test.tsx.snap +0 -35
- package/src/components/ui/__snapshots__/Drawer.test.tsx.snap +0 -67
- package/src/components/ui/__snapshots__/Expandable.test.tsx.snap +0 -159
- package/src/components/ui/__snapshots__/Modal.test.tsx.snap +0 -59
- package/src/components/ui/__snapshots__/Select.test.tsx.snap +0 -254
- package/src/components/ui/__snapshots__/Spin.test.tsx.snap +0 -193
- package/src/components/ui/__snapshots__/Tooltip.test.tsx.snap +0 -113
- package/src/components/ui/definitions.stories.tsx +0 -139
- package/src/context/visemeContext.tsx +0 -384
- package/src/helpers/chatPdfExport.ts +0 -544
- package/src/helpers/configuration.ts +0 -42
- package/src/helpers/constants.ts +0 -267
- package/src/helpers/convertDocument.test.ts +0 -67
- package/src/helpers/convertDocument.ts +0 -35
- package/src/helpers/credits.ts +0 -54
- package/src/helpers/error.test.ts +0 -29
- package/src/helpers/error.ts +0 -278
- package/src/helpers/imageCompression.ts +0 -230
- package/src/helpers/llmUsage.ts +0 -328
- package/src/helpers/markedExtendedTables.js +0 -217
- package/src/helpers/media.test.ts +0 -169
- package/src/helpers/media.ts +0 -81
- package/src/helpers/message.test.ts +0 -126
- package/src/helpers/message.ts +0 -219
- package/src/helpers/nats/getNatsConfig.ts +0 -148
- package/src/helpers/nats/isSessionExpiredError.test.ts +0 -38
- package/src/helpers/nats/isSessionExpiredError.ts +0 -51
- package/src/helpers/nats/useNats.test.tsx +0 -81
- package/src/helpers/nats/useNats.ts +0 -204
- package/src/helpers/nats/useNatsSession.test.ts +0 -16
- package/src/helpers/nats/useNatsSession.ts +0 -460
- package/src/helpers/piiDetection.test.ts +0 -186
- package/src/helpers/piiDetection.ts +0 -91
- package/src/helpers/sanitizer.ts +0 -17
- package/src/helpers/statistics.ts +0 -58
- package/src/helpers/stt/useSTT.ts +0 -515
- package/src/helpers/translations.ts +0 -39
- package/src/helpers/tts/ttsVoiceUtility.ts +0 -275
- package/src/helpers/tts/useTTS.ts +0 -621
- package/src/helpers/utils.test.ts +0 -321
- package/src/helpers/utils.ts +0 -586
- package/src/helpers/venue.ts +0 -36
- package/src/i18n.ts +0 -39
- package/src/index.stories.tsx +0 -220
- package/src/index.test.tsx +0 -156
- package/src/index.tsx +0 -592
- package/src/locales/de.json +0 -680
- package/src/locales/en.json +0 -754
- package/src/locales/es.json +0 -682
- package/src/locales/fr.json +0 -682
- package/src/locales/it.json +0 -750
- package/src/mocks/data.ts +0 -790
- package/src/styles.css +0 -126
- package/src/types/integration.test.ts +0 -32
- package/src/types/integration.ts +0 -31
- package/src/types/layout.ts +0 -50
- package/src/version.ts +0 -2
|
@@ -1,778 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useCallback,
|
|
3
|
-
useEffect,
|
|
4
|
-
memo,
|
|
5
|
-
useMemo,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
} from 'react';
|
|
9
|
-
import cx from 'classnames';
|
|
10
|
-
import {
|
|
11
|
-
DialogState,
|
|
12
|
-
ExpertReference,
|
|
13
|
-
Medium,
|
|
14
|
-
Memori,
|
|
15
|
-
Message,
|
|
16
|
-
Tenant,
|
|
17
|
-
User,
|
|
18
|
-
} from '@memori.ai/memori-api-client/dist/types';
|
|
19
|
-
import {
|
|
20
|
-
hasTouchscreen,
|
|
21
|
-
parseDocumentAttachmentsFromMessage,
|
|
22
|
-
} from '../../helpers/utils';
|
|
23
|
-
import { getResourceUrl } from '../../helpers/media';
|
|
24
|
-
import ChatBubble from '../ChatBubble/ChatBubble';
|
|
25
|
-
import MediaWidget, {
|
|
26
|
-
Props as MediaWidgetProps,
|
|
27
|
-
} from '../MediaWidget/MediaWidget';
|
|
28
|
-
import { Props as MemoriProps } from '../MemoriWidget/MemoriWidget';
|
|
29
|
-
import memoriApiClient from '@memori.ai/memori-api-client';
|
|
30
|
-
import ChatInputs from '../ChatInputs/ChatInputs';
|
|
31
|
-
import Typing from '../Typing/Typing';
|
|
32
|
-
import { boardOfExpertsLoadingSentences } from '../../helpers/constants';
|
|
33
|
-
import ArtifactHandler from '../MemoriArtifactSystem/components/ArtifactHandler/ArtifactHandler';
|
|
34
|
-
import { DocumentIcon } from '../icons/Document';
|
|
35
|
-
import { useTranslation } from 'react-i18next';
|
|
36
|
-
import { maxDocumentsPerMessage, maxDocumentContentLength, pasteAsCardLineThreshold, pasteAsCardCharThreshold } from '../../helpers/constants';
|
|
37
|
-
import Modal from '../ui/Modal';
|
|
38
|
-
import Tooltip from '../ui/Tooltip';
|
|
39
|
-
import {
|
|
40
|
-
BADGE_EMOJI,
|
|
41
|
-
buildLlmUsageHtml,
|
|
42
|
-
formatDuration,
|
|
43
|
-
formatImpactWithApiUnit,
|
|
44
|
-
formatIntegerValue,
|
|
45
|
-
getImpactComparison,
|
|
46
|
-
getMetricValue,
|
|
47
|
-
LlmUsageLabels,
|
|
48
|
-
LlmUsageOnLine,
|
|
49
|
-
UsageBadgeType,
|
|
50
|
-
} from '../../helpers/llmUsage';
|
|
51
|
-
export interface Props {
|
|
52
|
-
memori: Memori;
|
|
53
|
-
tenant?: Tenant;
|
|
54
|
-
sessionID: string;
|
|
55
|
-
translateTo?: string;
|
|
56
|
-
baseUrl?: string;
|
|
57
|
-
apiUrl?: string;
|
|
58
|
-
memoriTyping?: boolean;
|
|
59
|
-
typingText?: string;
|
|
60
|
-
showTypingText?: boolean;
|
|
61
|
-
history: Message[];
|
|
62
|
-
authToken?: string;
|
|
63
|
-
dialogState?: DialogState;
|
|
64
|
-
pushMessage: (message: Message) => void;
|
|
65
|
-
simulateUserPrompt: (text: string, translatedText?: string) => void;
|
|
66
|
-
showDates?: boolean;
|
|
67
|
-
showUpload?: boolean;
|
|
68
|
-
showContextPerLine?: boolean;
|
|
69
|
-
showAIicon?: boolean;
|
|
70
|
-
showTranslationOriginal?: boolean;
|
|
71
|
-
showWhyThisAnswer?: boolean;
|
|
72
|
-
showReasoning?: boolean;
|
|
73
|
-
showMessageConsumption?: boolean;
|
|
74
|
-
client?: ReturnType<typeof memoriApiClient>;
|
|
75
|
-
preview?: boolean;
|
|
76
|
-
microphoneMode?: 'CONTINUOUS' | 'HOLD_TO_TALK';
|
|
77
|
-
sendOnEnter?: 'keypress' | 'click';
|
|
78
|
-
setSendOnEnter: (sendOnEnter: 'keypress' | 'click') => void;
|
|
79
|
-
attachmentsMenuOpen?: 'link' | 'media';
|
|
80
|
-
setAttachmentsMenuOpen: (attachmentsMenuOpen: 'link' | 'media') => void;
|
|
81
|
-
instruct?: boolean;
|
|
82
|
-
showCopyButton?: boolean;
|
|
83
|
-
showInputs?: boolean;
|
|
84
|
-
showMicrophone?: boolean;
|
|
85
|
-
userMessage?: string;
|
|
86
|
-
onChangeUserMessage: (userMessage: string) => void;
|
|
87
|
-
sendMessage: (msg: string, media?: (Medium & { type: string })[]) => void;
|
|
88
|
-
listening?: boolean;
|
|
89
|
-
setEnableFocusChatInput: (enableFocusChatInput: boolean) => void;
|
|
90
|
-
isPlayingAudio?: boolean;
|
|
91
|
-
stopAudio: () => void;
|
|
92
|
-
startListening: () => void;
|
|
93
|
-
stopListening: () => void;
|
|
94
|
-
customMediaRenderer?: MediaWidgetProps['customMediaRenderer'];
|
|
95
|
-
layout?: MemoriProps['layout'];
|
|
96
|
-
userAvatar?: MemoriProps['userAvatar'];
|
|
97
|
-
user?: User;
|
|
98
|
-
experts?: ExpertReference[];
|
|
99
|
-
useMathFormatting?: boolean;
|
|
100
|
-
isHistoryView?: boolean;
|
|
101
|
-
isChatlogPanel?: boolean;
|
|
102
|
-
showFunctionCache?: boolean;
|
|
103
|
-
/** Override total document payload and per-document content limit (character count). */
|
|
104
|
-
maxTotalMessagePayload?: number;
|
|
105
|
-
/** Max characters in chat textarea; shows counter and enforces paste + existing text does not exceed this limit. */
|
|
106
|
-
maxTextareaCharacters?: number;
|
|
107
|
-
/** Max attachments (docs + images) per message. */
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
type MessageWithLlmUsage = Message & { llmUsage?: LlmUsageOnLine };
|
|
112
|
-
interface UsageBadgeModalState {
|
|
113
|
-
type: UsageBadgeType;
|
|
114
|
-
usage: LlmUsageOnLine;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const Chat: React.FC<Props> = ({
|
|
118
|
-
memori,
|
|
119
|
-
tenant,
|
|
120
|
-
sessionID,
|
|
121
|
-
baseUrl,
|
|
122
|
-
apiUrl,
|
|
123
|
-
client,
|
|
124
|
-
translateTo,
|
|
125
|
-
memoriTyping,
|
|
126
|
-
typingText,
|
|
127
|
-
showTypingText = false,
|
|
128
|
-
history = [],
|
|
129
|
-
authToken,
|
|
130
|
-
dialogState,
|
|
131
|
-
simulateUserPrompt,
|
|
132
|
-
showDates = false,
|
|
133
|
-
showContextPerLine = false,
|
|
134
|
-
showAIicon = true,
|
|
135
|
-
showWhyThisAnswer = true,
|
|
136
|
-
showCopyButton = true,
|
|
137
|
-
showTranslationOriginal = false,
|
|
138
|
-
showReasoning = false,
|
|
139
|
-
showMessageConsumption = false,
|
|
140
|
-
preview = false,
|
|
141
|
-
instruct = false,
|
|
142
|
-
showInputs = true,
|
|
143
|
-
showMicrophone = false,
|
|
144
|
-
microphoneMode = 'HOLD_TO_TALK',
|
|
145
|
-
sendOnEnter,
|
|
146
|
-
setSendOnEnter,
|
|
147
|
-
attachmentsMenuOpen,
|
|
148
|
-
setAttachmentsMenuOpen,
|
|
149
|
-
userMessage = '',
|
|
150
|
-
onChangeUserMessage,
|
|
151
|
-
sendMessage,
|
|
152
|
-
listening,
|
|
153
|
-
setEnableFocusChatInput,
|
|
154
|
-
isPlayingAudio,
|
|
155
|
-
stopAudio,
|
|
156
|
-
startListening,
|
|
157
|
-
stopListening,
|
|
158
|
-
customMediaRenderer,
|
|
159
|
-
user,
|
|
160
|
-
userAvatar,
|
|
161
|
-
showUpload = false,
|
|
162
|
-
experts,
|
|
163
|
-
useMathFormatting = false,
|
|
164
|
-
isHistoryView = false,
|
|
165
|
-
isChatlogPanel = false,
|
|
166
|
-
showFunctionCache = false,
|
|
167
|
-
maxTotalMessagePayload,
|
|
168
|
-
maxTextareaCharacters,
|
|
169
|
-
}) => {
|
|
170
|
-
|
|
171
|
-
const [isTextareaExpanded, setIsTextareaExpanded] = useState(false);
|
|
172
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
173
|
-
const [activeUsageBadge, setActiveUsageBadge] =
|
|
174
|
-
useState<UsageBadgeModalState | null>(null);
|
|
175
|
-
const chatWrapperRef = useRef<HTMLDivElement>(null);
|
|
176
|
-
const { t } = useTranslation();
|
|
177
|
-
const locale = (translateTo || memori.culture || 'it-IT').replace('_', '-');
|
|
178
|
-
|
|
179
|
-
const llmUsageLabels = useMemo<LlmUsageLabels>(
|
|
180
|
-
() => ({
|
|
181
|
-
llm: t('chatLogs.llm', { defaultValue: 'LLM' }),
|
|
182
|
-
model: t('chatLogs.model', { defaultValue: 'Model' }),
|
|
183
|
-
provider: t('chatLogs.provider', { defaultValue: 'Provider' }),
|
|
184
|
-
tokens: t('chatLogs.tokens', { defaultValue: 'Tokens' }),
|
|
185
|
-
input: t('chatLogs.input', { defaultValue: 'Input' }),
|
|
186
|
-
output: t('chatLogs.output', { defaultValue: 'Output' }),
|
|
187
|
-
cacheRead: t('chatLogs.cacheRead', { defaultValue: 'Cache read' }),
|
|
188
|
-
cacheWrite: t('chatLogs.cacheWrite', { defaultValue: 'Cache write' }),
|
|
189
|
-
duration: t('chatLogs.duration', { defaultValue: 'Duration' }),
|
|
190
|
-
energy: t('chatLogs.energy', { defaultValue: 'Energy' }),
|
|
191
|
-
co2: t('chatLogs.co2', { defaultValue: 'CO2' }),
|
|
192
|
-
water: t('chatLogs.water', { defaultValue: 'Water' }),
|
|
193
|
-
usageBadgesHint: t('chatLogs.usageBadgesHint', {
|
|
194
|
-
defaultValue: 'Click one of these buttons to show more information',
|
|
195
|
-
}),
|
|
196
|
-
}),
|
|
197
|
-
[t],
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
const usageHtmlByIndex = useMemo(
|
|
201
|
-
() =>
|
|
202
|
-
history.map((message, index) => {
|
|
203
|
-
const messageWithUsage = message as MessageWithLlmUsage;
|
|
204
|
-
return showMessageConsumption &&
|
|
205
|
-
!message.fromUser &&
|
|
206
|
-
messageWithUsage.llmUsage
|
|
207
|
-
? buildLlmUsageHtml(
|
|
208
|
-
messageWithUsage.llmUsage,
|
|
209
|
-
llmUsageLabels,
|
|
210
|
-
index,
|
|
211
|
-
locale,
|
|
212
|
-
)
|
|
213
|
-
: '';
|
|
214
|
-
}),
|
|
215
|
-
[history, llmUsageLabels, locale, showMessageConsumption],
|
|
216
|
-
);
|
|
217
|
-
const scrollToBottom = useCallback(() => {
|
|
218
|
-
if (isHistoryView) return;
|
|
219
|
-
setTimeout(() => {
|
|
220
|
-
let userMsgs = document.querySelectorAll('.memori-chat-scroll-item');
|
|
221
|
-
userMsgs[userMsgs.length - 1]?.scrollIntoView?.();
|
|
222
|
-
}, 200);
|
|
223
|
-
}, [isHistoryView]);
|
|
224
|
-
|
|
225
|
-
// Avoid re-scrolling when `history` is recreated with same content (e.g. on every keystroke).
|
|
226
|
-
const lastAutoscrollSignatureRef = useRef<string | null>(null);
|
|
227
|
-
const lastMessage = history?.[history.length - 1];
|
|
228
|
-
const lastMessageSignature = `${history?.length ?? 0}|${
|
|
229
|
-
lastMessage?.timestamp ?? ''
|
|
230
|
-
}|${lastMessage?.fromUser ? 'u' : 'm'}|${lastMessage?.text?.length ?? 0}|${
|
|
231
|
-
lastMessage?.translatedText?.length ?? 0
|
|
232
|
-
}`;
|
|
233
|
-
useEffect(() => {
|
|
234
|
-
// if we are in preview mode or in history view, don't scroll to the bottom
|
|
235
|
-
if (preview || isHistoryView) return;
|
|
236
|
-
// if the last message signature is the same as the previous one, don't scroll to the bottom
|
|
237
|
-
if (lastAutoscrollSignatureRef.current === lastMessageSignature) return;
|
|
238
|
-
// set the last autoscroll signature to the current one
|
|
239
|
-
lastAutoscrollSignatureRef.current = lastMessageSignature;
|
|
240
|
-
// scroll to the bottom
|
|
241
|
-
scrollToBottom();
|
|
242
|
-
}, [preview, isHistoryView, lastMessageSignature, scrollToBottom]);
|
|
243
|
-
|
|
244
|
-
// Scroll to bottom when textarea is expanded
|
|
245
|
-
// useEffect(() => {
|
|
246
|
-
// if (isTextareaExpanded && !isHistoryView) {
|
|
247
|
-
// setTimeout(() => {
|
|
248
|
-
// scrollToBottom();
|
|
249
|
-
// }, 250);
|
|
250
|
-
// }
|
|
251
|
-
// }, [isTextareaExpanded, isHistoryView]);
|
|
252
|
-
|
|
253
|
-
const onTextareaFocus = () => {
|
|
254
|
-
stopListening();
|
|
255
|
-
const hasTouch = hasTouchscreen();
|
|
256
|
-
|
|
257
|
-
if (hasTouch) setEnableFocusChatInput(true);
|
|
258
|
-
// if the user is on mobile and had not recorded audio, add the chat-focused class to the chat wrapper
|
|
259
|
-
// if (hasTouch && window.innerWidth <= 768) {
|
|
260
|
-
// document.getElementById('chat-wrapper')?.classList?.add('chat-focused');
|
|
261
|
-
// // add the chat-focused class to the memori widget
|
|
262
|
-
// document
|
|
263
|
-
// .querySelector('.memori.memori-widget')
|
|
264
|
-
// ?.classList?.add('chat-focused');
|
|
265
|
-
// setTimeout(() => {
|
|
266
|
-
// scrollToBottom();
|
|
267
|
-
// }, 300);
|
|
268
|
-
// }
|
|
269
|
-
};
|
|
270
|
-
const onTextareaBlur = () => {
|
|
271
|
-
if (
|
|
272
|
-
document
|
|
273
|
-
.getElementById('chat-wrapper')
|
|
274
|
-
?.classList?.contains('chat-focused')
|
|
275
|
-
) {
|
|
276
|
-
document.getElementById('chat-wrapper')?.classList.remove('chat-focused');
|
|
277
|
-
document
|
|
278
|
-
.querySelector('.memori.memori-widget')
|
|
279
|
-
?.classList?.remove('chat-focused');
|
|
280
|
-
scrollToBottom();
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
const onTextareaExpanded = (expanded: boolean) => {
|
|
285
|
-
setIsTextareaExpanded(expanded);
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
// Drag and drop handlers for overlay
|
|
289
|
-
useEffect(() => {
|
|
290
|
-
// Only enable drag and drop when showUpload is true
|
|
291
|
-
if (!showUpload) return;
|
|
292
|
-
|
|
293
|
-
let dragCounter = 0;
|
|
294
|
-
const chatWrapper = document.getElementById('chat-wrapper');
|
|
295
|
-
|
|
296
|
-
const handleDragEnter = (e: DragEvent) => {
|
|
297
|
-
// Only show overlay if dragging files (not text/links)
|
|
298
|
-
if (e.dataTransfer?.types.includes('Files')) {
|
|
299
|
-
dragCounter++;
|
|
300
|
-
if (dragCounter === 1) {
|
|
301
|
-
setIsDragging(true);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const handleDragLeave = (e: DragEvent) => {
|
|
307
|
-
if (e.dataTransfer?.types.includes('Files')) {
|
|
308
|
-
dragCounter--;
|
|
309
|
-
if (dragCounter === 0) {
|
|
310
|
-
setIsDragging(false);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
const handleDragOver = (e: DragEvent) => {
|
|
316
|
-
// Prevent default to allow drop, but don't stop propagation
|
|
317
|
-
if (e.dataTransfer?.types.includes('Files')) {
|
|
318
|
-
e.preventDefault();
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
|
|
322
|
-
const handleDrop = (e: DragEvent) => {
|
|
323
|
-
// Reset dragging state, but let UploadButton handle the actual drop
|
|
324
|
-
if (e.dataTransfer?.types.includes('Files')) {
|
|
325
|
-
dragCounter = 0;
|
|
326
|
-
setIsDragging(false);
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
if (chatWrapper) {
|
|
331
|
-
chatWrapper.addEventListener('dragenter', handleDragEnter);
|
|
332
|
-
chatWrapper.addEventListener('dragleave', handleDragLeave);
|
|
333
|
-
chatWrapper.addEventListener('dragover', handleDragOver);
|
|
334
|
-
chatWrapper.addEventListener('drop', handleDrop);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
return () => {
|
|
338
|
-
if (chatWrapper) {
|
|
339
|
-
chatWrapper.removeEventListener('dragenter', handleDragEnter);
|
|
340
|
-
chatWrapper.removeEventListener('dragleave', handleDragLeave);
|
|
341
|
-
chatWrapper.removeEventListener('dragover', handleDragOver);
|
|
342
|
-
chatWrapper.removeEventListener('drop', handleDrop);
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
}, [showUpload]);
|
|
346
|
-
|
|
347
|
-
useEffect(() => {
|
|
348
|
-
const wrapper = chatWrapperRef.current;
|
|
349
|
-
if (!wrapper || !showMessageConsumption) return;
|
|
350
|
-
|
|
351
|
-
const handleUsageBadgeClick = (event: MouseEvent) => {
|
|
352
|
-
const target = event.target as HTMLElement | null;
|
|
353
|
-
const button = target?.closest<HTMLElement>(
|
|
354
|
-
'[data-llm-badge-type][data-line-index]',
|
|
355
|
-
);
|
|
356
|
-
if (!button) return;
|
|
357
|
-
|
|
358
|
-
const lineIndex = Number(button.dataset.lineIndex);
|
|
359
|
-
const badgeType = button.dataset.llmBadgeType as UsageBadgeType | undefined;
|
|
360
|
-
if (!Number.isInteger(lineIndex) || !badgeType) return;
|
|
361
|
-
|
|
362
|
-
const line = (history?.[lineIndex] as MessageWithLlmUsage) ?? null;
|
|
363
|
-
if (!line?.llmUsage) return;
|
|
364
|
-
|
|
365
|
-
event.preventDefault();
|
|
366
|
-
setActiveUsageBadge({
|
|
367
|
-
type: badgeType,
|
|
368
|
-
usage: line.llmUsage,
|
|
369
|
-
});
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
wrapper.addEventListener('click', handleUsageBadgeClick);
|
|
373
|
-
return () => {
|
|
374
|
-
wrapper.removeEventListener('click', handleUsageBadgeClick);
|
|
375
|
-
};
|
|
376
|
-
}, [history, showMessageConsumption]);
|
|
377
|
-
|
|
378
|
-
return (
|
|
379
|
-
<div
|
|
380
|
-
ref={chatWrapperRef}
|
|
381
|
-
className={cx('memori-chat--wrapper', {
|
|
382
|
-
'memori-chat-wrapper--translate': translateTo,
|
|
383
|
-
'memori-chat-wrapper--expanded': isTextareaExpanded,
|
|
384
|
-
'memori-chat-wrapper--dragging': isDragging,
|
|
385
|
-
})}
|
|
386
|
-
id="chat-wrapper"
|
|
387
|
-
lang={translateTo?.toUpperCase()}
|
|
388
|
-
data-memori-lang={memori.culture?.split('-')?.[0]?.toUpperCase() ?? 'EN'}
|
|
389
|
-
>
|
|
390
|
-
{/* Drag and drop overlay */}
|
|
391
|
-
{isDragging && (
|
|
392
|
-
<div className="memori-chat--drag-overlay">
|
|
393
|
-
<DocumentIcon className="memori-chat--drag-overlay-icon" />
|
|
394
|
-
<span className="memori-chat--drag-overlay-text">
|
|
395
|
-
{t('upload.dragAndDropFiles') ??
|
|
396
|
-
'Drag and drop files here to add them to the chat'}
|
|
397
|
-
</span>
|
|
398
|
-
</div>
|
|
399
|
-
)}
|
|
400
|
-
<div
|
|
401
|
-
className={cx('memori-chat--history', {
|
|
402
|
-
'memori-chat--history-touch': hasTouchscreen(),
|
|
403
|
-
})}
|
|
404
|
-
>
|
|
405
|
-
<div
|
|
406
|
-
className={cx('memori-chat--content', {
|
|
407
|
-
'memori-chat--content-touch': hasTouchscreen(),
|
|
408
|
-
})}
|
|
409
|
-
>
|
|
410
|
-
<div
|
|
411
|
-
className={cx('memori-chat--cover')}
|
|
412
|
-
style={{
|
|
413
|
-
backgroundImage: `url("${getResourceUrl({
|
|
414
|
-
type: 'cover',
|
|
415
|
-
tenantID: tenant?.name,
|
|
416
|
-
resourceURI: memori.coverURL,
|
|
417
|
-
baseURL: baseUrl,
|
|
418
|
-
apiURL: apiUrl,
|
|
419
|
-
})}"), url("${getResourceUrl({
|
|
420
|
-
type: 'cover',
|
|
421
|
-
tenantID: tenant?.name,
|
|
422
|
-
baseURL: baseUrl || 'https://www.aisuru.com',
|
|
423
|
-
apiURL: apiUrl,
|
|
424
|
-
})}")`,
|
|
425
|
-
}}
|
|
426
|
-
/>
|
|
427
|
-
|
|
428
|
-
{history.map((message, index) => (
|
|
429
|
-
<React.Fragment
|
|
430
|
-
key={`${index}-${
|
|
431
|
-
message.text?.includes('<document_attachment')
|
|
432
|
-
? 'has-attachments'
|
|
433
|
-
: 'no-attachments'
|
|
434
|
-
}-${message.timestamp}`}
|
|
435
|
-
>
|
|
436
|
-
<MediaWidget
|
|
437
|
-
simulateUserPrompt={simulateUserPrompt}
|
|
438
|
-
links={
|
|
439
|
-
(message?.media
|
|
440
|
-
?.filter(m => !m.properties?.functionSignature)
|
|
441
|
-
?.filter(m => m.mimeType === 'text/html' && !!m.url) ||
|
|
442
|
-
[]) as Medium[]
|
|
443
|
-
}
|
|
444
|
-
media={[
|
|
445
|
-
// Non-function-cache media items (exclude HTML links; those go into `links`)
|
|
446
|
-
...(message?.media
|
|
447
|
-
?.filter(m => !m.properties?.functionSignature)
|
|
448
|
-
?.filter(m => !(m.mimeType === 'text/html' && !!m.url)) ||
|
|
449
|
-
[]),
|
|
450
|
-
|
|
451
|
-
// Extract document attachments from the original message text.
|
|
452
|
-
// Use message.text (not translatedText) so internal tags stay intact.
|
|
453
|
-
...parseDocumentAttachmentsFromMessage(
|
|
454
|
-
message.text || ''
|
|
455
|
-
).map((attachment, attachmentIndex) => ({
|
|
456
|
-
mediumID: `doc_${Date.now()}_${attachmentIndex}_${Math.random()
|
|
457
|
-
.toString(36)
|
|
458
|
-
.substr(2, 9)}`,
|
|
459
|
-
url: attachment.url,
|
|
460
|
-
mimeType: attachment.type,
|
|
461
|
-
title: attachment.filename,
|
|
462
|
-
content: attachment.content,
|
|
463
|
-
properties: { isDocumentAttachment: true },
|
|
464
|
-
type: 'document' as const,
|
|
465
|
-
})),
|
|
466
|
-
]}
|
|
467
|
-
sessionID={sessionID}
|
|
468
|
-
baseUrl={baseUrl}
|
|
469
|
-
apiUrl={apiUrl}
|
|
470
|
-
translateTo={translateTo}
|
|
471
|
-
customMediaRenderer={customMediaRenderer}
|
|
472
|
-
fromUser={message.fromUser}
|
|
473
|
-
/>
|
|
474
|
-
|
|
475
|
-
<ChatBubble
|
|
476
|
-
key={`chatbubble-${index}-${
|
|
477
|
-
message.text?.includes('<document_attachment')
|
|
478
|
-
? 'has-attachments'
|
|
479
|
-
: 'no-attachments'
|
|
480
|
-
}-${message.timestamp}`}
|
|
481
|
-
isFirst={index === 0}
|
|
482
|
-
message={message}
|
|
483
|
-
memori={memori}
|
|
484
|
-
tenant={tenant}
|
|
485
|
-
client={client}
|
|
486
|
-
baseUrl={baseUrl}
|
|
487
|
-
apiUrl={apiUrl}
|
|
488
|
-
sessionID={sessionID}
|
|
489
|
-
simulateUserPrompt={simulateUserPrompt}
|
|
490
|
-
showAIicon={showAIicon}
|
|
491
|
-
showWhyThisAnswer={showWhyThisAnswer}
|
|
492
|
-
showTranslationOriginal={showTranslationOriginal}
|
|
493
|
-
showFeedback={
|
|
494
|
-
index === history.length - 1 &&
|
|
495
|
-
!message.fromUser &&
|
|
496
|
-
dialogState?.acceptsFeedback
|
|
497
|
-
}
|
|
498
|
-
user={user}
|
|
499
|
-
userAvatar={userAvatar}
|
|
500
|
-
experts={experts}
|
|
501
|
-
showCopyButton={showCopyButton}
|
|
502
|
-
useMathFormatting={useMathFormatting}
|
|
503
|
-
showFunctionCache={showFunctionCache}
|
|
504
|
-
showReasoning={showReasoning}
|
|
505
|
-
usageHtml={usageHtmlByIndex[index]}
|
|
506
|
-
/>
|
|
507
|
-
|
|
508
|
-
{showDates && !!message.timestamp && (
|
|
509
|
-
<small
|
|
510
|
-
className={`memori-chat--timestamp ${
|
|
511
|
-
message.fromUser ? 'text-right' : 'text-left'
|
|
512
|
-
}`}
|
|
513
|
-
>
|
|
514
|
-
{new Intl.DateTimeFormat('it', {
|
|
515
|
-
hour: '2-digit',
|
|
516
|
-
minute: '2-digit',
|
|
517
|
-
second: '2-digit',
|
|
518
|
-
}).format(
|
|
519
|
-
new Date(
|
|
520
|
-
message.timestamp.endsWith('Z')
|
|
521
|
-
? message.timestamp
|
|
522
|
-
: `${message.timestamp}Z`
|
|
523
|
-
)
|
|
524
|
-
)}
|
|
525
|
-
</small>
|
|
526
|
-
)}
|
|
527
|
-
|
|
528
|
-
{showContextPerLine &&
|
|
529
|
-
!!Object.keys(message.contextVars ?? {}).length && (
|
|
530
|
-
<div className="memori-chat--context-vars">
|
|
531
|
-
{Object.keys(message.contextVars ?? {}).map(key =>
|
|
532
|
-
message.contextVars?.[key] === '-' ? (
|
|
533
|
-
<div
|
|
534
|
-
className={`memori-chat--context-tag memori-chat--context-tag-canceled`}
|
|
535
|
-
key={key}
|
|
536
|
-
>
|
|
537
|
-
<span className="memori-chat--context-tag-text">
|
|
538
|
-
{key}
|
|
539
|
-
</span>
|
|
540
|
-
</div>
|
|
541
|
-
) : message.contextVars?.[key] === '✔️' ? (
|
|
542
|
-
<div className="memori-chat--context-tag" key={key}>
|
|
543
|
-
<span className="memori-chat--context-tag-text">
|
|
544
|
-
{key}
|
|
545
|
-
</span>
|
|
546
|
-
</div>
|
|
547
|
-
) : (
|
|
548
|
-
<div className="memori-chat--context-tag" key={key}>
|
|
549
|
-
<span className="memori-chat--context-tag-text">
|
|
550
|
-
{key}: {message.contextVars?.[key]}
|
|
551
|
-
</span>
|
|
552
|
-
</div>
|
|
553
|
-
)
|
|
554
|
-
)}
|
|
555
|
-
</div>
|
|
556
|
-
)}
|
|
557
|
-
|
|
558
|
-
{!isHistoryView && !message.fromUser && (
|
|
559
|
-
<ArtifactHandler
|
|
560
|
-
isChatlogPanel={isChatlogPanel}
|
|
561
|
-
message={message}
|
|
562
|
-
/>
|
|
563
|
-
)}
|
|
564
|
-
</React.Fragment>
|
|
565
|
-
))}
|
|
566
|
-
|
|
567
|
-
{dialogState?.hints &&
|
|
568
|
-
dialogState.hints.length > 0 &&
|
|
569
|
-
!memoriTyping && (
|
|
570
|
-
<MediaWidget
|
|
571
|
-
simulateUserPrompt={simulateUserPrompt}
|
|
572
|
-
hints={
|
|
573
|
-
dialogState.translatedHints
|
|
574
|
-
? dialogState.translatedHints
|
|
575
|
-
: dialogState.hints.map(h => ({
|
|
576
|
-
text: h,
|
|
577
|
-
originalText: h,
|
|
578
|
-
}))
|
|
579
|
-
}
|
|
580
|
-
/>
|
|
581
|
-
)}
|
|
582
|
-
|
|
583
|
-
{!!memoriTyping && (
|
|
584
|
-
<Typing
|
|
585
|
-
useDefaultSentences={showTypingText}
|
|
586
|
-
lang={
|
|
587
|
-
translateTo
|
|
588
|
-
? translateTo.toLowerCase() === 'it'
|
|
589
|
-
? 'it'
|
|
590
|
-
: 'en'
|
|
591
|
-
: memori.culture?.split('-')?.[0]?.toLowerCase() === 'it'
|
|
592
|
-
? 'it'
|
|
593
|
-
: 'en'
|
|
594
|
-
}
|
|
595
|
-
sentence={typingText}
|
|
596
|
-
sentences={
|
|
597
|
-
memori.enableBoardOfExperts
|
|
598
|
-
? boardOfExpertsLoadingSentences
|
|
599
|
-
: undefined
|
|
600
|
-
}
|
|
601
|
-
key={typingText}
|
|
602
|
-
/>
|
|
603
|
-
)}
|
|
604
|
-
<div id="end-messages-ref" />
|
|
605
|
-
</div>
|
|
606
|
-
</div>
|
|
607
|
-
|
|
608
|
-
{showInputs && (
|
|
609
|
-
<ChatInputs
|
|
610
|
-
userMessage={userMessage}
|
|
611
|
-
onChangeUserMessage={onChangeUserMessage}
|
|
612
|
-
dialogState={dialogState}
|
|
613
|
-
instruct={instruct}
|
|
614
|
-
authToken={authToken}
|
|
615
|
-
sendMessage={sendMessage}
|
|
616
|
-
isTyping={memoriTyping}
|
|
617
|
-
microphoneMode={microphoneMode}
|
|
618
|
-
sendOnEnter={sendOnEnter}
|
|
619
|
-
setSendOnEnter={setSendOnEnter}
|
|
620
|
-
client={client}
|
|
621
|
-
sessionID={sessionID}
|
|
622
|
-
baseUrl={baseUrl}
|
|
623
|
-
showUpload={showUpload}
|
|
624
|
-
attachmentsMenuOpen={attachmentsMenuOpen}
|
|
625
|
-
setAttachmentsMenuOpen={setAttachmentsMenuOpen}
|
|
626
|
-
onTextareaFocus={onTextareaFocus}
|
|
627
|
-
onTextareaBlur={onTextareaBlur}
|
|
628
|
-
onTextareaExpanded={onTextareaExpanded}
|
|
629
|
-
startListening={startListening}
|
|
630
|
-
stopListening={stopListening}
|
|
631
|
-
stopAudio={stopAudio}
|
|
632
|
-
listening={listening}
|
|
633
|
-
isPlayingAudio={isPlayingAudio}
|
|
634
|
-
showMicrophone={showMicrophone}
|
|
635
|
-
memoriID={memori?.memoriID}
|
|
636
|
-
maxTotalMessagePayload={maxTotalMessagePayload}
|
|
637
|
-
maxTextareaCharacters={maxTextareaCharacters}
|
|
638
|
-
maxDocumentsPerMessage={maxDocumentsPerMessage}
|
|
639
|
-
maxDocumentContentLength={maxDocumentContentLength}
|
|
640
|
-
pasteAsCardLineThreshold={pasteAsCardLineThreshold}
|
|
641
|
-
pasteAsCardCharThreshold={pasteAsCardCharThreshold}
|
|
642
|
-
/>
|
|
643
|
-
)}
|
|
644
|
-
|
|
645
|
-
<Modal
|
|
646
|
-
open={!!activeUsageBadge}
|
|
647
|
-
onClose={() => setActiveUsageBadge(null)}
|
|
648
|
-
title={
|
|
649
|
-
activeUsageBadge?.type
|
|
650
|
-
? `${BADGE_EMOJI[activeUsageBadge.type]} ${
|
|
651
|
-
llmUsageLabels[activeUsageBadge.type]
|
|
652
|
-
}`
|
|
653
|
-
: undefined
|
|
654
|
-
}
|
|
655
|
-
className="memori-chat--usage-modal"
|
|
656
|
-
>
|
|
657
|
-
{activeUsageBadge?.type === 'llm' && (
|
|
658
|
-
<dl className="memori-chat--usage-details">
|
|
659
|
-
<div>
|
|
660
|
-
<dt>{llmUsageLabels.provider}</dt>
|
|
661
|
-
<dd>{activeUsageBadge.usage.provider ?? '—'}</dd>
|
|
662
|
-
</div>
|
|
663
|
-
<div>
|
|
664
|
-
<dt>{llmUsageLabels.model}</dt>
|
|
665
|
-
<dd>{activeUsageBadge.usage.model ?? '—'}</dd>
|
|
666
|
-
</div>
|
|
667
|
-
<div>
|
|
668
|
-
<dt>
|
|
669
|
-
{llmUsageLabels.tokens} {llmUsageLabels.input}
|
|
670
|
-
</dt>
|
|
671
|
-
<dd>
|
|
672
|
-
{formatIntegerValue(
|
|
673
|
-
activeUsageBadge.usage.totalInputTokens ?? 0,
|
|
674
|
-
locale,
|
|
675
|
-
)}
|
|
676
|
-
</dd>
|
|
677
|
-
</div>
|
|
678
|
-
<div>
|
|
679
|
-
<dt>
|
|
680
|
-
{llmUsageLabels.tokens} {llmUsageLabels.output}
|
|
681
|
-
</dt>
|
|
682
|
-
<dd>
|
|
683
|
-
{formatIntegerValue(activeUsageBadge.usage.outputTokens ?? 0, locale)}
|
|
684
|
-
</dd>
|
|
685
|
-
</div>
|
|
686
|
-
</dl>
|
|
687
|
-
)}
|
|
688
|
-
|
|
689
|
-
{activeUsageBadge?.type === 'energy' && (
|
|
690
|
-
<div className="memori-chat--usage-educational-content">
|
|
691
|
-
<strong className="memori-chat--usage-metric-value">
|
|
692
|
-
{formatImpactWithApiUnit(
|
|
693
|
-
getMetricValue(activeUsageBadge.usage.energyImpact?.energy) ?? 0,
|
|
694
|
-
activeUsageBadge.usage.energyImpact?.energyUnit,
|
|
695
|
-
'kWh',
|
|
696
|
-
'energy',
|
|
697
|
-
locale,
|
|
698
|
-
)}
|
|
699
|
-
</strong>
|
|
700
|
-
<Tooltip
|
|
701
|
-
content={t('chatLogs.approximateValuesTooltip', {
|
|
702
|
-
defaultValue: 'These values are approximate.',
|
|
703
|
-
})}
|
|
704
|
-
>
|
|
705
|
-
<p className="memori-chat--usage-comparable">
|
|
706
|
-
{getImpactComparison(
|
|
707
|
-
getMetricValue(activeUsageBadge.usage.energyImpact?.energy) ?? 0,
|
|
708
|
-
'energy',
|
|
709
|
-
locale,
|
|
710
|
-
t,
|
|
711
|
-
)}
|
|
712
|
-
</p>
|
|
713
|
-
</Tooltip>
|
|
714
|
-
<p>{t('chatLogs.energyImpactDescription')}</p>
|
|
715
|
-
</div>
|
|
716
|
-
)}
|
|
717
|
-
{activeUsageBadge?.type === 'co2' && (
|
|
718
|
-
<div className="memori-chat--usage-educational-content">
|
|
719
|
-
<strong className="memori-chat--usage-metric-value">
|
|
720
|
-
{formatImpactWithApiUnit(
|
|
721
|
-
getMetricValue(activeUsageBadge.usage.energyImpact?.gwp) ?? 0,
|
|
722
|
-
activeUsageBadge.usage.energyImpact?.gwpUnit,
|
|
723
|
-
'kgCO2eq',
|
|
724
|
-
'co2',
|
|
725
|
-
locale,
|
|
726
|
-
)}
|
|
727
|
-
</strong>
|
|
728
|
-
<Tooltip
|
|
729
|
-
content={t('chatLogs.approximateValuesTooltip', {
|
|
730
|
-
defaultValue: 'These values are approximate.',
|
|
731
|
-
})}
|
|
732
|
-
>
|
|
733
|
-
<p className="memori-chat--usage-comparable">
|
|
734
|
-
{getImpactComparison(
|
|
735
|
-
getMetricValue(activeUsageBadge.usage.energyImpact?.gwp) ?? 0,
|
|
736
|
-
'co2',
|
|
737
|
-
locale,
|
|
738
|
-
t,
|
|
739
|
-
)}
|
|
740
|
-
</p>
|
|
741
|
-
</Tooltip>
|
|
742
|
-
<p>{t('chatLogs.co2ImpactDescription')}</p>
|
|
743
|
-
</div>
|
|
744
|
-
)}
|
|
745
|
-
{activeUsageBadge?.type === 'water' && (
|
|
746
|
-
<div className="memori-chat--usage-educational-content">
|
|
747
|
-
<strong className="memori-chat--usage-metric-value">
|
|
748
|
-
{formatImpactWithApiUnit(
|
|
749
|
-
getMetricValue(activeUsageBadge.usage.energyImpact?.wcf) ?? 0,
|
|
750
|
-
activeUsageBadge.usage.energyImpact?.wcfUnit,
|
|
751
|
-
'L',
|
|
752
|
-
'water',
|
|
753
|
-
locale,
|
|
754
|
-
)}
|
|
755
|
-
</strong>
|
|
756
|
-
<Tooltip
|
|
757
|
-
content={t('chatLogs.approximateValuesTooltip', {
|
|
758
|
-
defaultValue: 'These values are approximate.',
|
|
759
|
-
})}
|
|
760
|
-
>
|
|
761
|
-
<p className="memori-chat--usage-comparable">
|
|
762
|
-
{getImpactComparison(
|
|
763
|
-
getMetricValue(activeUsageBadge.usage.energyImpact?.wcf) ?? 0,
|
|
764
|
-
'water',
|
|
765
|
-
locale,
|
|
766
|
-
t,
|
|
767
|
-
)}
|
|
768
|
-
</p>
|
|
769
|
-
</Tooltip>
|
|
770
|
-
<p>{t('chatLogs.waterImpactDescription')}</p>
|
|
771
|
-
</div>
|
|
772
|
-
)}
|
|
773
|
-
</Modal>
|
|
774
|
-
</div>
|
|
775
|
-
);
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
export default memo(Chat);
|