@messenger-box/tailwind-ui-inbox 10.0.3-alpha.0
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 +16 -0
- package/LICENSE +21 -0
- package/jest.config.js +9 -0
- package/lib/cdm-locales/en/translations.json +31 -0
- package/lib/cdm-locales/es/translations.json +31 -0
- package/lib/components/AIAgent/AIAgent.d.ts +32 -0
- package/lib/components/AIAgent/AIAgent.d.ts.map +1 -0
- package/lib/components/AIAgent/AIAgent.js +1135 -0
- package/lib/components/AIAgent/AIAgent.js.map +1 -0
- package/lib/components/AIAgent/InputComponent.d.ts +84 -0
- package/lib/components/AIAgent/InputComponent.d.ts.map +1 -0
- package/lib/components/AIAgent/InputComponent.js +417 -0
- package/lib/components/AIAgent/InputComponent.js.map +1 -0
- package/lib/components/AIAgent/index.d.ts +2 -0
- package/lib/components/AIAgent/index.d.ts.map +1 -0
- package/lib/components/InboxMessage/CommonMessage.d.ts +8 -0
- package/lib/components/InboxMessage/CommonMessage.d.ts.map +1 -0
- package/lib/components/InboxMessage/CommonMessage.js +35 -0
- package/lib/components/InboxMessage/CommonMessage.js.map +1 -0
- package/lib/components/InboxMessage/ConversationItem.d.ts +14 -0
- package/lib/components/InboxMessage/ConversationItem.d.ts.map +1 -0
- package/lib/components/InboxMessage/ConversationItem.js +200 -0
- package/lib/components/InboxMessage/ConversationItem.js.map +1 -0
- package/lib/components/InboxMessage/InputComponent.d.ts +20 -0
- package/lib/components/InboxMessage/InputComponent.d.ts.map +1 -0
- package/lib/components/InboxMessage/InputComponent.js +148 -0
- package/lib/components/InboxMessage/InputComponent.js.map +1 -0
- package/lib/components/InboxMessage/LeftSidebar.d.ts +20 -0
- package/lib/components/InboxMessage/LeftSidebar.d.ts.map +1 -0
- package/lib/components/InboxMessage/LeftSidebar.js +102 -0
- package/lib/components/InboxMessage/LeftSidebar.js.map +1 -0
- package/lib/components/InboxMessage/MessageInput.d.ts +9 -0
- package/lib/components/InboxMessage/MessageInput.d.ts.map +1 -0
- package/lib/components/InboxMessage/MessageInput.js +154 -0
- package/lib/components/InboxMessage/MessageInput.js.map +1 -0
- package/lib/components/InboxMessage/MessageInputComponent.d.ts +9 -0
- package/lib/components/InboxMessage/MessageInputComponent.d.ts.map +1 -0
- package/lib/components/InboxMessage/Messages.d.ts +17 -0
- package/lib/components/InboxMessage/Messages.d.ts.map +1 -0
- package/lib/components/InboxMessage/Messages.js +99 -0
- package/lib/components/InboxMessage/Messages.js.map +1 -0
- package/lib/components/InboxMessage/MessagesBuilderUi.d.ts +17 -0
- package/lib/components/InboxMessage/MessagesBuilderUi.d.ts.map +1 -0
- package/lib/components/InboxMessage/Popover.d.ts +3 -0
- package/lib/components/InboxMessage/Popover.d.ts.map +1 -0
- package/lib/components/InboxMessage/Popover.js +31 -0
- package/lib/components/InboxMessage/Popover.js.map +1 -0
- package/lib/components/InboxMessage/RightSidebar.d.ts +9 -0
- package/lib/components/InboxMessage/RightSidebar.d.ts.map +1 -0
- package/lib/components/InboxMessage/RightSidebar.js +9 -0
- package/lib/components/InboxMessage/RightSidebar.js.map +1 -0
- package/lib/components/InboxMessage/RightSidebarAi.d.ts +37 -0
- package/lib/components/InboxMessage/RightSidebarAi.d.ts.map +1 -0
- package/lib/components/InboxMessage/RightSidebarAi.js +9 -0
- package/lib/components/InboxMessage/RightSidebarAi.js.map +1 -0
- package/lib/components/InboxMessage/ServiceConversationItem.d.ts +12 -0
- package/lib/components/InboxMessage/ServiceConversationItem.d.ts.map +1 -0
- package/lib/components/InboxMessage/ServiceConversationItem.js +185 -0
- package/lib/components/InboxMessage/ServiceConversationItem.js.map +1 -0
- package/lib/components/InboxMessage/ServiceInboxItem.d.ts +12 -0
- package/lib/components/InboxMessage/ServiceInboxItem.d.ts.map +1 -0
- package/lib/components/InboxMessage/ServiceInboxItem.js +182 -0
- package/lib/components/InboxMessage/ServiceInboxItem.js.map +1 -0
- package/lib/components/InboxMessage/StreamingMessageBubble.d.ts +18 -0
- package/lib/components/InboxMessage/StreamingMessageBubble.d.ts.map +1 -0
- package/lib/components/InboxMessage/SubscriptionHandler.d.ts +19 -0
- package/lib/components/InboxMessage/SubscriptionHandler.d.ts.map +1 -0
- package/lib/components/InboxMessage/SubscriptionHandler.js +41 -0
- package/lib/components/InboxMessage/SubscriptionHandler.js.map +1 -0
- package/lib/components/InboxMessage/TypingIndicator.d.ts +11 -0
- package/lib/components/InboxMessage/TypingIndicator.d.ts.map +1 -0
- package/lib/components/InboxMessage/UploadImageButton.d.ts +7 -0
- package/lib/components/InboxMessage/UploadImageButton.d.ts.map +1 -0
- package/lib/components/InboxMessage/UploadImageButton.js +30 -0
- package/lib/components/InboxMessage/UploadImageButton.js.map +1 -0
- package/lib/components/InboxMessage/UserModalContent.d.ts +3 -0
- package/lib/components/InboxMessage/UserModalContent.d.ts.map +1 -0
- package/lib/components/InboxMessage/UserModalContent.js +60 -0
- package/lib/components/InboxMessage/UserModalContent.js.map +1 -0
- package/lib/components/InboxMessage/index.d.ts +19 -0
- package/lib/components/InboxMessage/index.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.d.ts +11 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.js +44 -0
- package/lib/components/InboxMessage/message-widgets/CommonMessage.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts +10 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js +194 -0
- package/lib/components/InboxMessage/message-widgets/ErrorFixCard.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/MessageCard.d.ts +8 -0
- package/lib/components/InboxMessage/message-widgets/MessageCard.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.d.ts +12 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.js +37 -0
- package/lib/components/InboxMessage/message-widgets/MessageSliceRenderer.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts +42 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js +1339 -0
- package/lib/components/InboxMessage/message-widgets/ModernMessageGroup.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.d.ts +8 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.js +14 -0
- package/lib/components/InboxMessage/message-widgets/PlainMessage.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/PropertyMessageWidget.d.ts +9 -0
- package/lib/components/InboxMessage/message-widgets/PropertyMessageWidget.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.d.ts +14 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.d.ts.map +1 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.js +333 -0
- package/lib/components/InboxMessage/message-widgets/SlackLikeMessageGroup.js.map +1 -0
- package/lib/components/InboxMessage/message-widgets/index.d.ts +4 -0
- package/lib/components/InboxMessage/message-widgets/index.d.ts.map +1 -0
- package/lib/components/ModelConfigPanel.d.ts +74 -0
- package/lib/components/ModelConfigPanel.d.ts.map +1 -0
- package/lib/components/ModelConfigPanel.js +1152 -0
- package/lib/components/ModelConfigPanel.js.map +1 -0
- package/lib/components/filler-components/RightSiderBar.d.ts +3 -0
- package/lib/components/filler-components/RightSiderBar.d.ts.map +1 -0
- package/lib/components/filler-components/RightSiderBar.js +532 -0
- package/lib/components/filler-components/RightSiderBar.js.map +1 -0
- package/lib/components/inbox/FilesList.d.ts +20 -0
- package/lib/components/inbox/FilesList.d.ts.map +1 -0
- package/lib/components/inbox/FilesList.js +68 -0
- package/lib/components/inbox/FilesList.js.map +1 -0
- package/lib/components/inbox/MessageItem.d.ts +17 -0
- package/lib/components/inbox/MessageItem.d.ts.map +1 -0
- package/lib/components/inbox/MessageItem.js +50 -0
- package/lib/components/inbox/MessageItem.js.map +1 -0
- package/lib/components/inbox/ThreadItem.d.ts +11 -0
- package/lib/components/inbox/ThreadItem.d.ts.map +1 -0
- package/lib/components/inbox/ThreadItem.js +147 -0
- package/lib/components/inbox/ThreadItem.js.map +1 -0
- package/lib/components/inbox/index.d.ts +4 -0
- package/lib/components/inbox/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +10 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/live-code-editor/hybrid-live-editor.d.ts +20 -0
- package/lib/components/live-code-editor/hybrid-live-editor.d.ts.map +1 -0
- package/lib/components/live-code-editor/index.d.ts +4 -0
- package/lib/components/live-code-editor/index.d.ts.map +1 -0
- package/lib/components/live-code-editor/live-code-editor.d.ts +14 -0
- package/lib/components/live-code-editor/live-code-editor.d.ts.map +1 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.d.ts +81 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.d.ts.map +1 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js +77 -0
- package/lib/components/messages-container-ui/MessagesContainerUI.js.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.d.ts +82 -0
- package/lib/components/messages-container-ui/PlanModeView.d.ts.map +1 -0
- package/lib/components/messages-container-ui/PlanModeView.js +267 -0
- package/lib/components/messages-container-ui/PlanModeView.js.map +1 -0
- package/lib/components/messages-container-ui/index.d.ts +6 -0
- package/lib/components/messages-container-ui/index.d.ts.map +1 -0
- package/lib/components/messages-container-ui/types.d.ts +38 -0
- package/lib/components/messages-container-ui/types.d.ts.map +1 -0
- package/lib/components/slot-fill/chat-message-filler.d.ts +4 -0
- package/lib/components/slot-fill/chat-message-filler.d.ts.map +1 -0
- package/lib/components/slot-fill/chat-message-filler.js +5 -0
- package/lib/components/slot-fill/chat-message-filler.js.map +1 -0
- package/lib/components/slot-fill/chat-message-slot.d.ts +11 -0
- package/lib/components/slot-fill/chat-message-slot.d.ts.map +1 -0
- package/lib/components/slot-fill/chat-message-slot.js +6 -0
- package/lib/components/slot-fill/chat-message-slot.js.map +1 -0
- package/lib/components/slot-fill/index.d.ts +4 -0
- package/lib/components/slot-fill/index.d.ts.map +1 -0
- package/lib/components/slot-fill/right-sidebar-filler.d.ts +4 -0
- package/lib/components/slot-fill/right-sidebar-filler.d.ts.map +1 -0
- package/lib/components/slot-fill/right-sidebar-filler.js +13 -0
- package/lib/components/slot-fill/right-sidebar-filler.js.map +1 -0
- package/lib/components/ui/button.d.ts +9 -0
- package/lib/components/ui/button.d.ts.map +1 -0
- package/lib/compute.d.ts +8 -0
- package/lib/compute.d.ts.map +1 -0
- package/lib/compute.js +264 -0
- package/lib/compute.js.map +1 -0
- package/lib/config/env-config.d.ts +20 -0
- package/lib/config/env-config.d.ts.map +1 -0
- package/lib/config/env-config.js +55 -0
- package/lib/config/env-config.js.map +1 -0
- package/lib/config/index.d.ts +2 -0
- package/lib/config/index.d.ts.map +1 -0
- package/lib/constants/breakpoints.d.ts +8 -0
- package/lib/constants/breakpoints.d.ts.map +1 -0
- package/lib/constants/index.d.ts +3 -0
- package/lib/constants/index.d.ts.map +1 -0
- package/lib/container/AiInbox.d.ts +15 -0
- package/lib/container/AiInbox.d.ts.map +1 -0
- package/lib/container/AiInboxWithLoader.d.ts +36 -0
- package/lib/container/AiInboxWithLoader.d.ts.map +1 -0
- package/lib/container/AiLandingInput.d.ts +27 -0
- package/lib/container/AiLandingInput.d.ts.map +1 -0
- package/lib/container/AiLandingInput.js +149 -0
- package/lib/container/AiLandingInput.js.map +1 -0
- package/lib/container/Inbox.d.ts +15 -0
- package/lib/container/Inbox.d.ts.map +1 -0
- package/lib/container/Inbox.js +964 -0
- package/lib/container/Inbox.js.map +1 -0
- package/lib/container/InboxAiMessagesLoader.d.ts +45 -0
- package/lib/container/InboxAiMessagesLoader.d.ts.map +1 -0
- package/lib/container/InboxAiMessagesLoader.js +80 -0
- package/lib/container/InboxAiMessagesLoader.js.map +1 -0
- package/lib/container/InboxContainer.d.ts +41 -0
- package/lib/container/InboxContainer.d.ts.map +1 -0
- package/lib/container/InboxContainer.js +27 -0
- package/lib/container/InboxContainer.js.map +1 -0
- package/lib/container/InboxTemplate1.d.ts +15 -0
- package/lib/container/InboxTemplate1.d.ts.map +1 -0
- package/lib/container/InboxTemplate1WithLoader.d.ts +36 -0
- package/lib/container/InboxTemplate1WithLoader.d.ts.map +1 -0
- package/lib/container/InboxTemplate2.d.ts +15 -0
- package/lib/container/InboxTemplate2.d.ts.map +1 -0
- package/lib/container/InboxWithAiLoader.d.ts +47 -0
- package/lib/container/InboxWithAiLoader.d.ts.map +1 -0
- package/lib/container/InboxWithAiLoader.js +118 -0
- package/lib/container/InboxWithAiLoader.js.map +1 -0
- package/lib/container/InboxWithLoader.d.ts +36 -0
- package/lib/container/InboxWithLoader.d.ts.map +1 -0
- package/lib/container/InboxWithLoader.js +277 -0
- package/lib/container/InboxWithLoader.js.map +1 -0
- package/lib/container/ServiceInbox.d.ts +9 -0
- package/lib/container/ServiceInbox.d.ts.map +1 -0
- package/lib/container/ServiceInbox.js +141 -0
- package/lib/container/ServiceInbox.js.map +1 -0
- package/lib/container/TestInboxWithAiLoader.d.ts +7 -0
- package/lib/container/TestInboxWithAiLoader.d.ts.map +1 -0
- package/lib/container/TestInboxWithAiLoader.js +135 -0
- package/lib/container/TestInboxWithAiLoader.js.map +1 -0
- package/lib/container/ThreadMessages.d.ts +13 -0
- package/lib/container/ThreadMessages.d.ts.map +1 -0
- package/lib/container/ThreadMessages.js +320 -0
- package/lib/container/ThreadMessages.js.map +1 -0
- package/lib/container/ThreadMessagesInbox.d.ts +14 -0
- package/lib/container/ThreadMessagesInbox.d.ts.map +1 -0
- package/lib/container/ThreadMessagesInbox.js +347 -0
- package/lib/container/ThreadMessagesInbox.js.map +1 -0
- package/lib/container/Threads.d.ts +8 -0
- package/lib/container/Threads.d.ts.map +1 -0
- package/lib/container/Threads.js +231 -0
- package/lib/container/Threads.js.map +1 -0
- package/lib/container/ThreadsInbox.d.ts +21 -0
- package/lib/container/ThreadsInbox.d.ts.map +1 -0
- package/lib/container/ThreadsInbox.js +243 -0
- package/lib/container/ThreadsInbox.js.map +1 -0
- package/lib/container/apply-footer-styles.d.ts +2 -0
- package/lib/container/apply-footer-styles.d.ts.map +1 -0
- package/lib/container/apply-footer-styles.js +16 -0
- package/lib/container/apply-footer-styles.js.map +1 -0
- package/lib/container/index.d.ts +13 -0
- package/lib/container/index.d.ts.map +1 -0
- package/lib/enums/index.d.ts +2 -0
- package/lib/enums/index.d.ts.map +1 -0
- package/lib/enums/messenger-slot-fill-name-enum.d.ts +11 -0
- package/lib/enums/messenger-slot-fill-name-enum.d.ts.map +1 -0
- package/lib/enums/messenger-slot-fill-name-enum.js +11 -0
- package/lib/enums/messenger-slot-fill-name-enum.js.map +1 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/usePersistentModelConfig.d.ts +33 -0
- package/lib/hooks/usePersistentModelConfig.d.ts.map +1 -0
- package/lib/hooks/usePersistentModelConfig.js +123 -0
- package/lib/hooks/usePersistentModelConfig.js.map +1 -0
- package/lib/hooks/useStreamAssembler.d.ts +8 -0
- package/lib/hooks/useStreamAssembler.d.ts.map +1 -0
- package/lib/hooks/useTemplates.d.ts +14 -0
- package/lib/hooks/useTemplates.d.ts.map +1 -0
- package/lib/hooks/useTemplates.js +59 -0
- package/lib/hooks/useTemplates.js.map +1 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/index.d.ts +2 -0
- package/lib/interfaces/index.d.ts.map +1 -0
- package/lib/interfaces/message-widgets.interface.d.ts +21 -0
- package/lib/interfaces/message-widgets.interface.d.ts.map +1 -0
- package/lib/machines/aiAgentMachine.d.ts +3 -0
- package/lib/machines/aiAgentMachine.d.ts.map +1 -0
- package/lib/machines/aiAgentMachine.js +1083 -0
- package/lib/machines/aiAgentMachine.js.map +1 -0
- package/lib/machines/aiAgentMachine.simple.d.ts +3 -0
- package/lib/machines/aiAgentMachine.simple.d.ts.map +1 -0
- package/lib/machines/aiAgentMachine.simple.js +108 -0
- package/lib/machines/aiAgentMachine.simple.js.map +1 -0
- package/lib/machines/index.d.ts +3 -0
- package/lib/machines/index.d.ts.map +1 -0
- package/lib/machines/types.d.ts +77 -0
- package/lib/machines/types.d.ts.map +1 -0
- package/lib/module.d.ts +7 -0
- package/lib/module.d.ts.map +1 -0
- package/lib/module.js +26 -0
- package/lib/module.js.map +1 -0
- package/lib/routes.json +251 -0
- package/lib/styles/responsive.css +76 -0
- package/lib/templates/InboxWithAi.d.ts +44 -0
- package/lib/templates/InboxWithAi.d.ts.map +1 -0
- package/lib/templates/InboxWithAi.js +651 -0
- package/lib/templates/InboxWithAi.js.map +1 -0
- package/lib/templates/InboxWithAi.tsx +844 -0
- package/lib/templates/index.d.ts +2 -0
- package/lib/templates/index.d.ts.map +1 -0
- package/lib/templates/index.ts +1 -0
- package/lib/types/templates.d.ts +35 -0
- package/lib/types/templates.d.ts.map +1 -0
- package/lib/utils/utils.d.ts +2 -0
- package/lib/utils/utils.d.ts.map +1 -0
- package/lib/xstate/index.d.ts +3 -0
- package/lib/xstate/index.d.ts.map +1 -0
- package/lib/xstate/rightSidebar.machine.d.ts +4 -0
- package/lib/xstate/rightSidebar.machine.d.ts.map +1 -0
- package/lib/xstate/rightSidebar.types.d.ts +57 -0
- package/lib/xstate/rightSidebar.types.d.ts.map +1 -0
- package/package.json +69 -0
- package/rollup.config.mjs +47 -0
- package/src/cdm-locales/en/translations.json +31 -0
- package/src/cdm-locales/es/translations.json +31 -0
- package/src/components/AIAgent/AIAgent.tsx +1468 -0
- package/src/components/AIAgent/AIAgent.tsx.bk +1365 -0
- package/src/components/AIAgent/InputComponent.tsx +608 -0
- package/src/components/AIAgent/README.md +174 -0
- package/src/components/AIAgent/index.ts +1 -0
- package/src/components/InboxMessage/CommonMessage.tsx +40 -0
- package/src/components/InboxMessage/ConversationItem.tsx +255 -0
- package/src/components/InboxMessage/InputComponent.tsx +198 -0
- package/src/components/InboxMessage/LeftSidebar.tsx +140 -0
- package/src/components/InboxMessage/MessageInput.tsx +209 -0
- package/src/components/InboxMessage/MessageInputComponent.tsx +245 -0
- package/src/components/InboxMessage/Messages.tsx +137 -0
- package/src/components/InboxMessage/MessagesBuilderUi.tsx +205 -0
- package/src/components/InboxMessage/Popover.tsx +42 -0
- package/src/components/InboxMessage/RightSidebar.tsx +22 -0
- package/src/components/InboxMessage/RightSidebarAi.tsx +47 -0
- package/src/components/InboxMessage/ServiceConversationItem.tsx +234 -0
- package/src/components/InboxMessage/ServiceInboxItem.tsx +223 -0
- package/src/components/InboxMessage/StreamingMessageBubble.tsx +270 -0
- package/src/components/InboxMessage/SubscriptionHandler.tsx +55 -0
- package/src/components/InboxMessage/TypingIndicator.tsx +38 -0
- package/src/components/InboxMessage/UploadImageButton.tsx +46 -0
- package/src/components/InboxMessage/UserModalContent.tsx +60 -0
- package/src/components/InboxMessage/index.ts +18 -0
- package/src/components/InboxMessage/message-widgets/CommonMessage.tsx +69 -0
- package/src/components/InboxMessage/message-widgets/ErrorFixCard.tsx +239 -0
- package/src/components/InboxMessage/message-widgets/MessageCard.tsx +127 -0
- package/src/components/InboxMessage/message-widgets/MessageSliceRenderer.tsx +40 -0
- package/src/components/InboxMessage/message-widgets/ModernMessageGroup.tsx +1733 -0
- package/src/components/InboxMessage/message-widgets/PlainMessage.tsx +18 -0
- package/src/components/InboxMessage/message-widgets/PropertyMessageWidget.tsx +29 -0
- package/src/components/InboxMessage/message-widgets/SlackLikeMessageGroup.tsx +492 -0
- package/src/components/InboxMessage/message-widgets/index.ts +8 -0
- package/src/components/ModelConfigPanel.tsx +1357 -0
- package/src/components/filler-components/RightSiderBar.tsx +572 -0
- package/src/components/inbox/FilesList.tsx +89 -0
- package/src/components/inbox/MessageItem.tsx +50 -0
- package/src/components/inbox/ThreadItem.tsx +295 -0
- package/src/components/inbox/index.ts +3 -0
- package/src/components/index.ts +29 -0
- package/src/components/live-code-editor/hybrid-live-editor.tsx +105 -0
- package/src/components/live-code-editor/index.ts +3 -0
- package/src/components/live-code-editor/live-code-editor.tsx +257 -0
- package/src/components/messages-container-ui/MessagesContainerUI.tsx +151 -0
- package/src/components/messages-container-ui/PlanModeView.tsx +426 -0
- package/src/components/messages-container-ui/README.md +91 -0
- package/src/components/messages-container-ui/index.ts +5 -0
- package/src/components/messages-container-ui/types.ts +40 -0
- package/src/components/slot-fill/chat-message-filler.tsx +18 -0
- package/src/components/slot-fill/chat-message-slot.tsx +18 -0
- package/src/components/slot-fill/index.ts +3 -0
- package/src/components/slot-fill/right-sidebar-filler.tsx +48 -0
- package/src/components/ui/button.tsx +32 -0
- package/src/compute.ts +271 -0
- package/src/config/env-config.ts +24 -0
- package/src/config/index.ts +1 -0
- package/src/constants/breakpoints.ts +7 -0
- package/src/constants/index.ts +5 -0
- package/src/container/AiInbox.tsx +1879 -0
- package/src/container/AiInboxWithLoader.tsx +356 -0
- package/src/container/AiLandingInput.tsx +200 -0
- package/src/container/Inbox.tsx +1095 -0
- package/src/container/InboxAiMessagesLoader.tsx +129 -0
- package/src/container/InboxContainer.tsx +61 -0
- package/src/container/InboxTemplate1.tsx +1553 -0
- package/src/container/InboxTemplate1WithLoader.tsx +338 -0
- package/src/container/InboxTemplate2.tsx +1617 -0
- package/src/container/InboxWithAiLoader.tsx +177 -0
- package/src/container/InboxWithLoader.tsx +341 -0
- package/src/container/ServiceInbox.tsx +188 -0
- package/src/container/TestInboxWithAiLoader.tsx +147 -0
- package/src/container/ThreadMessages.tsx +378 -0
- package/src/container/ThreadMessagesInbox.tsx +457 -0
- package/src/container/Threads.tsx +270 -0
- package/src/container/ThreadsInbox.tsx +351 -0
- package/src/container/apply-footer-styles.ts +17 -0
- package/src/container/index.ts +31 -0
- package/src/enums/index.ts +1 -0
- package/src/enums/messenger-slot-fill-name-enum.ts +10 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/usePersistentModelConfig.ts +166 -0
- package/src/hooks/useStreamAssembler.ts +7 -0
- package/src/hooks/useTemplates.ts +75 -0
- package/src/index.ts +49 -0
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/message-widgets.interface.ts +21 -0
- package/src/machines/aiAgentMachine.simple.ts +89 -0
- package/src/machines/aiAgentMachine.ts +1296 -0
- package/src/machines/aiAgentMachine.ts.bk +1296 -0
- package/src/machines/index.ts +2 -0
- package/src/machines/types.ts +59 -0
- package/src/module.tsx +32 -0
- package/src/styles/responsive.css +76 -0
- package/src/templates/InboxWithAi.tsx +844 -0
- package/src/templates/index.ts +1 -0
- package/src/types/templates.ts +35 -0
- package/src/utils/utils.ts +3 -0
- package/src/xstate/index.ts +2 -0
- package/src/xstate/rightSidebar.machine.ts +304 -0
- package/src/xstate/rightSidebar.types.ts +58 -0
- package/tsconfig.json +14 -0
- package/webpack.config.js +92 -0
|
@@ -0,0 +1,1135 @@
|
|
|
1
|
+
import React__default,{useState,useRef,useEffect,useCallback,useMemo}from'react';import {useMachine}from'@xstate/react';import {aiAgentMachine}from'../../machines/aiAgentMachine.simple.js';import {InputComponent}from'./InputComponent.js';import {isToday,isYesterday,format}from'date-fns';import {useTranslation}from'react-i18next';import {ModernMessageGroupComponent}from'../InboxMessage/message-widgets/ModernMessageGroup.js';import {useUploadFiles}from'@messenger-box/platform-client';import {AiAgentMessageRole,PostTypeEnum,RoomType}from'common';import {useSelector,shallowEqual}from'react-redux';import {userSelector}from'@adminide-stack/user-auth0-client';import {objectId}from'@messenger-box/core';import {useApolloClient}from'@apollo/client/index.js';import {useSendMessagesMutation,useCreateChannelWorkflowJobMutation,useMessagesQuery,MessagesDocument,OnChatMessageAddedDocument}from'common/graphql';import {uniqBy,orderBy}from'lodash-es';import {useParams,useNavigate}from'@remix-run/react';import {SubscriptionHandler}from'../InboxMessage/SubscriptionHandler.js';import {usePersistentModelConfig}from'../../hooks/usePersistentModelConfig.js';/** Resolver may expose role/fragment on propsConfiguration or legacy props (Mongo shape). */
|
|
2
|
+
const getPostRoleUpper = m => String(m?.propsConfiguration?.contents?.role ?? m?.propsConfiguration?.content?.role ?? m?.props?.role ?? '').toUpperCase();
|
|
3
|
+
const getPostFragment = m => m?.propsConfiguration?.contents?.fragment ?? m?.propsConfiguration?.content?.fragment ?? m?.props?.fragment;
|
|
4
|
+
const isAssistantPost = m => {
|
|
5
|
+
if (getPostRoleUpper(m) === 'ASSISTANT') return true;
|
|
6
|
+
const typ = String(m?.type ?? '').toUpperCase();
|
|
7
|
+
return typ === 'AIASSISTANT' || typ === 'ASSISTANT';
|
|
8
|
+
};
|
|
9
|
+
const isAssistantResponseComplete = fragment => {
|
|
10
|
+
if (!fragment) return false;
|
|
11
|
+
if (fragment.isCreatingSandbox === false) return true;
|
|
12
|
+
if (fragment.isCreatingSandbox === true) return false;
|
|
13
|
+
const url = fragment.sandboxUrl;
|
|
14
|
+
if (typeof url === 'string' && url.trim().length > 0) return true;
|
|
15
|
+
if (fragment.files && typeof fragment.files === 'object' && Object.keys(fragment.files).length > 0) return true;
|
|
16
|
+
if (typeof fragment.summary === 'string' && fragment.summary.trim().length > 0) return true;
|
|
17
|
+
if (fragment.isError === true || fragment.type === 'ERROR') return true;
|
|
18
|
+
if (String(fragment.type ?? '').toUpperCase() === 'RESULT') return true;
|
|
19
|
+
return false;
|
|
20
|
+
};
|
|
21
|
+
const AIAgent = ({
|
|
22
|
+
channelId,
|
|
23
|
+
projectId,
|
|
24
|
+
onSendMessage,
|
|
25
|
+
placeholder = 'Ask me anything...',
|
|
26
|
+
className = '',
|
|
27
|
+
currentUser,
|
|
28
|
+
isDesktopView = false,
|
|
29
|
+
isSmallScreen = false,
|
|
30
|
+
showDateSeparators = false,
|
|
31
|
+
setMessages,
|
|
32
|
+
setSelectedPost,
|
|
33
|
+
messages,
|
|
34
|
+
selectedPost,
|
|
35
|
+
setIsLoading,
|
|
36
|
+
isLoading,
|
|
37
|
+
sendMessageInput,
|
|
38
|
+
isShowOnlyInbox = false,
|
|
39
|
+
showModeSelector = false,
|
|
40
|
+
showStopButton = false,
|
|
41
|
+
onStop,
|
|
42
|
+
templates,
|
|
43
|
+
selectedTemplate,
|
|
44
|
+
suggestedTemplate,
|
|
45
|
+
onSelectTemplate,
|
|
46
|
+
templateSelectedLabel,
|
|
47
|
+
templateModalItems,
|
|
48
|
+
showTemplateModal,
|
|
49
|
+
onOpenTemplateModal,
|
|
50
|
+
onCloseTemplateModal,
|
|
51
|
+
onSelectTemplateById,
|
|
52
|
+
onClearTemplate,
|
|
53
|
+
onAcceptSuggestedTemplate,
|
|
54
|
+
isAnalyzingQuery,
|
|
55
|
+
onQueryChange,
|
|
56
|
+
leftItemsOverrides,
|
|
57
|
+
rightItemsOverrides,
|
|
58
|
+
inputToolBarProps
|
|
59
|
+
}) => {
|
|
60
|
+
const [state, send] = useMachine(aiAgentMachine);
|
|
61
|
+
const apolloClient = useApolloClient();
|
|
62
|
+
const {
|
|
63
|
+
startUpload
|
|
64
|
+
} = useUploadFiles();
|
|
65
|
+
const [sendMsg] = useSendMessagesMutation();
|
|
66
|
+
const [createChannelWorkflowJob] = useCreateChannelWorkflowJobMutation();
|
|
67
|
+
const auth = useSelector(userSelector, shallowEqual);
|
|
68
|
+
const {
|
|
69
|
+
id: pathChannelId
|
|
70
|
+
} = useParams();
|
|
71
|
+
const navigate = useNavigate();
|
|
72
|
+
const {
|
|
73
|
+
modelConfig,
|
|
74
|
+
updateModelConfig,
|
|
75
|
+
getValidatedConfig,
|
|
76
|
+
hasApiKey
|
|
77
|
+
} = usePersistentModelConfig();
|
|
78
|
+
const [postId, setPostId] = useState(null);
|
|
79
|
+
/** Cleared when the first real assistant message replaces or supersedes the optimistic placeholder */
|
|
80
|
+
const optimisticAssistantMessageIdRef = useRef(null);
|
|
81
|
+
const scrollPendingRef = useRef(null);
|
|
82
|
+
const streamScrollRafRef = useRef(null);
|
|
83
|
+
const prevLastMessageIdRef = useRef(null);
|
|
84
|
+
// const [isLoading, setIsLoading] = useState(false);
|
|
85
|
+
const [errorData, setError] = useState(null);
|
|
86
|
+
// Get channelId from props or path params
|
|
87
|
+
const actualChannelId = channelId || pathChannelId;
|
|
88
|
+
// const { data: chatMessageAddedData } = useOnChatMessageAddedSubscription({
|
|
89
|
+
// variables: { channelId: actualChannelId?.toString() || '' },
|
|
90
|
+
// skip: !actualChannelId,
|
|
91
|
+
// });
|
|
92
|
+
// Subscribe to sandbox errors if projectId is provided
|
|
93
|
+
// Direct message query from InboxWithAiLoader.tsx
|
|
94
|
+
const messagesQuery = useMessagesQuery({
|
|
95
|
+
variables: {
|
|
96
|
+
channelId: actualChannelId?.toString(),
|
|
97
|
+
parentId: null,
|
|
98
|
+
limit: 50
|
|
99
|
+
},
|
|
100
|
+
skip: !actualChannelId,
|
|
101
|
+
fetchPolicy: 'cache-and-network',
|
|
102
|
+
errorPolicy: 'all',
|
|
103
|
+
notifyOnNetworkStatusChange: true,
|
|
104
|
+
returnPartialData: true,
|
|
105
|
+
pollInterval: 0,
|
|
106
|
+
context: {
|
|
107
|
+
cacheKey: 'messages-list'
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
// console.log('messagesQuery...', JSON.stringify(messagesQuery?.data?.messages?.data));
|
|
111
|
+
const {
|
|
112
|
+
messages: aiMessages,
|
|
113
|
+
error,
|
|
114
|
+
isTyping
|
|
115
|
+
} = state.context;
|
|
116
|
+
const {
|
|
117
|
+
t
|
|
118
|
+
} = useTranslation('translations');
|
|
119
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
120
|
+
const [selectedElement, setSelectedElement] = useState(null);
|
|
121
|
+
const [activeTab, setActiveTab] = useState('chat');
|
|
122
|
+
const bottomRef = useRef(null);
|
|
123
|
+
const [sandboxErrors, setSandboxErrors] = useState([]);
|
|
124
|
+
const [currentFiles, setCurrentFiles] = useState({});
|
|
125
|
+
const [canvasLayers, setCanvasLayers] = useState([]);
|
|
126
|
+
// New state variables for message display control
|
|
127
|
+
const [isSuccessThinking, setIsSuccessThinking] = useState(false);
|
|
128
|
+
const successThinkingTimeoutRef = useRef(null);
|
|
129
|
+
// When showing only inbox, force Chat tab and hide tab switcher UI
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (isShowOnlyInbox && activeTab !== 'chat') {
|
|
132
|
+
setActiveTab('chat');
|
|
133
|
+
}
|
|
134
|
+
}, [isShowOnlyInbox, activeTab]);
|
|
135
|
+
// Get regular messages from direct query
|
|
136
|
+
const {
|
|
137
|
+
data: messagesData,
|
|
138
|
+
loading: messageLoading,
|
|
139
|
+
refetch: refetchMessages,
|
|
140
|
+
fetchMore: fetchMoreMessages,
|
|
141
|
+
subscribeToMore
|
|
142
|
+
} = messagesQuery;
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (actualChannelId) {
|
|
145
|
+
refetchMessages({
|
|
146
|
+
channelId: actualChannelId?.toString(),
|
|
147
|
+
parentId: null,
|
|
148
|
+
limit: 50
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}, [actualChannelId, refetchMessages]);
|
|
152
|
+
// useEffect(() => {
|
|
153
|
+
// if (chatMessageAddedData?.chatMessageAdded) {
|
|
154
|
+
// console.log(
|
|
155
|
+
// 'chatMessageAddedData?.chatMessageAdded',
|
|
156
|
+
// JSON.stringify(chatMessageAddedData?.chatMessageAdded, null, 2),
|
|
157
|
+
// );
|
|
158
|
+
// // Stop the success thinking loader once a new message arrives
|
|
159
|
+
// if (isSuccessThinking) {
|
|
160
|
+
// setIsSuccessThinking(false);
|
|
161
|
+
// if (successThinkingTimeoutRef.current) {
|
|
162
|
+
// clearTimeout(successThinkingTimeoutRef.current);
|
|
163
|
+
// successThinkingTimeoutRef.current = null;
|
|
164
|
+
// }
|
|
165
|
+
// }
|
|
166
|
+
// if (isShowOnlyInbox) {
|
|
167
|
+
// setIsLoading(false);
|
|
168
|
+
// }
|
|
169
|
+
// }
|
|
170
|
+
// console.log('isShowOnlyInbox', isShowOnlyInbox, ' isLoading', isLoading);
|
|
171
|
+
// }, [chatMessageAddedData?.chatMessageAdded, isShowOnlyInbox, setIsLoading]);
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
if (messagesData?.messages?.data?.length >= 1) {
|
|
174
|
+
setPostId(messagesData.messages.data[0]?.id);
|
|
175
|
+
}
|
|
176
|
+
// console.log('messagesData?.messages?.data',JSON.stringify(messagesData?.messages?.data,null,2))
|
|
177
|
+
}, [messagesData?.messages?.data]);
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (sendMessageInput?.postData?.content && sendMessageInput?.postData?.content.trim() !== '') {
|
|
180
|
+
console.log('sendMessageInput...', JSON.stringify(sendMessageInput?.postData?.content, null, 2));
|
|
181
|
+
handleSend(sendMessageInput?.postData?.content || '', []);
|
|
182
|
+
}
|
|
183
|
+
}, [sendMessageInput?.postData?.content]);
|
|
184
|
+
// Handle sandbox error subscription updates
|
|
185
|
+
// Scroll to bottom — cancels any pending scroll so streaming updates do not queue many smooth scrolls
|
|
186
|
+
const scrollToBottom = useCallback((behavior = 'smooth', delay = 0) => {
|
|
187
|
+
if (scrollPendingRef.current) {
|
|
188
|
+
clearTimeout(scrollPendingRef.current);
|
|
189
|
+
scrollPendingRef.current = null;
|
|
190
|
+
}
|
|
191
|
+
scrollPendingRef.current = setTimeout(() => {
|
|
192
|
+
scrollPendingRef.current = null;
|
|
193
|
+
if (bottomRef.current) {
|
|
194
|
+
bottomRef.current.scrollIntoView({
|
|
195
|
+
behavior,
|
|
196
|
+
block: 'end',
|
|
197
|
+
inline: 'nearest'
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}, delay);
|
|
201
|
+
}, []);
|
|
202
|
+
const regularMessages = useMemo(() => {
|
|
203
|
+
if (!messagesData?.messages?.data) return [];
|
|
204
|
+
const mainMessages = messagesData.messages.data || [];
|
|
205
|
+
const replyMessages = messagesData.messages.data[0]?.replies?.data || [];
|
|
206
|
+
const allMessages = [...mainMessages, ...replyMessages];
|
|
207
|
+
const getMsgId = m => String(m?.id ?? m?._id ?? '');
|
|
208
|
+
const getCreatedAt = m => {
|
|
209
|
+
const v = m?.createdAt;
|
|
210
|
+
if (!v) return 0;
|
|
211
|
+
const t = typeof v === 'number' ? v : new Date(v).getTime();
|
|
212
|
+
return Number.isNaN(t) ? 0 : t;
|
|
213
|
+
};
|
|
214
|
+
const uniq = uniqBy(allMessages, m => getMsgId(m));
|
|
215
|
+
const ids = new Set(uniq.map(m => getMsgId(m)));
|
|
216
|
+
const roots = uniq.filter(m => !m?.parentId || !ids.has(String(m.parentId)));
|
|
217
|
+
const replies = uniq.filter(m => m?.parentId && ids.has(String(m.parentId)));
|
|
218
|
+
const rootsSorted = orderBy(roots, [getCreatedAt], ['asc']);
|
|
219
|
+
const result = [];
|
|
220
|
+
for (const root of rootsSorted) {
|
|
221
|
+
result.push(root);
|
|
222
|
+
const children = orderBy(replies.filter(r => String(r.parentId) === getMsgId(root)), [getCreatedAt], ['asc']);
|
|
223
|
+
result.push(...children);
|
|
224
|
+
}
|
|
225
|
+
const orphanReplies = replies.filter(r => !result.some(x => getMsgId(x) === getMsgId(r)));
|
|
226
|
+
return [...result, ...orderBy(orphanReplies, [getCreatedAt], ['asc'])];
|
|
227
|
+
}, [messagesData?.messages?.data]);
|
|
228
|
+
console.log('regularMessages...........', JSON.stringify(regularMessages, null, 2));
|
|
229
|
+
// True while the latest assistant post is still building a sandbox (or fragment not yet complete)
|
|
230
|
+
const isCreatingSandbox = useMemo(() => {
|
|
231
|
+
if (isShowOnlyInbox) return false;
|
|
232
|
+
if (!regularMessages || regularMessages.length === 0) return false;
|
|
233
|
+
const mostRecentAssistant = regularMessages.slice().reverse().find(isAssistantPost);
|
|
234
|
+
if (!mostRecentAssistant) return false;
|
|
235
|
+
const fragment = getPostFragment(mostRecentAssistant);
|
|
236
|
+
if (fragment?.isCreatingSandbox === true) return true;
|
|
237
|
+
if (isAssistantResponseComplete(fragment)) return false;
|
|
238
|
+
// Assistant row exists but no completion signals yet — still in progress
|
|
239
|
+
if (fragment && Object.keys(fragment).length > 0) return true;
|
|
240
|
+
return false;
|
|
241
|
+
}, [regularMessages, isShowOnlyInbox]);
|
|
242
|
+
// handleSend sets these on submit; clear them when the latest assistant message is clearly done
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
if (isShowOnlyInbox) return;
|
|
245
|
+
if (!regularMessages?.length) return;
|
|
246
|
+
const mostRecentAssistant = regularMessages.slice().reverse().find(isAssistantPost);
|
|
247
|
+
if (!mostRecentAssistant) return;
|
|
248
|
+
const fragment = getPostFragment(mostRecentAssistant);
|
|
249
|
+
if (!isAssistantResponseComplete(fragment)) return;
|
|
250
|
+
setIsSuccessThinking(false);
|
|
251
|
+
setIsLoading?.(false);
|
|
252
|
+
}, [regularMessages, isShowOnlyInbox, setIsLoading]);
|
|
253
|
+
// Send regular messages to AI agent machine for context
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
if (regularMessages && regularMessages.length > 0) {
|
|
256
|
+
send({
|
|
257
|
+
type: 'UPDATE_REGULAR_MESSAGES',
|
|
258
|
+
messages: regularMessages
|
|
259
|
+
});
|
|
260
|
+
setMessages(regularMessages);
|
|
261
|
+
const currentMessage = regularMessages?.[regularMessages.length - 1];
|
|
262
|
+
setSelectedPost(regularMessages[regularMessages.length - 1]);
|
|
263
|
+
setCurrentFiles(currentMessage?.propsConfiguration?.contents?.fragment?.files ?? {});
|
|
264
|
+
let canvasLayers = currentMessage?.propsConfiguration?.contents?.fragment?.canvasLayers ?? [];
|
|
265
|
+
const summary = currentMessage?.propsConfiguration?.contents?.fragment?.summary ?? null;
|
|
266
|
+
// If not in direct field, try to extract from summary
|
|
267
|
+
if (!canvasLayers && summary) {
|
|
268
|
+
const canvasLayersMatch = summary?.match(/<canvas_layers>([\s\S]*?)<\/canvas_layers>/);
|
|
269
|
+
if (canvasLayersMatch) {
|
|
270
|
+
try {
|
|
271
|
+
canvasLayers = JSON.parse(canvasLayersMatch[1]);
|
|
272
|
+
} catch (error) {
|
|
273
|
+
console.error('Failed to parse canvas layers from summary:', error);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// Update canvas layers if available
|
|
278
|
+
if (canvasLayers && Array.isArray(canvasLayers)) {
|
|
279
|
+
setCanvasLayers(canvasLayers);
|
|
280
|
+
}
|
|
281
|
+
console.log('currenmessage', currentMessage);
|
|
282
|
+
if (currentMessage?.propsConfiguration?.contents?.role === 'ASSISTANT') ;
|
|
283
|
+
if (isShowOnlyInbox) {
|
|
284
|
+
setIsLoading(false);
|
|
285
|
+
}
|
|
286
|
+
// Scroll behavior (Perplexity-style): smooth when a new last message appears; coalesce updates on the same id
|
|
287
|
+
const last = regularMessages[regularMessages.length - 1];
|
|
288
|
+
const lastId = last?.id != null ? String(last.id) : null;
|
|
289
|
+
const isNewLastRow = lastId !== prevLastMessageIdRef.current;
|
|
290
|
+
prevLastMessageIdRef.current = lastId;
|
|
291
|
+
if (isNewLastRow) {
|
|
292
|
+
if (streamScrollRafRef.current != null) {
|
|
293
|
+
cancelAnimationFrame(streamScrollRafRef.current);
|
|
294
|
+
streamScrollRafRef.current = null;
|
|
295
|
+
}
|
|
296
|
+
scrollToBottom('smooth', 0);
|
|
297
|
+
} else if (streamScrollRafRef.current == null) {
|
|
298
|
+
streamScrollRafRef.current = requestAnimationFrame(() => {
|
|
299
|
+
streamScrollRafRef.current = null;
|
|
300
|
+
scrollToBottom('auto', 0);
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}, [regularMessages, send, isShowOnlyInbox, setIsLoading, scrollToBottom]);
|
|
305
|
+
const onOpen = element => {
|
|
306
|
+
setSelectedElement(element);
|
|
307
|
+
setIsOpen(true);
|
|
308
|
+
};
|
|
309
|
+
const onClose = () => {
|
|
310
|
+
setIsOpen(false);
|
|
311
|
+
setSelectedElement(null);
|
|
312
|
+
};
|
|
313
|
+
const handleSend = useCallback(async (message, files = []) => {
|
|
314
|
+
// Allow sending if there's either a message or files
|
|
315
|
+
if ((!message || !message.trim()) && (!files || files.length === 0)) return;
|
|
316
|
+
const validated = getValidatedConfig();
|
|
317
|
+
if (!validated && !hasApiKey) {
|
|
318
|
+
// Warn but continue — the user's message should still be persisted
|
|
319
|
+
// even if the AI cannot respond without an API key.
|
|
320
|
+
console.warn('⚠️ No AI API key configured. Message will be saved but AI cannot respond. ' + 'Open Settings (gear icon) to add your API key.');
|
|
321
|
+
}
|
|
322
|
+
const {
|
|
323
|
+
extensionId: _omitExtensionId,
|
|
324
|
+
formId: _omitFormId,
|
|
325
|
+
functionId: _omitFunctionId,
|
|
326
|
+
stepName: _omitStepName,
|
|
327
|
+
metadata: _omitMetadata,
|
|
328
|
+
...modelConfigWithoutExtensionId
|
|
329
|
+
} = modelConfig || {};
|
|
330
|
+
let createChannelInputData = sendMessageInput ? {
|
|
331
|
+
...sendMessageInput,
|
|
332
|
+
channelId: sendMessageInput?.channelId || actualChannelId,
|
|
333
|
+
title: sendMessageInput?.title || 'AI Assistant',
|
|
334
|
+
description: sendMessageInput?.description || 'AI Assistant',
|
|
335
|
+
displayName: sendMessageInput?.displayName || 'AI Assistant',
|
|
336
|
+
topic: sendMessageInput?.topic || 'AI Assistant',
|
|
337
|
+
// projectId: projectId,
|
|
338
|
+
type: sendMessageInput?.type || RoomType.Aiassistant,
|
|
339
|
+
postData: {
|
|
340
|
+
...sendMessageInput?.postData,
|
|
341
|
+
postId: sendMessageInput?.postData?.postId || postId || undefined,
|
|
342
|
+
type: sendMessageInput?.postData?.type || PostTypeEnum.Aiassistant,
|
|
343
|
+
content: sendMessageInput?.postData?.content || message,
|
|
344
|
+
props: {
|
|
345
|
+
...sendMessageInput?.postData?.props,
|
|
346
|
+
template: sendMessageInput?.postData?.props?.template || modelConfig?.template || 'vite-react',
|
|
347
|
+
//projectId: projectId,
|
|
348
|
+
role: sendMessageInput?.postData?.props?.role || AiAgentMessageRole.User,
|
|
349
|
+
fragment: sendMessageInput?.postData?.props?.fragment || {}
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
additionalProperties: sendMessageInput?.additionalProperties || {
|
|
353
|
+
modelConfig: modelConfigWithoutExtensionId
|
|
354
|
+
}
|
|
355
|
+
} : null;
|
|
356
|
+
const createChannelInput = createChannelInputData || {
|
|
357
|
+
channelId: actualChannelId,
|
|
358
|
+
title: 'AI Assistant',
|
|
359
|
+
description: 'AI Assistant',
|
|
360
|
+
displayName: 'AI Assistant',
|
|
361
|
+
topic: 'AI Assistant',
|
|
362
|
+
// projectId: projectId,
|
|
363
|
+
type: RoomType.Aiassistant,
|
|
364
|
+
postData: {
|
|
365
|
+
postId: postId || undefined,
|
|
366
|
+
type: PostTypeEnum.Aiassistant,
|
|
367
|
+
content: message,
|
|
368
|
+
props: {
|
|
369
|
+
template: modelConfig?.template || 'vite-react',
|
|
370
|
+
//projectId: projectId,
|
|
371
|
+
role: AiAgentMessageRole.User,
|
|
372
|
+
fragment: {}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
additionalProperties: {
|
|
376
|
+
modelConfig: modelConfigWithoutExtensionId
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
// Start the AI thinking loader immediately on send
|
|
380
|
+
if (successThinkingTimeoutRef.current) {
|
|
381
|
+
clearTimeout(successThinkingTimeoutRef.current);
|
|
382
|
+
successThinkingTimeoutRef.current = null;
|
|
383
|
+
}
|
|
384
|
+
setIsSuccessThinking(true);
|
|
385
|
+
setIsLoading(true);
|
|
386
|
+
// Optimistic update: Add assistant message with isCreatingSandbox: true
|
|
387
|
+
if (!isShowOnlyInbox && actualChannelId) {
|
|
388
|
+
try {
|
|
389
|
+
const previousOptimisticId = optimisticAssistantMessageIdRef.current;
|
|
390
|
+
const optimisticAssistantMessageId = objectId();
|
|
391
|
+
optimisticAssistantMessageIdRef.current = optimisticAssistantMessageId;
|
|
392
|
+
const optimisticAssistantMessage = {
|
|
393
|
+
__typename: 'Post',
|
|
394
|
+
id: optimisticAssistantMessageId,
|
|
395
|
+
content: '',
|
|
396
|
+
message: '',
|
|
397
|
+
createdAt: new Date().toISOString(),
|
|
398
|
+
updatedAt: new Date().toISOString(),
|
|
399
|
+
author: {
|
|
400
|
+
__typename: 'User',
|
|
401
|
+
id: 'ai-assistant',
|
|
402
|
+
username: 'ai-assistant',
|
|
403
|
+
givenName: 'AI',
|
|
404
|
+
familyName: 'Assistant',
|
|
405
|
+
fullName: 'AI Assistant',
|
|
406
|
+
email: 'ai@assistant.com',
|
|
407
|
+
picture: null,
|
|
408
|
+
alias: [],
|
|
409
|
+
tokens: []
|
|
410
|
+
},
|
|
411
|
+
propsConfiguration: {
|
|
412
|
+
__typename: 'PostPropsConfiguration',
|
|
413
|
+
contents: {
|
|
414
|
+
__typename: 'PostContents',
|
|
415
|
+
role: 'ASSISTANT',
|
|
416
|
+
fragment: {
|
|
417
|
+
isCreatingSandbox: true
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
props: {},
|
|
422
|
+
files: [],
|
|
423
|
+
replies: null,
|
|
424
|
+
channel: null,
|
|
425
|
+
isPinned: false,
|
|
426
|
+
isDelivered: false,
|
|
427
|
+
isRead: false,
|
|
428
|
+
parentId: null,
|
|
429
|
+
fromServer: null,
|
|
430
|
+
type: PostTypeEnum.Aiassistant
|
|
431
|
+
};
|
|
432
|
+
// Update cache optimistically
|
|
433
|
+
const messagesQuery = {
|
|
434
|
+
query: MessagesDocument,
|
|
435
|
+
variables: {
|
|
436
|
+
channelId: actualChannelId.toString(),
|
|
437
|
+
parentId: null,
|
|
438
|
+
limit: 50
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
try {
|
|
442
|
+
const existingData = apolloClient.readQuery(messagesQuery);
|
|
443
|
+
if (existingData?.messages) {
|
|
444
|
+
const oldRows = existingData.messages.data || [];
|
|
445
|
+
let nextRows = previousOptimisticId ? oldRows.filter(m => String(m?.id) !== String(previousOptimisticId)) : [...oldRows];
|
|
446
|
+
if (!nextRows.some(m => String(m?.id) === String(optimisticAssistantMessageId))) {
|
|
447
|
+
nextRows = [...nextRows, optimisticAssistantMessage];
|
|
448
|
+
}
|
|
449
|
+
const prevTotal = existingData.messages.totalCount ?? oldRows.length;
|
|
450
|
+
const newTotal = prevTotal + (nextRows.length - oldRows.length);
|
|
451
|
+
apolloClient.writeQuery({
|
|
452
|
+
...messagesQuery,
|
|
453
|
+
data: {
|
|
454
|
+
messages: {
|
|
455
|
+
...existingData.messages,
|
|
456
|
+
data: nextRows,
|
|
457
|
+
totalCount: Math.max(0, newTotal)
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
} catch (error) {
|
|
463
|
+
// Cache might not exist yet, that's okay
|
|
464
|
+
console.debug('Optimistic update failed (cache might not exist):', error);
|
|
465
|
+
}
|
|
466
|
+
} catch (error) {
|
|
467
|
+
console.error('Failed to create optimistic update:', error);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
// Safety auto-stop in case no event arrives
|
|
471
|
+
// successThinkingTimeoutRef.current = setTimeout(() => {
|
|
472
|
+
// setIsSuccessThinking(false);
|
|
473
|
+
// successThinkingTimeoutRef.current = null;
|
|
474
|
+
// }, 15000);
|
|
475
|
+
// If no channelId, mirror AiLandingInput: create channel+project, seed first post, then navigate
|
|
476
|
+
try {
|
|
477
|
+
// const postId = objectId();
|
|
478
|
+
// Do not include extensionId inside modelConfig when sending additionalProperties
|
|
479
|
+
await createChannelWorkflowJob({
|
|
480
|
+
variables: {
|
|
481
|
+
createChannelInput: createChannelInput,
|
|
482
|
+
extensionInput: {
|
|
483
|
+
// prefer saved extensionId from modelConfig; otherwise env default
|
|
484
|
+
extensionId: modelConfig?.extensionId,
|
|
485
|
+
stepName: modelConfig?.stepName || 'extractCodeFromExtension',
|
|
486
|
+
formId: modelConfig?.formId || 'form-builder-proxy',
|
|
487
|
+
functionId: modelConfig?.functionId || 'create-channel-function',
|
|
488
|
+
metadata: modelConfig?.metadata || {},
|
|
489
|
+
source: 'final-submission'
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
onCompleted: data => {
|
|
493
|
+
// if (!data?.createChannelWorkflowJob) {
|
|
494
|
+
// setIsSuccessThinking(false);
|
|
495
|
+
// setIsLoading(false);
|
|
496
|
+
// return;
|
|
497
|
+
// }
|
|
498
|
+
// setIsSuccessThinking(false);
|
|
499
|
+
// setIsLoading(false);
|
|
500
|
+
},
|
|
501
|
+
onError: error => {
|
|
502
|
+
console.error('Error creating channel:', error);
|
|
503
|
+
setIsSuccessThinking(false);
|
|
504
|
+
setIsLoading(false);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
} catch (err) {
|
|
508
|
+
console.error('Failed to create new AI project/channel from AIAgent:', err);
|
|
509
|
+
setIsSuccessThinking(false);
|
|
510
|
+
setIsLoading(false);
|
|
511
|
+
}
|
|
512
|
+
}, [actualChannelId, postId, auth, startUpload, sendMsg, scrollToBottom, getValidatedConfig, hasApiKey, modelConfig, navigate, createChannelWorkflowJob, sendMessageInput, apolloClient, isShowOnlyInbox]);
|
|
513
|
+
const fixError = useCallback(errorMessage => {
|
|
514
|
+
// Use sendMessage to fix the error, which will use createProject flow
|
|
515
|
+
return handleSend(errorMessage);
|
|
516
|
+
}, [handleSend]);
|
|
517
|
+
const handleStop = useCallback(() => {
|
|
518
|
+
// Stop the current operation
|
|
519
|
+
console.log('Stop button clicked - stopping current operation');
|
|
520
|
+
// Call the onStop prop if provided
|
|
521
|
+
onStop?.();
|
|
522
|
+
}, [setIsLoading, onStop]);
|
|
523
|
+
const handleRetry = useCallback(() => {
|
|
524
|
+
send({
|
|
525
|
+
type: 'RETRY'
|
|
526
|
+
});
|
|
527
|
+
}, [send]);
|
|
528
|
+
const handleClearError = useCallback(() => {
|
|
529
|
+
send({
|
|
530
|
+
type: 'CLEAR_ERROR'
|
|
531
|
+
});
|
|
532
|
+
}, [send]);
|
|
533
|
+
// Use only default/regular messages and ignore AI messages — preserve type (THINKING, TOOLUSE, CODEBLOCK, etc.) for ModernMessageGroup slots
|
|
534
|
+
const allMessages = useMemo(() => {
|
|
535
|
+
if (!regularMessages) return [];
|
|
536
|
+
const mapped = (regularMessages || []).map((m, idx) => ({
|
|
537
|
+
id: m.id || `regular-${idx}`,
|
|
538
|
+
message: m.message || m.content || '',
|
|
539
|
+
createdAt: new Date(m.createdAt || Date.now()),
|
|
540
|
+
type: m.type,
|
|
541
|
+
propsConfiguration: m.propsConfiguration,
|
|
542
|
+
props: m.props,
|
|
543
|
+
files: m.files,
|
|
544
|
+
sender: 'user',
|
|
545
|
+
author: m.author,
|
|
546
|
+
isUserMessage: true
|
|
547
|
+
}));
|
|
548
|
+
// Check if we have a completed AIASSISTANT (final response) — if so, hide THINKING
|
|
549
|
+
const hasCompletedResponse = mapped.some(m => {
|
|
550
|
+
const t = m.type;
|
|
551
|
+
const frag = m?.props?.fragment ?? m?.propsConfiguration?.contents?.fragment;
|
|
552
|
+
return (t === 'AIASSISTANT' || t === 'ASSISTANT') && frag && (frag.sandboxUrl || frag.files);
|
|
553
|
+
});
|
|
554
|
+
return mapped.filter(m => {
|
|
555
|
+
if (m.type !== 'THINKING') return true;
|
|
556
|
+
// Hide THINKING when: dismissed in payload, or when we have a completed response
|
|
557
|
+
const att = m?.props?.attachment ?? m?.propsConfiguration?.contents?.attachment;
|
|
558
|
+
if (att == null) return false;
|
|
559
|
+
if (att.dismissed === true) return false;
|
|
560
|
+
if (att.isThinking === false && !String(att.thought || '').trim()) return false;
|
|
561
|
+
if (hasCompletedResponse) return false; // Final response exists — hide lingering THINKING
|
|
562
|
+
return true;
|
|
563
|
+
});
|
|
564
|
+
}, [regularMessages, currentUser]);
|
|
565
|
+
// Derive sandbox-style errors from message fragments so we can show the Fix Error UI
|
|
566
|
+
// Returns unique errors globally (deduplicated by error message/content)
|
|
567
|
+
// Map errors to their respective messages (messageId -> errors[])
|
|
568
|
+
const errorsByMessageId = useMemo(() => {
|
|
569
|
+
if (!regularMessages || regularMessages.length === 0) return new Map();
|
|
570
|
+
const errorsMap = new Map();
|
|
571
|
+
// Collect errors from all messages and map them to message IDs
|
|
572
|
+
(regularMessages || []).forEach(m => {
|
|
573
|
+
const fragment = m?.propsConfiguration?.contents?.fragment;
|
|
574
|
+
if (!fragment) return;
|
|
575
|
+
const isErrorFragment = fragment?.isError === true || fragment?.type === 'ERROR';
|
|
576
|
+
if (!isErrorFragment) return;
|
|
577
|
+
const errorId = fragment.id || m.id || objectId();
|
|
578
|
+
const messageId = m.id || 'unknown';
|
|
579
|
+
const errorMessage = fragment.errorMessage || fragment.summary || m.message || m.content || 'An error occurred in the AI sandbox.';
|
|
580
|
+
const error = {
|
|
581
|
+
id: errorId,
|
|
582
|
+
messageId: messageId,
|
|
583
|
+
errorType: fragment.errorType || 'RUNTIME_ERROR',
|
|
584
|
+
timestamp: fragment.timestamp || m.createdAt || new Date().toISOString(),
|
|
585
|
+
sandboxId: fragment.sandboxId || fragment.projectId || actualChannelId || 'unknown-sandbox',
|
|
586
|
+
message: errorMessage,
|
|
587
|
+
stack: fragment.stack || '',
|
|
588
|
+
url: fragment.sandboxUrl || fragment.url,
|
|
589
|
+
fixable: fragment.fixable !== false
|
|
590
|
+
};
|
|
591
|
+
// Add error to the message's error list
|
|
592
|
+
if (!errorsMap.has(messageId)) {
|
|
593
|
+
errorsMap.set(messageId, []);
|
|
594
|
+
}
|
|
595
|
+
errorsMap.get(messageId).push(error);
|
|
596
|
+
});
|
|
597
|
+
return errorsMap;
|
|
598
|
+
}, [regularMessages, actualChannelId]);
|
|
599
|
+
// Build list with date separators similar to MessagesBuilderUi
|
|
600
|
+
const messageListWithDates = useMemo(() => {
|
|
601
|
+
let currentDate = '';
|
|
602
|
+
const res = [];
|
|
603
|
+
if (showDateSeparators) {
|
|
604
|
+
allMessages?.forEach(msg => {
|
|
605
|
+
const date = new Date(msg.createdAt);
|
|
606
|
+
let msgDate;
|
|
607
|
+
if (isToday(date)) msgDate = t('tailwind_ui_inbox.today');else if (isYesterday(date)) msgDate = t('tailwind_ui_inbox.yesterday');else msgDate = format(date, 'eee, do MMMM');
|
|
608
|
+
if (msgDate !== currentDate) {
|
|
609
|
+
res.push({
|
|
610
|
+
type: 'date',
|
|
611
|
+
content: msgDate
|
|
612
|
+
});
|
|
613
|
+
currentDate = msgDate;
|
|
614
|
+
}
|
|
615
|
+
res.push(msg);
|
|
616
|
+
});
|
|
617
|
+
if (allMessages && allMessages.length > 0) {
|
|
618
|
+
const todayLabel = t('tailwind_ui_inbox.today');
|
|
619
|
+
if (currentDate !== todayLabel) {
|
|
620
|
+
res.push({
|
|
621
|
+
type: 'date',
|
|
622
|
+
content: todayLabel
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
} else {
|
|
627
|
+
// No date separaters, keep messages as-is
|
|
628
|
+
allMessages?.forEach(msg => res.push(msg));
|
|
629
|
+
}
|
|
630
|
+
return res;
|
|
631
|
+
}, [allMessages, t, showDateSeparators]);
|
|
632
|
+
// Group messages by date sections for Slack-like rendering
|
|
633
|
+
const messagesByDate = useMemo(() => {
|
|
634
|
+
const sections = [];
|
|
635
|
+
let currentSection = {
|
|
636
|
+
date: null,
|
|
637
|
+
messages: []
|
|
638
|
+
};
|
|
639
|
+
messageListWithDates.forEach(item => {
|
|
640
|
+
if (item?.type === 'date') {
|
|
641
|
+
if (currentSection.messages.length > 0) {
|
|
642
|
+
sections.push(currentSection);
|
|
643
|
+
}
|
|
644
|
+
currentSection = {
|
|
645
|
+
date: item.content,
|
|
646
|
+
messages: []
|
|
647
|
+
};
|
|
648
|
+
} else {
|
|
649
|
+
currentSection.messages.push(item);
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
if (currentSection.messages.length > 0) {
|
|
653
|
+
sections.push(currentSection);
|
|
654
|
+
}
|
|
655
|
+
return sections;
|
|
656
|
+
}, [messageListWithDates]);
|
|
657
|
+
// Show all messages without limiting
|
|
658
|
+
const limitedMessagesByDate = useMemo(() => {
|
|
659
|
+
if (!messagesByDate || messagesByDate.length === 0) return [];
|
|
660
|
+
return messagesByDate;
|
|
661
|
+
}, [messagesByDate]);
|
|
662
|
+
// Ensure we show complete conversation pairs (user message + AI response)
|
|
663
|
+
const completeConversationMessages = useMemo(() => {
|
|
664
|
+
if (!limitedMessagesByDate || limitedMessagesByDate.length === 0) return [];
|
|
665
|
+
const completeSections = [];
|
|
666
|
+
limitedMessagesByDate.forEach(section => {
|
|
667
|
+
const completeMessages = [];
|
|
668
|
+
const sectionMessages = [...section.messages];
|
|
669
|
+
console.log('🔄 Processing section for complete conversations:', {
|
|
670
|
+
sectionDate: section.date,
|
|
671
|
+
totalMessages: sectionMessages.length,
|
|
672
|
+
messages: sectionMessages.map(m => ({
|
|
673
|
+
sender: m.sender,
|
|
674
|
+
isUserMessage: m.isUserMessage,
|
|
675
|
+
message: m.message?.substring(0, 30) + '...'
|
|
676
|
+
}))
|
|
677
|
+
});
|
|
678
|
+
// Group messages into conversation pairs
|
|
679
|
+
for (let i = 0; i < sectionMessages.length; i++) {
|
|
680
|
+
const currentMsg = sectionMessages[i];
|
|
681
|
+
// If this is a user message, look for its AI response
|
|
682
|
+
if (currentMsg.sender === 'user' || currentMsg.isUserMessage) {
|
|
683
|
+
completeMessages.push(currentMsg);
|
|
684
|
+
// Look for the corresponding AI response (next message should be AI)
|
|
685
|
+
if (i + 1 < sectionMessages.length) {
|
|
686
|
+
const nextMsg = sectionMessages[i + 1];
|
|
687
|
+
if (nextMsg.sender === 'ai' || !nextMsg.isUserMessage) {
|
|
688
|
+
completeMessages.push(nextMsg);
|
|
689
|
+
i++; // Skip the next message since we've already added it
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
} else if (currentMsg.sender === 'ai' || !currentMsg.isUserMessage) {
|
|
693
|
+
// If this is an AI message without a preceding user message, still show it
|
|
694
|
+
completeMessages.push(currentMsg);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
console.log('🔄 Complete messages for section:', {
|
|
698
|
+
sectionDate: section.date,
|
|
699
|
+
completeMessages: completeMessages.map(m => ({
|
|
700
|
+
sender: m.sender,
|
|
701
|
+
isUserMessage: m.isUserMessage,
|
|
702
|
+
message: m.message?.substring(0, 30) + '...'
|
|
703
|
+
}))
|
|
704
|
+
});
|
|
705
|
+
if (completeMessages.length > 0) {
|
|
706
|
+
completeSections.push({
|
|
707
|
+
...section,
|
|
708
|
+
messages: completeMessages
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
return completeSections;
|
|
713
|
+
}, [limitedMessagesByDate]);
|
|
714
|
+
// Auto scroll to bottom when messages, typing status, or AI responses change
|
|
715
|
+
useEffect(() => {
|
|
716
|
+
// scrollToBottom('smooth', 100);
|
|
717
|
+
}, [completeConversationMessages?.length, isTyping, aiMessages.length, scrollToBottom]);
|
|
718
|
+
// Cleanup any pending timeout / scroll on unmount
|
|
719
|
+
useEffect(() => {
|
|
720
|
+
return () => {
|
|
721
|
+
if (successThinkingTimeoutRef.current) {
|
|
722
|
+
clearTimeout(successThinkingTimeoutRef.current);
|
|
723
|
+
}
|
|
724
|
+
if (scrollPendingRef.current) {
|
|
725
|
+
clearTimeout(scrollPendingRef.current);
|
|
726
|
+
scrollPendingRef.current = null;
|
|
727
|
+
}
|
|
728
|
+
if (streamScrollRafRef.current != null) {
|
|
729
|
+
cancelAnimationFrame(streamScrollRafRef.current);
|
|
730
|
+
streamScrollRafRef.current = null;
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
}, []);
|
|
734
|
+
const extractCleanContent = useCallback(summary => {
|
|
735
|
+
// console.log('summary...........', summary);
|
|
736
|
+
if (!summary) return 'Project generated successfully!';
|
|
737
|
+
const summeryData = summary.replace(/<canvas_layers>[\s\S]*?<\/canvas_layers>/g, '').replace(/<task_summary>([\s\S]*?)<\/task_summary>/g, '');
|
|
738
|
+
if (summeryData && summeryData.trim() !== '' && summeryData.trim()?.length > 0) {
|
|
739
|
+
return summeryData || 'Project generated successfully!';
|
|
740
|
+
}
|
|
741
|
+
// Extract content from <task_summary> tags
|
|
742
|
+
const taskSummaryMatch = summary.match(/<task_summary>([\s\S]*?)<\/task_summary>/);
|
|
743
|
+
if (taskSummaryMatch) {
|
|
744
|
+
// const removedCanvasLayers = summary.replace(/<canvas_layers>[\s\S]*?<\/canvas_layers>/g, '').replace(/<task_summary>([\s\S]*?)<\/task_summary>/g, '');
|
|
745
|
+
return taskSummaryMatch?.[1]?.trim() ?? 'Project generated successfully!';
|
|
746
|
+
}
|
|
747
|
+
// If no task_summary tags, remove canvas_layers and return the rest
|
|
748
|
+
const withoutCanvasLayers = summary.replace(/<canvas_layers>[\s\S]*?<\/canvas_layers>/g, '').trim();
|
|
749
|
+
return withoutCanvasLayers || 'Project generated successfully!';
|
|
750
|
+
}, []);
|
|
751
|
+
return React__default.createElement("div", {
|
|
752
|
+
className: `flex flex-col h-full ${className}`
|
|
753
|
+
}, !isShowOnlyInbox && React__default.createElement("div", {
|
|
754
|
+
className: "border-b border-gray-200 bg-white"
|
|
755
|
+
}, React__default.createElement("div", {
|
|
756
|
+
className: "flex items-center justify-between px-4 py-3"
|
|
757
|
+
}, React__default.createElement("div", {
|
|
758
|
+
className: "flex space-x-6"
|
|
759
|
+
}, React__default.createElement("button", {
|
|
760
|
+
onClick: () => setActiveTab('chat'),
|
|
761
|
+
className: `relative ${activeTab === 'chat' ? 'text-blue-600 font-medium' : 'text-gray-500 hover:text-gray-700'} text-sm transition-colors`
|
|
762
|
+
}, React__default.createElement("span", null, "Chat"), activeTab === 'chat' && React__default.createElement("div", {
|
|
763
|
+
className: "absolute bottom-0 left-0 w-full h-0.5 bg-blue-600"
|
|
764
|
+
})), React__default.createElement("button", {
|
|
765
|
+
onClick: () => setActiveTab('history'),
|
|
766
|
+
className: `relative ${activeTab === 'history' ? 'text-blue-600 font-medium' : 'text-gray-500 hover:text-gray-700'} text-sm transition-colors`
|
|
767
|
+
}, React__default.createElement("span", null, "History"), activeTab === 'history' && React__default.createElement("div", {
|
|
768
|
+
className: "absolute bottom-0 left-0 w-full h-0.5 bg-blue-600"
|
|
769
|
+
}))))), activeTab === 'history' ? (/* History Tab Content */
|
|
770
|
+
React__default.createElement("div", {
|
|
771
|
+
className: "flex-1 overflow-y-auto bg-white"
|
|
772
|
+
}, React__default.createElement("div", {
|
|
773
|
+
className: "px-4 py-3 border-b border-gray-200"
|
|
774
|
+
}, React__default.createElement("div", {
|
|
775
|
+
className: "relative"
|
|
776
|
+
}, React__default.createElement("div", {
|
|
777
|
+
className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"
|
|
778
|
+
}, React__default.createElement("svg", {
|
|
779
|
+
className: "h-5 w-5 text-gray-400",
|
|
780
|
+
fill: "none",
|
|
781
|
+
viewBox: "0 0 24 24",
|
|
782
|
+
stroke: "currentColor"
|
|
783
|
+
}, React__default.createElement("path", {
|
|
784
|
+
strokeLinecap: "round",
|
|
785
|
+
strokeLinejoin: "round",
|
|
786
|
+
strokeWidth: 2,
|
|
787
|
+
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
788
|
+
}))), React__default.createElement("input", {
|
|
789
|
+
type: "text",
|
|
790
|
+
placeholder: "Search messages...",
|
|
791
|
+
className: "block w-full pl-10 pr-12 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-sm"
|
|
792
|
+
}), React__default.createElement("div", {
|
|
793
|
+
className: "absolute inset-y-0 right-0 pr-3 flex items-center"
|
|
794
|
+
}, React__default.createElement("button", {
|
|
795
|
+
className: "text-gray-400 hover:text-gray-600"
|
|
796
|
+
}, React__default.createElement("svg", {
|
|
797
|
+
className: "h-5 w-5",
|
|
798
|
+
fill: "none",
|
|
799
|
+
viewBox: "0 0 24 24",
|
|
800
|
+
stroke: "currentColor"
|
|
801
|
+
}, React__default.createElement("path", {
|
|
802
|
+
strokeLinecap: "round",
|
|
803
|
+
strokeLinejoin: "round",
|
|
804
|
+
strokeWidth: 2,
|
|
805
|
+
d: "M5 5a2 2 0 012-2h10a2 2 0 012 2v16l-7-3.5L5 21V5z"
|
|
806
|
+
})))))), React__default.createElement("div", {
|
|
807
|
+
className: "px-4 py-2"
|
|
808
|
+
}, regularMessages && regularMessages.length > 0 ? regularMessages.filter(msg => msg?.propsConfiguration?.contents?.role === 'USER').map((msg, index) => {
|
|
809
|
+
new Date(msg.createdAt);
|
|
810
|
+
return React__default.createElement("div", {
|
|
811
|
+
key: msg.id || index,
|
|
812
|
+
className: "mb-4"
|
|
813
|
+
}, React__default.createElement("div", {
|
|
814
|
+
className: "flex items-center justify-end mb-2"
|
|
815
|
+
}), React__default.createElement(ModernMessageGroupComponent, {
|
|
816
|
+
messages: [{
|
|
817
|
+
id: msg.id,
|
|
818
|
+
message: msg?.propsConfiguration?.contents?.role === 'ASSISTANT' ? msg.propsConfiguration?.contents?.fragment?.summary ? extractCleanContent(msg.propsConfiguration?.contents?.fragment?.summary) : msg.message : msg.message,
|
|
819
|
+
author: msg.author || {
|
|
820
|
+
id: 'user',
|
|
821
|
+
givenName: 'User',
|
|
822
|
+
familyName: '',
|
|
823
|
+
fullName: 'User',
|
|
824
|
+
username: 'user',
|
|
825
|
+
email: '',
|
|
826
|
+
picture: null,
|
|
827
|
+
alias: [],
|
|
828
|
+
tokens: []
|
|
829
|
+
},
|
|
830
|
+
createdAt: msg.createdAt,
|
|
831
|
+
type: msg?.type || PostTypeEnum.Aiassistant,
|
|
832
|
+
isDelivered: false,
|
|
833
|
+
isRead: false,
|
|
834
|
+
parentId: null,
|
|
835
|
+
fromServer: null,
|
|
836
|
+
updatedAt: msg.createdAt,
|
|
837
|
+
propsConfiguration: {
|
|
838
|
+
...msg?.propsConfiguration,
|
|
839
|
+
contents: {
|
|
840
|
+
...msg?.propsConfiguration?.contents,
|
|
841
|
+
attachment: msg?.props?.attachment ?? msg?.propsConfiguration?.contents?.attachment
|
|
842
|
+
}
|
|
843
|
+
},
|
|
844
|
+
props: msg?.props,
|
|
845
|
+
files: msg.files,
|
|
846
|
+
replies: null,
|
|
847
|
+
channel: null,
|
|
848
|
+
isPinned: false
|
|
849
|
+
}],
|
|
850
|
+
currentUser: currentUser,
|
|
851
|
+
onOpen: onOpen,
|
|
852
|
+
onMessageClick: msg => setSelectedPost(msg),
|
|
853
|
+
isDesktopView: isDesktopView,
|
|
854
|
+
isSmallScreen: isSmallScreen,
|
|
855
|
+
showAuthorName: true,
|
|
856
|
+
showAvatar: true
|
|
857
|
+
}));
|
|
858
|
+
}) :
|
|
859
|
+
// Fallback entries when no messages
|
|
860
|
+
React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
861
|
+
className: "mb-4"
|
|
862
|
+
}, React__default.createElement("div", {
|
|
863
|
+
className: "flex items-center justify-end mb-2"
|
|
864
|
+
}, React__default.createElement("button", {
|
|
865
|
+
className: "text-blue-600 text-sm underline hover:text-blue-800 flex items-center"
|
|
866
|
+
}, React__default.createElement("svg", {
|
|
867
|
+
className: "w-4 h-4 mr-1",
|
|
868
|
+
fill: "none",
|
|
869
|
+
viewBox: "0 0 24 24",
|
|
870
|
+
stroke: "currentColor"
|
|
871
|
+
}, React__default.createElement("path", {
|
|
872
|
+
strokeLinecap: "round",
|
|
873
|
+
strokeLinejoin: "round",
|
|
874
|
+
strokeWidth: 2,
|
|
875
|
+
d: "M15 19l-7-7 7-7"
|
|
876
|
+
})), "Restore to this point")), React__default.createElement("div", {
|
|
877
|
+
className: "bg-gray-100 rounded-lg p-3"
|
|
878
|
+
}, React__default.createElement("p", {
|
|
879
|
+
className: "text-sm text-gray-900"
|
|
880
|
+
}, "Sample message for demonstration"))))))) : (/* Chat Tab Content */
|
|
881
|
+
React__default.createElement("div", {
|
|
882
|
+
className: "flex-1 overflow-y-auto bg-white"
|
|
883
|
+
}, React__default.createElement("div", {
|
|
884
|
+
className: `w-full pb-4 pt-2 ${isDesktopView ? 'space-y-3 max-w-full mx-auto' : isSmallScreen ? 'space-y-2' : 'space-y-2'}`
|
|
885
|
+
}, (!completeConversationMessages || completeConversationMessages.length === 0) && React__default.createElement("div", {
|
|
886
|
+
className: "px-4 py-8 text-center"
|
|
887
|
+
}, React__default.createElement("div", {
|
|
888
|
+
className: "text-gray-500 text-lg font-medium mb-2"
|
|
889
|
+
}, "Describe your idea and I'll help you create it step by step"), React__default.createElement("div", {
|
|
890
|
+
className: "text-gray-400 text-sm"
|
|
891
|
+
}, "Start a new conversation by typing your message below")), completeConversationMessages?.map((section, sectionIndex) => React__default.createElement("div", {
|
|
892
|
+
key: `section-${sectionIndex}`,
|
|
893
|
+
className: "w-full px-4"
|
|
894
|
+
}, showDateSeparators && section.date && React__default.createElement("div", {
|
|
895
|
+
className: "flex items-center justify-center my-3"
|
|
896
|
+
}, React__default.createElement("div", {
|
|
897
|
+
className: "flex-grow border-t border-gray-200"
|
|
898
|
+
}), React__default.createElement("div", {
|
|
899
|
+
className: "mx-4 px-3 py-1 bg-white border border-gray-200 rounded-full text-xs font-medium text-gray-600"
|
|
900
|
+
}, section.date), React__default.createElement("div", {
|
|
901
|
+
className: "flex-grow border-t border-gray-200"
|
|
902
|
+
})), React__default.createElement("div", {
|
|
903
|
+
className: `${isDesktopView ? 'mb-2' : 'mb-1'}`
|
|
904
|
+
}, section.messages.map((msg, msgIndex) => {
|
|
905
|
+
// Get errors for this specific message
|
|
906
|
+
const messageErrors = errorsByMessageId.get(msg.id) || [];
|
|
907
|
+
return React__default.createElement("div", {
|
|
908
|
+
key: msg.id || msgIndex,
|
|
909
|
+
className: "mb-3"
|
|
910
|
+
}, msg.isAIMessage && React__default.createElement("div", {
|
|
911
|
+
className: "flex items-center mb-2"
|
|
912
|
+
}, React__default.createElement("div", {
|
|
913
|
+
className: "w-2 h-2 bg-blue-500 rounded-full mr-2"
|
|
914
|
+
}), React__default.createElement("span", {
|
|
915
|
+
className: "text-xs text-blue-600 font-medium"
|
|
916
|
+
}, "AI Assistant")), msg.isLoading ?
|
|
917
|
+
// Show loader for loading messages
|
|
918
|
+
React__default.createElement("div", {
|
|
919
|
+
className: "flex items-center space-x-2 bg-gray-50 border border-gray-200 px-4 py-3 rounded-lg"
|
|
920
|
+
}, React__default.createElement("div", {
|
|
921
|
+
className: "w-4 h-4 border-2 border-gray-300 border-t-gray-500 rounded-full animate-spin"
|
|
922
|
+
}), React__default.createElement("span", {
|
|
923
|
+
className: "text-sm text-gray-600"
|
|
924
|
+
}, msg.isProcessing ? 'Thinking...' : 'Thinking...')) :
|
|
925
|
+
// Show normal message for non-loading messages
|
|
926
|
+
React__default.createElement(ModernMessageGroupComponent, {
|
|
927
|
+
messages: [{
|
|
928
|
+
id: msg.id,
|
|
929
|
+
message: msg?.propsConfiguration?.contents?.role === 'ASSISTANT' ? msg.propsConfiguration?.contents?.fragment?.summary ? extractCleanContent(msg.propsConfiguration?.contents?.fragment?.summary) : msg.message : msg.message,
|
|
930
|
+
author: msg.sender === 'user' ? msg.author : {
|
|
931
|
+
id: 'ai-assistant',
|
|
932
|
+
givenName: 'AI',
|
|
933
|
+
familyName: 'Assistant',
|
|
934
|
+
fullName: 'AI Assistant',
|
|
935
|
+
username: 'ai-assistant',
|
|
936
|
+
email: 'ai@assistant.com',
|
|
937
|
+
picture: null,
|
|
938
|
+
alias: [],
|
|
939
|
+
tokens: []
|
|
940
|
+
},
|
|
941
|
+
createdAt: msg.createdAt,
|
|
942
|
+
type: msg?.type || PostTypeEnum.Aiassistant,
|
|
943
|
+
isDelivered: false,
|
|
944
|
+
isRead: false,
|
|
945
|
+
parentId: null,
|
|
946
|
+
fromServer: null,
|
|
947
|
+
updatedAt: msg.createdAt,
|
|
948
|
+
propsConfiguration: {
|
|
949
|
+
...msg?.propsConfiguration,
|
|
950
|
+
contents: {
|
|
951
|
+
...msg?.propsConfiguration?.contents,
|
|
952
|
+
attachment: msg?.props?.attachment ?? msg?.propsConfiguration?.contents?.attachment
|
|
953
|
+
}
|
|
954
|
+
},
|
|
955
|
+
props: msg?.props,
|
|
956
|
+
files: msg.files,
|
|
957
|
+
replies: null,
|
|
958
|
+
channel: null,
|
|
959
|
+
isPinned: false
|
|
960
|
+
}],
|
|
961
|
+
currentUser: currentUser,
|
|
962
|
+
onOpen: onOpen,
|
|
963
|
+
onMessageClick: msg => setSelectedPost(msg),
|
|
964
|
+
isDesktopView: isDesktopView,
|
|
965
|
+
isSmallScreen: isSmallScreen,
|
|
966
|
+
showTimestamp: false,
|
|
967
|
+
sandboxErrors: messageErrors,
|
|
968
|
+
currentFiles: currentFiles,
|
|
969
|
+
onFixError: fixError
|
|
970
|
+
}));
|
|
971
|
+
})))), (isTyping || isSuccessThinking || isLoading || isCreatingSandbox) && React__default.createElement("div", {
|
|
972
|
+
className: "px-4"
|
|
973
|
+
}, React__default.createElement("div", {
|
|
974
|
+
className: "flex justify-start"
|
|
975
|
+
}, React__default.createElement("div", {
|
|
976
|
+
className: "bg-gray-50 border border-gray-200 px-4 py-3 rounded-lg"
|
|
977
|
+
}, React__default.createElement("div", {
|
|
978
|
+
className: "flex items-center space-x-2"
|
|
979
|
+
}, React__default.createElement("div", {
|
|
980
|
+
className: "w-4 h-4 border-2 border-gray-300 border-t-gray-500 rounded-full animate-spin"
|
|
981
|
+
}), React__default.createElement("span", {
|
|
982
|
+
className: "text-sm text-gray-600"
|
|
983
|
+
}, "Thinking..."))))), React__default.createElement("div", {
|
|
984
|
+
ref: bottomRef
|
|
985
|
+
})), React__default.createElement(SubscriptionHandler, {
|
|
986
|
+
subscribeToMore: subscribeToMore,
|
|
987
|
+
document: OnChatMessageAddedDocument,
|
|
988
|
+
variables: {
|
|
989
|
+
channelId: actualChannelId?.toString()
|
|
990
|
+
},
|
|
991
|
+
enabled: !!actualChannelId && !!subscribeToMore,
|
|
992
|
+
updateQuery: (prev, {
|
|
993
|
+
subscriptionData
|
|
994
|
+
}) => {
|
|
995
|
+
if (!subscriptionData.data) return prev;
|
|
996
|
+
const newMessage = subscriptionData.data.chatMessageAdded;
|
|
997
|
+
console.log('newMessage...........', newMessage);
|
|
998
|
+
if (!newMessage?.id) return prev;
|
|
999
|
+
const existing = prev?.messages?.data || [];
|
|
1000
|
+
const attachment = newMessage?.props?.attachment ?? newMessage?.propsConfiguration?.contents?.attachment;
|
|
1001
|
+
// Treat as dismiss: explicit dismissed flag, or THINKING with empty/inactive attachment, or THINKING with attachment: null
|
|
1002
|
+
const isDismissed = attachment?.dismissed === true || newMessage?.type === 'THINKING' && (attachment == null || attachment?.isThinking === false && !String(attachment?.thought || '').trim());
|
|
1003
|
+
let newData;
|
|
1004
|
+
let newTotalCount;
|
|
1005
|
+
if (isDismissed) {
|
|
1006
|
+
// Remove THINKING when dismissed
|
|
1007
|
+
newData = existing.filter(m => m.id !== newMessage.id);
|
|
1008
|
+
newTotalCount = Math.max(0, (prev?.messages?.totalCount || 0) - (existing.length - newData.length));
|
|
1009
|
+
} else {
|
|
1010
|
+
const idx = existing.findIndex(m => m.id === newMessage.id);
|
|
1011
|
+
if (idx >= 0) {
|
|
1012
|
+
// Replace existing message (same id)
|
|
1013
|
+
newData = [...existing.slice(0, idx), newMessage, ...existing.slice(idx + 1)];
|
|
1014
|
+
newTotalCount = prev?.messages?.totalCount || 0;
|
|
1015
|
+
} else {
|
|
1016
|
+
newData = [...existing, newMessage];
|
|
1017
|
+
newTotalCount = (prev?.messages?.totalCount || 0) + 1;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
// Preserve server order (posts are persisted in sequence). Dedupe by id only.
|
|
1021
|
+
if (!isDismissed) {
|
|
1022
|
+
const optId = optimisticAssistantMessageIdRef.current;
|
|
1023
|
+
if (optId && newMessage?.id) {
|
|
1024
|
+
if (String(newMessage.id) === String(optId)) {
|
|
1025
|
+
optimisticAssistantMessageIdRef.current = null;
|
|
1026
|
+
} else {
|
|
1027
|
+
const typ = String(newMessage.type || '').toUpperCase();
|
|
1028
|
+
const role = newMessage?.propsConfiguration?.contents?.role;
|
|
1029
|
+
const realAssistantChunk = ['THINKING', 'TOOLUSE', 'CODEBLOCK', 'SERVICE', 'AIASSISTANT', 'ASSISTANT'].includes(typ) || role === 'ASSISTANT';
|
|
1030
|
+
if (realAssistantChunk) {
|
|
1031
|
+
newData = newData.filter(m => String(m?.id) !== String(optId));
|
|
1032
|
+
optimisticAssistantMessageIdRef.current = null;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
newData = uniqBy(newData, 'id');
|
|
1037
|
+
}
|
|
1038
|
+
return {
|
|
1039
|
+
...prev,
|
|
1040
|
+
messages: {
|
|
1041
|
+
...prev?.messages,
|
|
1042
|
+
data: newData,
|
|
1043
|
+
totalCount: newTotalCount
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
},
|
|
1047
|
+
onError: error => {
|
|
1048
|
+
console.error('Subscription error:', error);
|
|
1049
|
+
}
|
|
1050
|
+
}))), error && React__default.createElement("div", {
|
|
1051
|
+
className: "mx-4 mb-4 p-3 bg-red-50 border border-red-200 rounded-lg"
|
|
1052
|
+
}, React__default.createElement("div", {
|
|
1053
|
+
className: "flex items-center justify-between"
|
|
1054
|
+
}, React__default.createElement("div", {
|
|
1055
|
+
className: "text-red-800 text-sm"
|
|
1056
|
+
}, error), React__default.createElement("div", {
|
|
1057
|
+
className: "flex space-x-2"
|
|
1058
|
+
}, React__default.createElement("button", {
|
|
1059
|
+
onClick: handleRetry,
|
|
1060
|
+
className: "px-2 py-1 text-xs bg-red-100 text-red-700 rounded hover:bg-red-200 transition-colors"
|
|
1061
|
+
}, "Retry"), React__default.createElement("button", {
|
|
1062
|
+
onClick: handleClearError,
|
|
1063
|
+
className: "px-2 py-1 text-xs bg-gray-100 text-gray-700 rounded hover:bg-gray-200 transition-colors"
|
|
1064
|
+
}, "Dismiss")))), activeTab === 'chat' && (() => {
|
|
1065
|
+
// Compute final showStopButton value: use prop if provided, otherwise compute from conditions
|
|
1066
|
+
// const finalShowStopButton =
|
|
1067
|
+
// showStopButton !== undefined
|
|
1068
|
+
// ? showStopButton
|
|
1069
|
+
// : !isShowOnlyInbox && (isCreatingSandbox || isLoading || isSuccessThinking);
|
|
1070
|
+
const isShowStopButton = showStopButton && (isCreatingSandbox || isSuccessThinking) ? true : false;
|
|
1071
|
+
return React__default.createElement("div", {
|
|
1072
|
+
className: "border-t border-gray-200 bg-white"
|
|
1073
|
+
}, React__default.createElement(InputComponent, {
|
|
1074
|
+
channelId: actualChannelId,
|
|
1075
|
+
handleSend: handleSend,
|
|
1076
|
+
placeholder: placeholder,
|
|
1077
|
+
modelConfig: modelConfig,
|
|
1078
|
+
onModelConfigChange: updateModelConfig,
|
|
1079
|
+
textareaStyles: isShowOnlyInbox ? {
|
|
1080
|
+
height: '80px',
|
|
1081
|
+
minHeight: '80px',
|
|
1082
|
+
maxHeight: '80px'
|
|
1083
|
+
} : {},
|
|
1084
|
+
showModeSelector: showModeSelector,
|
|
1085
|
+
showStopButton: isShowStopButton,
|
|
1086
|
+
onStop: isShowStopButton ? handleStop : undefined,
|
|
1087
|
+
templates: templates,
|
|
1088
|
+
selectedTemplate: selectedTemplate,
|
|
1089
|
+
suggestedTemplate: suggestedTemplate,
|
|
1090
|
+
onSelectTemplate: onSelectTemplate,
|
|
1091
|
+
templateSelectedLabel: templateSelectedLabel,
|
|
1092
|
+
templateModalItems: templateModalItems,
|
|
1093
|
+
showTemplateModal: showTemplateModal,
|
|
1094
|
+
onOpenTemplateModal: onOpenTemplateModal,
|
|
1095
|
+
onCloseTemplateModal: onCloseTemplateModal,
|
|
1096
|
+
onSelectTemplateById: onSelectTemplateById,
|
|
1097
|
+
onClearTemplate: onClearTemplate,
|
|
1098
|
+
onAcceptSuggestedTemplate: onAcceptSuggestedTemplate,
|
|
1099
|
+
isAnalyzingQuery: isAnalyzingQuery,
|
|
1100
|
+
onQueryChange: onQueryChange,
|
|
1101
|
+
leftItemsOverrides: leftItemsOverrides,
|
|
1102
|
+
rightItemsOverrides: rightItemsOverrides,
|
|
1103
|
+
inputToolBarProps: inputToolBarProps
|
|
1104
|
+
}));
|
|
1105
|
+
})(), isOpen ? React__default.createElement("div", null, React__default.createElement("div", {
|
|
1106
|
+
className: "fixed inset-0 bg-black bg-opacity-50 z-40",
|
|
1107
|
+
onClick: onClose
|
|
1108
|
+
}), React__default.createElement("div", {
|
|
1109
|
+
className: "fixed z-50 left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
|
1110
|
+
}, React__default.createElement("div", {
|
|
1111
|
+
className: "bg-white w-[1036px] h-[700px] rounded-lg shadow-xl",
|
|
1112
|
+
style: {
|
|
1113
|
+
boxShadow: '0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)'
|
|
1114
|
+
}
|
|
1115
|
+
}, React__default.createElement("div", {
|
|
1116
|
+
className: "flex justify-between border-b border-gray-300 pb-4 pt-4"
|
|
1117
|
+
}, React__default.createElement("button", {
|
|
1118
|
+
onClick: onClose,
|
|
1119
|
+
className: "w-8 ml-3 text-black hover:text-black focus:outline-none"
|
|
1120
|
+
}, React__default.createElement("svg", {
|
|
1121
|
+
className: "w-6 h-6",
|
|
1122
|
+
fill: "none",
|
|
1123
|
+
stroke: "currentColor",
|
|
1124
|
+
viewBox: "0 0 24 24"
|
|
1125
|
+
}, React__default.createElement("path", {
|
|
1126
|
+
strokeLinecap: "round",
|
|
1127
|
+
strokeLinejoin: "round",
|
|
1128
|
+
strokeWidth: 2,
|
|
1129
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1130
|
+
})))), React__default.createElement("div", {
|
|
1131
|
+
className: "p-4"
|
|
1132
|
+
}, React__default.createElement("div", {
|
|
1133
|
+
className: "text-sm text-gray-700"
|
|
1134
|
+
}, selectedElement?.author?.username))))) : null);
|
|
1135
|
+
};export{AIAgent};//# sourceMappingURL=AIAgent.js.map
|