@gravity-ui/aikit 0.0.1
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/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/.storybook/theme.d.ts +6 -0
- package/dist/.storybook/theme.js +28 -0
- package/dist/package.json +111 -0
- package/dist/src/components/atoms/ActionButton/ActionButton.d.ts +47 -0
- package/dist/src/components/atoms/ActionButton/ActionButton.js +34 -0
- package/dist/src/components/atoms/ActionButton/__stories__/ActionButton.stories.d.ts +8 -0
- package/dist/src/components/atoms/ActionButton/__stories__/ActionButton.stories.js +48 -0
- package/dist/src/components/atoms/ActionButton/index.d.ts +2 -0
- package/dist/src/components/atoms/ActionButton/index.js +1 -0
- package/dist/src/components/atoms/Alert/__stories__/Alert.stories.d.ts +9 -0
- package/dist/src/components/atoms/Alert/__stories__/Alert.stories.js +56 -0
- package/dist/src/components/atoms/Alert/index.d.ts +13 -0
- package/dist/src/components/atoms/Alert/index.js +25 -0
- package/dist/src/components/atoms/ChatDate/ChatDate.d.ts +19 -0
- package/dist/src/components/atoms/ChatDate/ChatDate.js +24 -0
- package/dist/src/components/atoms/ChatDate/__stories__/ChatDate.stories.d.ts +16 -0
- package/dist/src/components/atoms/ChatDate/__stories__/ChatDate.stories.js +83 -0
- package/dist/src/components/atoms/ChatDate/i18n/en.json +8 -0
- package/dist/src/components/atoms/ChatDate/i18n/index.d.ts +13 -0
- package/dist/src/components/atoms/ChatDate/i18n/index.js +5 -0
- package/dist/src/components/atoms/ChatDate/i18n/ru.json +10 -0
- package/dist/src/components/atoms/ChatDate/index.d.ts +1 -0
- package/dist/src/components/atoms/ChatDate/index.js +1 -0
- package/dist/src/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.d.ts +17 -0
- package/dist/src/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.js +72 -0
- package/dist/src/components/atoms/ContextIndicator/index.d.ts +19 -0
- package/dist/src/components/atoms/ContextIndicator/index.js +16 -0
- package/dist/src/components/atoms/ContextIndicator/utils.d.ts +1 -0
- package/dist/src/components/atoms/ContextIndicator/utils.js +9 -0
- package/dist/src/components/atoms/ContextItem/__stories__/ContextItem.stories.d.ts +6 -0
- package/dist/src/components/atoms/ContextItem/__stories__/ContextItem.stories.js +32 -0
- package/dist/src/components/atoms/ContextItem/index.d.ts +9 -0
- package/dist/src/components/atoms/ContextItem/index.js +8 -0
- package/dist/src/components/atoms/DiffStat/__stories__/DiffStat.stories.d.ts +7 -0
- package/dist/src/components/atoms/DiffStat/__stories__/DiffStat.stories.js +45 -0
- package/dist/src/components/atoms/DiffStat/index.d.ts +8 -0
- package/dist/src/components/atoms/DiffStat/index.js +8 -0
- package/dist/src/components/atoms/Disclaimer/Disclaimer.d.ts +19 -0
- package/dist/src/components/atoms/Disclaimer/Disclaimer.js +15 -0
- package/dist/src/components/atoms/Disclaimer/__stories__/Disclaimer.stories.d.ts +8 -0
- package/dist/src/components/atoms/Disclaimer/__stories__/Disclaimer.stories.js +32 -0
- package/dist/src/components/atoms/Disclaimer/index.d.ts +1 -0
- package/dist/src/components/atoms/Disclaimer/index.js +1 -0
- package/dist/src/components/atoms/InlineCitation/index.d.ts +1 -0
- package/dist/src/components/atoms/InlineCitation/index.js +1 -0
- package/dist/src/components/atoms/Loader/Loader.d.ts +9 -0
- package/dist/src/components/atoms/Loader/Loader.js +11 -0
- package/dist/src/components/atoms/Loader/__stories__/Loader.stories.d.ts +8 -0
- package/dist/src/components/atoms/Loader/__stories__/Loader.stories.js +47 -0
- package/dist/src/components/atoms/Loader/index.d.ts +1 -0
- package/dist/src/components/atoms/Loader/index.js +1 -0
- package/dist/src/components/atoms/MarkdownRenderer/MarkdownRenderer.d.ts +10 -0
- package/dist/src/components/atoms/MarkdownRenderer/MarkdownRenderer.js +24 -0
- package/dist/src/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.d.ts +6 -0
- package/dist/src/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.js +49 -0
- package/dist/src/components/atoms/MarkdownRenderer/index.d.ts +1 -0
- package/dist/src/components/atoms/MarkdownRenderer/index.js +1 -0
- package/dist/src/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.d.ts +6 -0
- package/dist/src/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.js +32 -0
- package/dist/src/components/atoms/MessageBalloon/index.d.ts +7 -0
- package/dist/src/components/atoms/MessageBalloon/index.js +8 -0
- package/dist/src/components/atoms/Shimmer/__stories__/Shimmer.stories.d.ts +5 -0
- package/dist/src/components/atoms/Shimmer/__stories__/Shimmer.stories.js +28 -0
- package/dist/src/components/atoms/Shimmer/index.d.ts +6 -0
- package/dist/src/components/atoms/Shimmer/index.js +8 -0
- package/dist/src/components/atoms/SubmitButton/SubmitButton.d.ts +37 -0
- package/dist/src/components/atoms/SubmitButton/SubmitButton.js +33 -0
- package/dist/src/components/atoms/SubmitButton/__stories__/SubmitButton.stories.d.ts +12 -0
- package/dist/src/components/atoms/SubmitButton/__stories__/SubmitButton.stories.js +95 -0
- package/dist/src/components/atoms/SubmitButton/i18n/en.json +3 -0
- package/dist/src/components/atoms/SubmitButton/i18n/index.d.ts +13 -0
- package/dist/src/components/atoms/SubmitButton/i18n/index.js +5 -0
- package/dist/src/components/atoms/SubmitButton/i18n/ru.json +3 -0
- package/dist/src/components/atoms/SubmitButton/index.d.ts +1 -0
- package/dist/src/components/atoms/SubmitButton/index.js +1 -0
- package/dist/src/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.d.ts +9 -0
- package/dist/src/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.js +34 -0
- package/dist/src/components/atoms/ToolIndicator/index.d.ts +7 -0
- package/dist/src/components/atoms/ToolIndicator/index.js +26 -0
- package/dist/src/components/atoms/index.d.ts +14 -0
- package/dist/src/components/atoms/index.js +15 -0
- package/dist/src/components/index.d.ts +5 -0
- package/dist/src/components/index.js +6 -0
- package/dist/src/components/molecules/BaseMessage/__stories__/BaseMessage.stories.d.ts +8 -0
- package/dist/src/components/molecules/BaseMessage/__stories__/BaseMessage.stories.js +66 -0
- package/dist/src/components/molecules/BaseMessage/i18n/en.json +8 -0
- package/dist/src/components/molecules/BaseMessage/i18n/index.d.ts +13 -0
- package/dist/src/components/molecules/BaseMessage/i18n/index.js +5 -0
- package/dist/src/components/molecules/BaseMessage/i18n/ru.json +8 -0
- package/dist/src/components/molecules/BaseMessage/index.d.ts +11 -0
- package/dist/src/components/molecules/BaseMessage/index.js +48 -0
- package/dist/src/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.d.ts +6 -0
- package/dist/src/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.js +44 -0
- package/dist/src/components/molecules/ButtonGroup/index.d.ts +8 -0
- package/dist/src/components/molecules/ButtonGroup/index.js +8 -0
- package/dist/src/components/molecules/InputContext/index.d.ts +1 -0
- package/dist/src/components/molecules/InputContext/index.js +1 -0
- package/dist/src/components/molecules/PromptInputBody/PromptInputBody.d.ts +39 -0
- package/dist/src/components/molecules/PromptInputBody/PromptInputBody.js +26 -0
- package/dist/src/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.d.ts +11 -0
- package/dist/src/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.js +62 -0
- package/dist/src/components/molecules/PromptInputBody/index.d.ts +1 -0
- package/dist/src/components/molecules/PromptInputBody/index.js +1 -0
- package/dist/src/components/molecules/PromptInputFooter/PromptInputFooter.d.ts +39 -0
- package/dist/src/components/molecules/PromptInputFooter/PromptInputFooter.js +26 -0
- package/dist/src/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.d.ts +11 -0
- package/dist/src/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.js +96 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/en.json +5 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/index.d.ts +13 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/index.js +5 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/ru.json +5 -0
- package/dist/src/components/molecules/PromptInputFooter/index.d.ts +1 -0
- package/dist/src/components/molecules/PromptInputFooter/index.js +1 -0
- package/dist/src/components/molecules/PromptInputHeader/PromptInputHeader.d.ts +39 -0
- package/dist/src/components/molecules/PromptInputHeader/PromptInputHeader.js +28 -0
- package/dist/src/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.d.ts +13 -0
- package/dist/src/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.js +103 -0
- package/dist/src/components/molecules/PromptInputHeader/index.d.ts +1 -0
- package/dist/src/components/molecules/PromptInputHeader/index.js +1 -0
- package/dist/src/components/molecules/PromptInputPanel/PromptInputPanel.d.ts +20 -0
- package/dist/src/components/molecules/PromptInputPanel/PromptInputPanel.js +14 -0
- package/dist/src/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.d.ts +8 -0
- package/dist/src/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.js +38 -0
- package/dist/src/components/molecules/PromptInputPanel/index.d.ts +2 -0
- package/dist/src/components/molecules/PromptInputPanel/index.js +1 -0
- package/dist/src/components/molecules/Suggestions/Suggestions.d.ts +37 -0
- package/dist/src/components/molecules/Suggestions/Suggestions.js +27 -0
- package/dist/src/components/molecules/Suggestions/__stories__/Suggestions.stories.d.ts +19 -0
- package/dist/src/components/molecules/Suggestions/__stories__/Suggestions.stories.js +143 -0
- package/dist/src/components/molecules/Suggestions/index.d.ts +1 -0
- package/dist/src/components/molecules/Suggestions/index.js +1 -0
- package/dist/src/components/molecules/Tabs/Tabs.d.ts +15 -0
- package/dist/src/components/molecules/Tabs/Tabs.js +24 -0
- package/dist/src/components/molecules/Tabs/__stories__/Tabs.stories.d.ts +9 -0
- package/dist/src/components/molecules/Tabs/__stories__/Tabs.stories.js +103 -0
- package/dist/src/components/molecules/Tabs/i18n/en.json +3 -0
- package/dist/src/components/molecules/Tabs/i18n/index.d.ts +13 -0
- package/dist/src/components/molecules/Tabs/i18n/index.js +5 -0
- package/dist/src/components/molecules/Tabs/i18n/ru.json +3 -0
- package/dist/src/components/molecules/Tabs/index.d.ts +1 -0
- package/dist/src/components/molecules/Tabs/index.js +1 -0
- package/dist/src/components/molecules/ToolFooter/__stories__/ToolFooter.stories.d.ts +7 -0
- package/dist/src/components/molecules/ToolFooter/__stories__/ToolFooter.stories.js +58 -0
- package/dist/src/components/molecules/ToolFooter/index.d.ts +3 -0
- package/dist/src/components/molecules/ToolFooter/index.js +10 -0
- package/dist/src/components/molecules/ToolHeader/__stories__/ToolHeader.stories.d.ts +7 -0
- package/dist/src/components/molecules/ToolHeader/__stories__/ToolHeader.stories.js +55 -0
- package/dist/src/components/molecules/ToolHeader/index.d.ts +3 -0
- package/dist/src/components/molecules/ToolHeader/index.js +19 -0
- package/dist/src/components/molecules/index.d.ts +11 -0
- package/dist/src/components/molecules/index.js +12 -0
- package/dist/src/components/organisms/AssistantMessage/AssistantMessage.d.ts +14 -0
- package/dist/src/components/organisms/AssistantMessage/AssistantMessage.js +31 -0
- package/dist/src/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.d.ts +13 -0
- package/dist/src/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.js +151 -0
- package/dist/src/components/organisms/AssistantMessage/defaultMessageTypeRegistry.d.ts +3 -0
- package/dist/src/components/organisms/AssistantMessage/defaultMessageTypeRegistry.js +18 -0
- package/dist/src/components/organisms/AssistantMessage/index.d.ts +1 -0
- package/dist/src/components/organisms/AssistantMessage/index.js +1 -0
- package/dist/src/components/organisms/Header/Header.d.ts +9 -0
- package/dist/src/components/organisms/Header/Header.js +65 -0
- package/dist/src/components/organisms/Header/__stories__/Header.stories.d.ts +13 -0
- package/dist/src/components/organisms/Header/__stories__/Header.stories.js +130 -0
- package/dist/src/components/organisms/Header/i18n/en.json +7 -0
- package/dist/src/components/organisms/Header/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/Header/i18n/index.js +5 -0
- package/dist/src/components/organisms/Header/i18n/ru.json +7 -0
- package/dist/src/components/organisms/Header/index.d.ts +4 -0
- package/dist/src/components/organisms/Header/index.js +6 -0
- package/dist/src/components/organisms/Header/types.d.ts +23 -0
- package/dist/src/components/organisms/Header/types.js +7 -0
- package/dist/src/components/organisms/Header/useHeader.d.ts +21 -0
- package/dist/src/components/organisms/Header/useHeader.js +71 -0
- package/dist/src/components/organisms/MessageList/ErrorAlert.d.ts +6 -0
- package/dist/src/components/organisms/MessageList/ErrorAlert.js +15 -0
- package/dist/src/components/organisms/MessageList/MessageList.d.ts +20 -0
- package/dist/src/components/organisms/MessageList/MessageList.js +21 -0
- package/dist/src/components/organisms/MessageList/__stories__/MessageList.stories.d.ts +22 -0
- package/dist/src/components/organisms/MessageList/__stories__/MessageList.stories.js +168 -0
- package/dist/src/components/organisms/MessageList/i18n/en.json +4 -0
- package/dist/src/components/organisms/MessageList/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/MessageList/i18n/index.js +5 -0
- package/dist/src/components/organisms/MessageList/i18n/ru.json +4 -0
- package/dist/src/components/organisms/MessageList/index.d.ts +1 -0
- package/dist/src/components/organisms/MessageList/index.js +1 -0
- package/dist/src/components/organisms/PromptInput/PromptInput.d.ts +44 -0
- package/dist/src/components/organisms/PromptInput/PromptInput.js +38 -0
- package/dist/src/components/organisms/PromptInput/PromptInputFull.d.ts +26 -0
- package/dist/src/components/organisms/PromptInput/PromptInputFull.js +25 -0
- package/dist/src/components/organisms/PromptInput/PromptInputSimple.d.ts +24 -0
- package/dist/src/components/organisms/PromptInput/PromptInputSimple.js +21 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithPanels.d.ts +24 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithPanels.js +19 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithSuggestions.d.ts +22 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithSuggestions.js +16 -0
- package/dist/src/components/organisms/PromptInput/__stories__/PromptInput.stories.d.ts +18 -0
- package/dist/src/components/organisms/PromptInput/__stories__/PromptInput.stories.js +278 -0
- package/dist/src/components/organisms/PromptInput/index.d.ts +8 -0
- package/dist/src/components/organisms/PromptInput/index.js +7 -0
- package/dist/src/components/organisms/PromptInput/types.d.ts +72 -0
- package/dist/src/components/organisms/PromptInput/types.js +1 -0
- package/dist/src/components/organisms/PromptInput/useDelayedUnmount.d.ts +8 -0
- package/dist/src/components/organisms/PromptInput/useDelayedUnmount.js +26 -0
- package/dist/src/components/organisms/PromptInput/usePromptInput.d.ts +52 -0
- package/dist/src/components/organisms/PromptInput/usePromptInput.js +102 -0
- package/dist/src/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.d.ts +12 -0
- package/dist/src/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.js +107 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/en.json +4 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/index.js +5 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/ru.json +4 -0
- package/dist/src/components/organisms/ThinkingMessage/index.d.ts +24 -0
- package/dist/src/components/organisms/ThinkingMessage/index.js +34 -0
- package/dist/src/components/organisms/ThinkingMessage/useThinkingMessage.d.ts +18 -0
- package/dist/src/components/organisms/ThinkingMessage/useThinkingMessage.js +23 -0
- package/dist/src/components/organisms/ToolMessage/__stories__/ToolMessage.stories.d.ts +11 -0
- package/dist/src/components/organisms/ToolMessage/__stories__/ToolMessage.stories.js +70 -0
- package/dist/src/components/organisms/ToolMessage/i18n/en.json +9 -0
- package/dist/src/components/organisms/ToolMessage/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/ToolMessage/i18n/index.js +5 -0
- package/dist/src/components/organisms/ToolMessage/i18n/ru.json +9 -0
- package/dist/src/components/organisms/ToolMessage/index.d.ts +3 -0
- package/dist/src/components/organisms/ToolMessage/index.js +12 -0
- package/dist/src/components/organisms/UserMessage/__stories__/UserMessage.stories.d.ts +7 -0
- package/dist/src/components/organisms/UserMessage/__stories__/UserMessage.stories.js +70 -0
- package/dist/src/components/organisms/UserMessage/index.d.ts +13 -0
- package/dist/src/components/organisms/UserMessage/index.js +12 -0
- package/dist/src/components/organisms/index.d.ts +7 -0
- package/dist/src/components/organisms/index.js +8 -0
- package/dist/src/components/pages/ChatContainer/ChatContainer.d.ts +10 -0
- package/dist/src/components/pages/ChatContainer/ChatContainer.js +110 -0
- package/dist/src/components/pages/ChatContainer/__stories__/ChatContainer.stories.d.ts +53 -0
- package/dist/src/components/pages/ChatContainer/__stories__/ChatContainer.stories.js +707 -0
- package/dist/src/components/pages/ChatContainer/i18n/en.json +10 -0
- package/dist/src/components/pages/ChatContainer/i18n/index.d.ts +13 -0
- package/dist/src/components/pages/ChatContainer/i18n/index.js +5 -0
- package/dist/src/components/pages/ChatContainer/i18n/ru.json +10 -0
- package/dist/src/components/pages/ChatContainer/index.d.ts +2 -0
- package/dist/src/components/pages/ChatContainer/index.js +1 -0
- package/dist/src/components/pages/ChatContainer/types.d.ts +143 -0
- package/dist/src/components/pages/ChatContainer/types.js +1 -0
- package/dist/src/components/pages/ChatContainer/useChatContainer.d.ts +20 -0
- package/dist/src/components/pages/ChatContainer/useChatContainer.js +77 -0
- package/dist/src/components/pages/index.d.ts +1 -0
- package/dist/src/components/pages/index.js +2 -0
- package/dist/src/components/templates/ChatContent/ChatContent.d.ts +29 -0
- package/dist/src/components/templates/ChatContent/ChatContent.js +19 -0
- package/dist/src/components/templates/ChatContent/__stories__/ChatContent.stories.d.ts +14 -0
- package/dist/src/components/templates/ChatContent/__stories__/ChatContent.stories.js +315 -0
- package/dist/src/components/templates/ChatContent/index.d.ts +1 -0
- package/dist/src/components/templates/ChatContent/index.js +1 -0
- package/dist/src/components/templates/EmptyContainer/EmptyContainer.d.ts +57 -0
- package/dist/src/components/templates/EmptyContainer/EmptyContainer.js +26 -0
- package/dist/src/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.d.ts +20 -0
- package/dist/src/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.js +250 -0
- package/dist/src/components/templates/EmptyContainer/i18n/en.json +3 -0
- package/dist/src/components/templates/EmptyContainer/i18n/index.d.ts +13 -0
- package/dist/src/components/templates/EmptyContainer/i18n/index.js +5 -0
- package/dist/src/components/templates/EmptyContainer/i18n/ru.json +3 -0
- package/dist/src/components/templates/EmptyContainer/index.d.ts +1 -0
- package/dist/src/components/templates/EmptyContainer/index.js +1 -0
- package/dist/src/components/templates/History/ChatItem.d.ts +17 -0
- package/dist/src/components/templates/History/ChatItem.js +18 -0
- package/dist/src/components/templates/History/DateHeaderItem.d.ts +12 -0
- package/dist/src/components/templates/History/DateHeaderItem.js +12 -0
- package/dist/src/components/templates/History/History.d.ts +46 -0
- package/dist/src/components/templates/History/History.js +16 -0
- package/dist/src/components/templates/History/HistoryList.d.ts +43 -0
- package/dist/src/components/templates/History/HistoryList.js +87 -0
- package/dist/src/components/templates/History/__stories__/History.stories.d.ts +17 -0
- package/dist/src/components/templates/History/__stories__/History.stories.js +281 -0
- package/dist/src/components/templates/History/i18n/en.json +7 -0
- package/dist/src/components/templates/History/i18n/index.d.ts +13 -0
- package/dist/src/components/templates/History/i18n/index.js +5 -0
- package/dist/src/components/templates/History/i18n/ru.json +7 -0
- package/dist/src/components/templates/History/index.d.ts +8 -0
- package/dist/src/components/templates/History/index.js +4 -0
- package/dist/src/components/templates/index.d.ts +3 -0
- package/dist/src/components/templates/index.js +4 -0
- package/dist/src/constants/index.d.ts +1 -0
- package/dist/src/constants/index.js +1 -0
- package/dist/src/demo/ContentWrapper/ContentWrapper.d.ts +7 -0
- package/dist/src/demo/ContentWrapper/ContentWrapper.js +7 -0
- package/dist/src/demo/ContentWrapper/index.d.ts +1 -0
- package/dist/src/demo/ContentWrapper/index.js +1 -0
- package/dist/src/demo/DocsDecorator/DocsDecorator.d.ts +6 -0
- package/dist/src/demo/DocsDecorator/DocsDecorator.js +12 -0
- package/dist/src/demo/DocsDecorator/ThemeContext.d.ts +2 -0
- package/dist/src/demo/DocsDecorator/ThemeContext.js +2 -0
- package/dist/src/demo/Showcase/Showcase.d.ts +9 -0
- package/dist/src/demo/Showcase/Showcase.js +7 -0
- package/dist/src/demo/Showcase/index.d.ts +1 -0
- package/dist/src/demo/Showcase/index.js +1 -0
- package/dist/src/demo/ShowcaseItem/ShowcaseItem.d.ts +7 -0
- package/dist/src/demo/ShowcaseItem/ShowcaseItem.js +7 -0
- package/dist/src/demo/ShowcaseItem/index.d.ts +1 -0
- package/dist/src/demo/ShowcaseItem/index.js +1 -0
- package/dist/src/demo/SwapArea/SwapArea.d.ts +2 -0
- package/dist/src/demo/SwapArea/SwapArea.js +7 -0
- package/dist/src/demo/SwapArea/index.d.ts +1 -0
- package/dist/src/demo/SwapArea/index.js +1 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/index.js +2 -0
- package/dist/src/hooks/useDateFormatter/index.d.ts +34 -0
- package/dist/src/hooks/useDateFormatter/index.js +101 -0
- package/dist/src/hooks/useToolMessage.d.ts +11 -0
- package/dist/src/hooks/useToolMessage.js +96 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +19 -0
- package/dist/src/types/chat.d.ts +17 -0
- package/dist/src/types/chat.js +1 -0
- package/dist/src/types/common.d.ts +7 -0
- package/dist/src/types/common.js +1 -0
- package/dist/src/types/index.d.ts +4 -0
- package/dist/src/types/index.js +4 -0
- package/dist/src/types/messages.d.ts +62 -0
- package/dist/src/types/messages.js +1 -0
- package/dist/src/types/tool.d.ts +34 -0
- package/dist/src/types/tool.js +1 -0
- package/dist/src/utils/chatUtils.d.ts +23 -0
- package/dist/src/utils/chatUtils.js +43 -0
- package/dist/src/utils/cn.d.ts +11 -0
- package/dist/src/utils/cn.js +12 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/index.js +5 -0
- package/dist/src/utils/messageTypeRegistry.d.ts +13 -0
- package/dist/src/utils/messageTypeRegistry.js +16 -0
- package/dist/src/utils/messageUtils.d.ts +4 -0
- package/dist/src/utils/messageUtils.js +25 -0
- package/dist/src/utils/validation.d.ts +16 -0
- package/dist/src/utils/validation.js +24 -0
- package/package.json +111 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from '@gravity-ui/uikit';
|
|
3
|
+
import { useToolMessage } from '../../../hooks/useToolMessage';
|
|
4
|
+
import { block } from '../../../utils/cn';
|
|
5
|
+
import { ToolFooter, ToolHeader } from '../../molecules';
|
|
6
|
+
import './ToolMessage.scss';
|
|
7
|
+
const b = block('tool-message');
|
|
8
|
+
export function ToolMessage(props) {
|
|
9
|
+
const { toolName, className, qa, bodyContent, status, toolIcon, headerContent } = props;
|
|
10
|
+
const { isExpanded, headerActions, footerActions, footerContent, showLoader, isWaiting } = useToolMessage(props);
|
|
11
|
+
return (_jsx(Card, { className: b({ waiting: isWaiting }, className), "data-qa": qa, children: _jsxs("div", { className: b('container'), children: [_jsx(ToolHeader, { toolName: toolName, actions: headerActions, toolIcon: toolIcon, content: headerContent, status: status }), bodyContent && isExpanded && _jsx("div", { className: b('content'), children: bodyContent }), isWaiting && (_jsx(ToolFooter, { actions: footerActions, content: footerContent, showLoader: showLoader }))] }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { type UserMessageProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<UserMessageProps>;
|
|
6
|
+
export declare const ShowAvatar: StoryFn<UserMessageProps>;
|
|
7
|
+
export declare const ShowTimestamp: StoryFn<UserMessageProps>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { UserMessage } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'organisms/UserMessage',
|
|
7
|
+
component: UserMessage,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
data: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Message text',
|
|
17
|
+
},
|
|
18
|
+
actions: {
|
|
19
|
+
control: 'object',
|
|
20
|
+
description: 'Actions',
|
|
21
|
+
},
|
|
22
|
+
showActionsOnHover: {
|
|
23
|
+
control: 'boolean',
|
|
24
|
+
description: 'Show actions on hover',
|
|
25
|
+
},
|
|
26
|
+
showTimestamp: {
|
|
27
|
+
control: 'boolean',
|
|
28
|
+
description: 'Show timestamp',
|
|
29
|
+
},
|
|
30
|
+
timestamp: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
description: 'Timestamp',
|
|
33
|
+
},
|
|
34
|
+
withAvatar: {
|
|
35
|
+
control: 'boolean',
|
|
36
|
+
description: 'Show avatar',
|
|
37
|
+
},
|
|
38
|
+
avatarUrl: {
|
|
39
|
+
control: 'text',
|
|
40
|
+
description: 'Avatar URL',
|
|
41
|
+
},
|
|
42
|
+
className: {
|
|
43
|
+
control: 'text',
|
|
44
|
+
description: 'Additional CSS class',
|
|
45
|
+
},
|
|
46
|
+
qa: {
|
|
47
|
+
control: 'text',
|
|
48
|
+
description: 'QA/test identifier',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const buttons = [
|
|
53
|
+
{ type: 'copy', onClick: () => ({}) },
|
|
54
|
+
{ type: 'edit', onClick: () => ({}) },
|
|
55
|
+
];
|
|
56
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(UserMessage, Object.assign({}, args)) }));
|
|
57
|
+
Playground.args = {
|
|
58
|
+
content: 'Analyze the project and suggest a better solution to implement a feature-name',
|
|
59
|
+
actions: buttons,
|
|
60
|
+
};
|
|
61
|
+
export const ShowAvatar = (args) => (_jsx(ContentWrapper, { children: _jsx(UserMessage, Object.assign({}, args, { showAvatar: true })) }));
|
|
62
|
+
ShowAvatar.args = {
|
|
63
|
+
content: 'Analyze the project and suggest a better solution to implement a feature-name',
|
|
64
|
+
actions: buttons,
|
|
65
|
+
};
|
|
66
|
+
export const ShowTimestamp = (args) => (_jsx(ContentWrapper, { children: _jsx(UserMessage, Object.assign({}, args, { showTimestamp: true, timestamp: "1705312234567" })) }));
|
|
67
|
+
ShowTimestamp.args = {
|
|
68
|
+
content: 'Analyze the project and suggest a better solution to implement a feature-name',
|
|
69
|
+
actions: buttons,
|
|
70
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OptionsType } from '@diplodoc/transform/lib/typings';
|
|
2
|
+
import type { BaseMessageProps } from '../../../types/messages';
|
|
3
|
+
import './UserMessage.scss';
|
|
4
|
+
export type UserMessageProps = Pick<BaseMessageProps, 'actions' | 'showActionsOnHover' | 'showTimestamp' | 'timestamp'> & {
|
|
5
|
+
content: string | React.ReactNode;
|
|
6
|
+
format?: 'plain' | 'markdown';
|
|
7
|
+
showAvatar?: boolean;
|
|
8
|
+
avatarUrl?: string;
|
|
9
|
+
transformOptions?: OptionsType;
|
|
10
|
+
className?: string;
|
|
11
|
+
qa?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const UserMessage: (props: UserMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar } from '@gravity-ui/uikit';
|
|
3
|
+
import { block } from '../../../utils/cn';
|
|
4
|
+
import { MarkdownRenderer } from '../../atoms/MarkdownRenderer';
|
|
5
|
+
import { MessageBalloon } from '../../atoms/MessageBalloon';
|
|
6
|
+
import { BaseMessage } from '../../molecules/BaseMessage';
|
|
7
|
+
import './UserMessage.scss';
|
|
8
|
+
const b = block('user-message');
|
|
9
|
+
export const UserMessage = (props) => {
|
|
10
|
+
const { className, qa, content, actions, showActionsOnHover, showAvatar, avatarUrl = '', timestamp = '', showTimestamp, format = 'plain', transformOptions, } = props;
|
|
11
|
+
return (_jsxs("div", { className: b(null, className), "data-qa": qa, children: [showAvatar ? _jsx(Avatar, { imgUrl: avatarUrl, size: "s", view: "filled" }) : null, _jsx(BaseMessage, { role: "user", actions: actions, showActionsOnHover: showActionsOnHover, showTimestamp: showTimestamp, timestamp: timestamp, children: _jsx(MessageBalloon, { children: format === 'markdown' ? (_jsx(MarkdownRenderer, { content: content, transformOptions: transformOptions })) : (content) }) })] }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChatContainerProps } from './types';
|
|
2
|
+
import './ChatContainer.scss';
|
|
3
|
+
/**
|
|
4
|
+
* ChatContainer - fully assembled chat component, the main exportable component of the library.
|
|
5
|
+
* Integrates Header, ChatContent, History and manages their state.
|
|
6
|
+
*
|
|
7
|
+
* @param props - component props
|
|
8
|
+
* @returns React component
|
|
9
|
+
*/
|
|
10
|
+
export declare function ChatContainer(props: ChatContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { block } from '../../../utils/cn';
|
|
4
|
+
import { Disclaimer } from '../../atoms/Disclaimer';
|
|
5
|
+
import { Header } from '../../organisms/Header';
|
|
6
|
+
import { PromptInput } from '../../organisms/PromptInput';
|
|
7
|
+
import { ChatContent } from '../../templates/ChatContent';
|
|
8
|
+
import { History } from '../../templates/History';
|
|
9
|
+
import { i18n } from './i18n';
|
|
10
|
+
import { useChatContainer } from './useChatContainer';
|
|
11
|
+
import './ChatContainer.scss';
|
|
12
|
+
const b = block('chat-container');
|
|
13
|
+
/**
|
|
14
|
+
* ChatContainer - fully assembled chat component, the main exportable component of the library.
|
|
15
|
+
* Integrates Header, ChatContent, History and manages their state.
|
|
16
|
+
*
|
|
17
|
+
* @param props - component props
|
|
18
|
+
* @returns React component
|
|
19
|
+
*/
|
|
20
|
+
export function ChatContainer(props) {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
const { chats = [], messages = [], onSendMessage, onDeleteChat, onCancel, onRetry, status = 'ready', error = null, showActionsOnHover = false, contextItems = [], transformOptions, headerProps = {}, contentProps = {}, emptyContainerProps = {}, promptInputProps = {}, historyProps = {}, welcomeConfig, i18nConfig = {}, className, qa, } = props;
|
|
23
|
+
const hookState = useChatContainer(props);
|
|
24
|
+
// Collect i18n texts with overrides
|
|
25
|
+
const headerTitle = useMemo(() => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return ((_a = i18nConfig.header) === null || _a === void 0 ? void 0 : _a.defaultTitle) ||
|
|
28
|
+
headerProps.title ||
|
|
29
|
+
((_b = hookState.activeChat) === null || _b === void 0 ? void 0 : _b.name) ||
|
|
30
|
+
i18n('header-default-title');
|
|
31
|
+
}, [(_a = i18nConfig.header) === null || _a === void 0 ? void 0 : _a.defaultTitle, headerProps.title, (_b = hookState.activeChat) === null || _b === void 0 ? void 0 : _b.name]);
|
|
32
|
+
// Build props for Header
|
|
33
|
+
const finalHeaderProps = useMemo(() => (Object.assign(Object.assign({}, headerProps), { title: headerTitle, baseActions: hookState.baseActions, handleNewChat: hookState.handleNewChat, handleHistoryToggle: hookState.handleHistoryToggle, handleClose: hookState.handleClose, historyButtonRef: hookState.historyButtonRef })), [
|
|
34
|
+
headerTitle,
|
|
35
|
+
hookState.baseActions,
|
|
36
|
+
hookState.handleNewChat,
|
|
37
|
+
hookState.handleHistoryToggle,
|
|
38
|
+
hookState.handleClose,
|
|
39
|
+
hookState.historyButtonRef,
|
|
40
|
+
headerProps,
|
|
41
|
+
]);
|
|
42
|
+
// Build props for EmptyContainer
|
|
43
|
+
const finalEmptyContainerProps = useMemo(() => {
|
|
44
|
+
var _a, _b, _c, _d, _e;
|
|
45
|
+
// Map suggestions from WelcomeConfig to SuggestionsItem format
|
|
46
|
+
const defaultSuggestions = (_a = welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.suggestions) === null || _a === void 0 ? void 0 : _a.map((s) => ({
|
|
47
|
+
id: s.id,
|
|
48
|
+
title: s.label || s.content, // Use label or content as button title
|
|
49
|
+
}));
|
|
50
|
+
return Object.assign(Object.assign({}, emptyContainerProps), { image: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.image, title: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.title) || ((_b = i18nConfig.emptyState) === null || _b === void 0 ? void 0 : _b.title) || i18n('empty-state-title'), description: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.description) ||
|
|
51
|
+
((_c = i18nConfig.emptyState) === null || _c === void 0 ? void 0 : _c.description) ||
|
|
52
|
+
i18n('empty-state-description'), suggestionTitle: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.suggestionTitle) ||
|
|
53
|
+
((_d = i18nConfig.emptyState) === null || _d === void 0 ? void 0 : _d.suggestionsTitle) ||
|
|
54
|
+
i18n('empty-state-suggestions-title'), suggestions: defaultSuggestions, showMore: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.showMore, showMoreText: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.showMoreText) ||
|
|
55
|
+
((_e = i18nConfig.emptyState) === null || _e === void 0 ? void 0 : _e.showMoreText) ||
|
|
56
|
+
i18n('empty-state-show-more'), onSuggestionClick: async (clickedTitle) => {
|
|
57
|
+
var _a;
|
|
58
|
+
// Find original suggestion by title to get content
|
|
59
|
+
const originalSuggestion = (_a = welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.suggestions) === null || _a === void 0 ? void 0 : _a.find((s) => (s.label || s.content) === clickedTitle);
|
|
60
|
+
const contentToSend = (originalSuggestion === null || originalSuggestion === void 0 ? void 0 : originalSuggestion.content) || clickedTitle;
|
|
61
|
+
await onSendMessage({ content: contentToSend });
|
|
62
|
+
} });
|
|
63
|
+
}, [welcomeConfig, i18nConfig.emptyState, emptyContainerProps, onSendMessage]);
|
|
64
|
+
// Build props for MessageList
|
|
65
|
+
const messageListProps = useMemo(() => ({
|
|
66
|
+
messages,
|
|
67
|
+
status,
|
|
68
|
+
errorMessage: error ? { text: error.message } : undefined,
|
|
69
|
+
onRetry,
|
|
70
|
+
showActionsOnHover,
|
|
71
|
+
transformOptions,
|
|
72
|
+
}), [messages, status, error, onRetry, showActionsOnHover, transformOptions]);
|
|
73
|
+
// Build props for PromptInput
|
|
74
|
+
const finalPromptInputProps = useMemo(() => {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
return (Object.assign(Object.assign({}, promptInputProps), { onSend: onSendMessage, onCancel,
|
|
77
|
+
status, headerProps: Object.assign(Object.assign({}, promptInputProps === null || promptInputProps === void 0 ? void 0 : promptInputProps.headerProps), { contextItems }), bodyProps: Object.assign(Object.assign({}, promptInputProps === null || promptInputProps === void 0 ? void 0 : promptInputProps.bodyProps), { placeholder: ((_a = i18nConfig.promptInput) === null || _a === void 0 ? void 0 : _a.placeholder) ||
|
|
78
|
+
((_b = promptInputProps === null || promptInputProps === void 0 ? void 0 : promptInputProps.bodyProps) === null || _b === void 0 ? void 0 : _b.placeholder) ||
|
|
79
|
+
i18n('prompt-placeholder') }) }));
|
|
80
|
+
}, [onSendMessage, onCancel, status, contextItems, i18nConfig.promptInput, promptInputProps]);
|
|
81
|
+
// Build props for Disclaimer
|
|
82
|
+
const disclaimerProps = useMemo(() => {
|
|
83
|
+
var _a;
|
|
84
|
+
const disclaimerText = ((_a = i18nConfig.disclaimer) === null || _a === void 0 ? void 0 : _a.text) || i18n('disclaimer-text');
|
|
85
|
+
return {
|
|
86
|
+
text: disclaimerText,
|
|
87
|
+
};
|
|
88
|
+
}, [i18nConfig.disclaimer]);
|
|
89
|
+
// Build props for ChatContent
|
|
90
|
+
const finalContentProps = useMemo(() => (Object.assign(Object.assign({}, contentProps), { view: hookState.chatContentView, emptyContainerProps: finalEmptyContainerProps, messageListProps })), [hookState.chatContentView, finalEmptyContainerProps, messageListProps, contentProps]);
|
|
91
|
+
// Build props for History
|
|
92
|
+
const finalHistoryProps = useMemo(() => {
|
|
93
|
+
var _a;
|
|
94
|
+
return (Object.assign(Object.assign({}, historyProps), { chats, selectedChat: hookState.activeChat, onSelectChat: hookState.handleSelectChat, onDeleteChat, open: hookState.isHistoryOpen, onOpenChange: hookState.handleHistoryOpenChange, anchorElement: hookState.historyButtonRef.current, emptyPlaceholder: ((_a = i18nConfig.history) === null || _a === void 0 ? void 0 : _a.emptyPlaceholder) ||
|
|
95
|
+
historyProps.emptyPlaceholder ||
|
|
96
|
+
i18n('history-empty') }));
|
|
97
|
+
}, [
|
|
98
|
+
chats,
|
|
99
|
+
hookState.activeChat,
|
|
100
|
+
hookState.handleSelectChat,
|
|
101
|
+
onDeleteChat,
|
|
102
|
+
hookState.isHistoryOpen,
|
|
103
|
+
hookState.handleHistoryOpenChange,
|
|
104
|
+
hookState.historyButtonRef,
|
|
105
|
+
i18nConfig.history,
|
|
106
|
+
historyProps,
|
|
107
|
+
]);
|
|
108
|
+
const showFooter = finalPromptInputProps || disclaimerProps;
|
|
109
|
+
return (_jsxs("div", { className: b(null, className), "data-qa": qa, children: [_jsx("div", { className: b('header'), children: _jsx(Header, Object.assign({}, finalHeaderProps)) }), _jsx("div", { className: b('content'), children: _jsx(ChatContent, Object.assign({}, finalContentProps)) }), showFooter && (_jsxs("div", { className: b('footer'), children: [finalPromptInputProps && _jsx(PromptInput, Object.assign({}, finalPromptInputProps)), disclaimerProps && _jsx(Disclaimer, Object.assign({}, disclaimerProps))] })), _jsx(History, Object.assign({}, finalHistoryProps))] }));
|
|
110
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { ChatContainer } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof ChatContainer>;
|
|
6
|
+
/**
|
|
7
|
+
* Playground story for interactive testing
|
|
8
|
+
*/
|
|
9
|
+
export declare const Playground: Story;
|
|
10
|
+
/**
|
|
11
|
+
* Empty state with welcome screen
|
|
12
|
+
*/
|
|
13
|
+
export declare const EmptyState: Story;
|
|
14
|
+
/**
|
|
15
|
+
* State with messages
|
|
16
|
+
*/
|
|
17
|
+
export declare const WithMessages: Story;
|
|
18
|
+
/**
|
|
19
|
+
* With streaming
|
|
20
|
+
*/
|
|
21
|
+
export declare const WithStreaming: Story;
|
|
22
|
+
/**
|
|
23
|
+
* With history
|
|
24
|
+
*/
|
|
25
|
+
export declare const WithHistory: Story;
|
|
26
|
+
/**
|
|
27
|
+
* With custom i18n configuration
|
|
28
|
+
*/
|
|
29
|
+
export declare const WithI18nConfig: Story;
|
|
30
|
+
/**
|
|
31
|
+
* With component props override
|
|
32
|
+
*/
|
|
33
|
+
export declare const WithComponentPropsOverride: Story;
|
|
34
|
+
/**
|
|
35
|
+
* With context items
|
|
36
|
+
*/
|
|
37
|
+
export declare const WithContextItems: Story;
|
|
38
|
+
/**
|
|
39
|
+
* With context items and indicator
|
|
40
|
+
*/
|
|
41
|
+
export declare const WithContextItemsAndIndicator: Story;
|
|
42
|
+
/**
|
|
43
|
+
* With loading state
|
|
44
|
+
*/
|
|
45
|
+
export declare const LoadingState: Story;
|
|
46
|
+
/**
|
|
47
|
+
* With error
|
|
48
|
+
*/
|
|
49
|
+
export declare const ErrorState: Story;
|
|
50
|
+
/**
|
|
51
|
+
* Full example with realistic streaming via fetch API
|
|
52
|
+
*/
|
|
53
|
+
export declare const FullStreamingExample: Story;
|