@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,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"header-default-title": "AI Chat",
|
|
3
|
+
"empty-state-title": "Welcome to AI Chat",
|
|
4
|
+
"empty-state-description": "Start a conversation by typing a message below or selecting a suggestion.",
|
|
5
|
+
"empty-state-suggestions-title": "Try asking:",
|
|
6
|
+
"empty-state-show-more": "Show more examples",
|
|
7
|
+
"prompt-placeholder": "Type your message...",
|
|
8
|
+
"history-empty": "No chat history yet",
|
|
9
|
+
"disclaimer-text": "AI can make mistakes. Check important info."
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const i18n: ((key: "header-default-title" | "empty-state-title" | "empty-state-description" | "empty-state-suggestions-title" | "empty-state-show-more" | "prompt-placeholder" | "history-empty" | "disclaimer-text", params?: import("@gravity-ui/i18n").Params) => string) & {
|
|
2
|
+
Translation: import("react").ComponentType<{
|
|
3
|
+
children: (props: {
|
|
4
|
+
t: (key: "header-default-title" | "empty-state-title" | "empty-state-description" | "empty-state-suggestions-title" | "empty-state-show-more" | "prompt-placeholder" | "history-empty" | "disclaimer-text", params?: import("@gravity-ui/i18n").Params) => string;
|
|
5
|
+
}) => React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
useTranslation: () => {
|
|
8
|
+
t: (key: "header-default-title" | "empty-state-title" | "empty-state-description" | "empty-state-suggestions-title" | "empty-state-show-more" | "prompt-placeholder" | "history-empty" | "disclaimer-text", params?: import("@gravity-ui/i18n").Params) => string;
|
|
9
|
+
};
|
|
10
|
+
keysetData: {
|
|
11
|
+
"g-aikit-ChatContainer": Record<"header-default-title" | "empty-state-title" | "empty-state-description" | "empty-state-suggestions-title" | "empty-state-show-more" | "prompt-placeholder" | "history-empty" | "disclaimer-text", import("@gravity-ui/i18n").KeyData>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"header-default-title": "AI Чат",
|
|
3
|
+
"empty-state-title": "Добро пожаловать в AI Чат",
|
|
4
|
+
"empty-state-description": "Начните разговор, введя сообщение ниже или выбрав подсказку.",
|
|
5
|
+
"empty-state-suggestions-title": "Попробуйте спросить:",
|
|
6
|
+
"empty-state-show-more": "Показать больше примеров",
|
|
7
|
+
"prompt-placeholder": "Введите ваше сообщение...",
|
|
8
|
+
"history-empty": "История чатов пока пуста",
|
|
9
|
+
"disclaimer-text": "ИИ может ошибаться. Проверяйте важную информацию."
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatContainer } from './ChatContainer';
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { OptionsType } from '@diplodoc/transform/lib/typings';
|
|
2
|
+
import type { ChatStatus, ChatType, TChatMessage, TSubmitData } from '../../../types';
|
|
3
|
+
import type { ContextItemConfig } from '../../molecules/PromptInputHeader';
|
|
4
|
+
import type { HeaderProps } from '../../organisms/Header';
|
|
5
|
+
import type { PromptInputProps } from '../../organisms/PromptInput';
|
|
6
|
+
import type { ChatContentProps } from '../../templates/ChatContent';
|
|
7
|
+
import type { EmptyContainerProps } from '../../templates/EmptyContainer';
|
|
8
|
+
import type { HistoryProps } from '../../templates/History';
|
|
9
|
+
/**
|
|
10
|
+
* I18n configuration for all text labels in ChatContainer
|
|
11
|
+
*/
|
|
12
|
+
export interface ChatContainerI18nConfig {
|
|
13
|
+
/** Header texts */
|
|
14
|
+
header?: {
|
|
15
|
+
/** Default header title */
|
|
16
|
+
defaultTitle?: string;
|
|
17
|
+
/** Tooltip for new chat button */
|
|
18
|
+
newChatTooltip?: string;
|
|
19
|
+
/** Tooltip for history button */
|
|
20
|
+
historyTooltip?: string;
|
|
21
|
+
/** Tooltip for close button */
|
|
22
|
+
closeTooltip?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Empty state texts */
|
|
25
|
+
emptyState?: {
|
|
26
|
+
/** Welcome title */
|
|
27
|
+
title?: string;
|
|
28
|
+
/** Welcome description */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Suggestions section title */
|
|
31
|
+
suggestionsTitle?: string;
|
|
32
|
+
/** Show more suggestions button text */
|
|
33
|
+
showMoreText?: string;
|
|
34
|
+
};
|
|
35
|
+
/** Prompt input texts */
|
|
36
|
+
promptInput?: {
|
|
37
|
+
/** Placeholder text */
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
/** Send button tooltip */
|
|
40
|
+
sendTooltip?: string;
|
|
41
|
+
/** Cancel button tooltip */
|
|
42
|
+
cancelTooltip?: string;
|
|
43
|
+
};
|
|
44
|
+
/** History texts */
|
|
45
|
+
history?: {
|
|
46
|
+
/** Empty state placeholder */
|
|
47
|
+
emptyPlaceholder?: string;
|
|
48
|
+
/** Search placeholder */
|
|
49
|
+
searchPlaceholder?: string;
|
|
50
|
+
};
|
|
51
|
+
/** Disclaimer text */
|
|
52
|
+
disclaimer?: {
|
|
53
|
+
/** Disclaimer text content */
|
|
54
|
+
text?: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Welcome screen configuration
|
|
59
|
+
*/
|
|
60
|
+
export interface WelcomeConfig {
|
|
61
|
+
/** Image or icon to display */
|
|
62
|
+
image?: React.ReactNode;
|
|
63
|
+
/** Title text */
|
|
64
|
+
title?: string;
|
|
65
|
+
/** Description text */
|
|
66
|
+
description?: string;
|
|
67
|
+
/** Suggestions section title */
|
|
68
|
+
suggestionTitle?: string;
|
|
69
|
+
/** Array of suggestions */
|
|
70
|
+
suggestions?: Array<{
|
|
71
|
+
/** Unique identifier for the suggestion */
|
|
72
|
+
id: string;
|
|
73
|
+
/** Suggestion text content that will be sent as message */
|
|
74
|
+
content: string;
|
|
75
|
+
/** Display title for the suggestion button (defaults to content if not provided) */
|
|
76
|
+
label?: string;
|
|
77
|
+
}>;
|
|
78
|
+
/** Show more suggestions callback */
|
|
79
|
+
showMore?: () => void;
|
|
80
|
+
/** Show more button text */
|
|
81
|
+
showMoreText?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Props for ChatContainer component
|
|
85
|
+
*/
|
|
86
|
+
export interface ChatContainerProps {
|
|
87
|
+
/** Array of chats for history */
|
|
88
|
+
chats?: ChatType[];
|
|
89
|
+
/** Currently active chat */
|
|
90
|
+
activeChat?: ChatType | null;
|
|
91
|
+
/** Array of messages in current chat */
|
|
92
|
+
messages?: TChatMessage[];
|
|
93
|
+
/** Callback when user sends a message */
|
|
94
|
+
onSendMessage: (data: TSubmitData) => Promise<void>;
|
|
95
|
+
/** Callback when user selects a chat from history */
|
|
96
|
+
onSelectChat?: (chat: ChatType) => void;
|
|
97
|
+
/** Callback when user creates a new chat */
|
|
98
|
+
onCreateChat?: () => void;
|
|
99
|
+
/** Callback when user deletes a chat */
|
|
100
|
+
onDeleteChat?: (chat: ChatType) => void;
|
|
101
|
+
/** Callback when user deletes all chats */
|
|
102
|
+
onDeleteAllChats?: () => Promise<void>;
|
|
103
|
+
/** Callback when user closes the chat */
|
|
104
|
+
onClose?: () => void;
|
|
105
|
+
/** Callback when user cancels streaming */
|
|
106
|
+
onCancel?: () => Promise<void>;
|
|
107
|
+
/** Chat status: submitted, streaming, ready, error */
|
|
108
|
+
status?: ChatStatus;
|
|
109
|
+
/** Error state */
|
|
110
|
+
error?: Error | null;
|
|
111
|
+
/** Show message actions on hover */
|
|
112
|
+
showActionsOnHover?: boolean;
|
|
113
|
+
/** Callback to retry after error */
|
|
114
|
+
onRetry?: () => void;
|
|
115
|
+
/** Array of context items to display in prompt input header */
|
|
116
|
+
contextItems?: ContextItemConfig[];
|
|
117
|
+
/** Transform options for markdown rendering */
|
|
118
|
+
transformOptions?: OptionsType;
|
|
119
|
+
/** Props override for Header component */
|
|
120
|
+
headerProps?: Partial<Omit<HeaderProps, 'handleNewChat' | 'handleHistoryToggle' | 'handleClose'>>;
|
|
121
|
+
/** Props override for ChatContent component */
|
|
122
|
+
contentProps?: Partial<Omit<ChatContentProps, 'view' | 'messageListProps'>>;
|
|
123
|
+
/** Props override for EmptyContainer (welcome screen) */
|
|
124
|
+
emptyContainerProps?: Partial<EmptyContainerProps>;
|
|
125
|
+
/** Props override for PromptInput component */
|
|
126
|
+
promptInputProps?: Partial<Omit<PromptInputProps, 'onSend' | 'onCancel'>>;
|
|
127
|
+
/** Props override for History component */
|
|
128
|
+
historyProps?: Partial<Omit<HistoryProps, 'chats' | 'selectedChat' | 'onSelectChat' | 'onDeleteChat' | 'anchorElement'>>;
|
|
129
|
+
/** Welcome screen configuration for empty state */
|
|
130
|
+
welcomeConfig?: WelcomeConfig;
|
|
131
|
+
/** I18n configuration for all text labels */
|
|
132
|
+
i18nConfig?: ChatContainerI18nConfig;
|
|
133
|
+
/** Show chat history feature */
|
|
134
|
+
showHistory?: boolean;
|
|
135
|
+
/** Show new chat button */
|
|
136
|
+
showNewChat?: boolean;
|
|
137
|
+
/** Show close button */
|
|
138
|
+
showClose?: boolean;
|
|
139
|
+
/** Additional CSS class */
|
|
140
|
+
className?: string;
|
|
141
|
+
/** QA/test identifier */
|
|
142
|
+
qa?: string;
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HeaderAction } from '../../organisms/Header';
|
|
2
|
+
import type { ChatContainerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for managing ChatContainer state
|
|
5
|
+
*
|
|
6
|
+
* @param props - ChatContainer component props
|
|
7
|
+
* @returns object with state and handlers
|
|
8
|
+
*/
|
|
9
|
+
export declare function useChatContainer(props: ChatContainerProps): {
|
|
10
|
+
chatContentView: string;
|
|
11
|
+
isHistoryOpen: boolean;
|
|
12
|
+
activeChat: import("../../..").ChatType | null | undefined;
|
|
13
|
+
historyButtonRef: import("react").RefObject<HTMLElement>;
|
|
14
|
+
handleNewChat: () => void;
|
|
15
|
+
handleHistoryToggle: () => void;
|
|
16
|
+
handleClose: () => void;
|
|
17
|
+
handleSelectChat: (chat: ChatContainerProps["activeChat"]) => void;
|
|
18
|
+
handleHistoryOpenChange: (open: boolean) => void;
|
|
19
|
+
baseActions: HeaderAction[];
|
|
20
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { HeaderAction } from '../../organisms/Header';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for managing ChatContainer state
|
|
5
|
+
*
|
|
6
|
+
* @param props - ChatContainer component props
|
|
7
|
+
* @returns object with state and handlers
|
|
8
|
+
*/
|
|
9
|
+
export function useChatContainer(props) {
|
|
10
|
+
const { messages = [], activeChat, onCreateChat, onClose, onSelectChat, showHistory = true, showNewChat = true, showClose = false, } = props;
|
|
11
|
+
// Refs for History integration with Header
|
|
12
|
+
const historyButtonRef = useRef(null);
|
|
13
|
+
const [isHistoryOpen, setIsHistoryOpen] = useState(false);
|
|
14
|
+
// Determine view for ChatContent (empty or chat)
|
|
15
|
+
const chatContentView = useMemo(() => {
|
|
16
|
+
// If there is an active chat (selected from history), show chat view
|
|
17
|
+
// even if there are no messages yet
|
|
18
|
+
if (activeChat) {
|
|
19
|
+
return 'chat';
|
|
20
|
+
}
|
|
21
|
+
// If no active chat, determine by the presence of messages
|
|
22
|
+
return messages.length === 0 ? 'empty' : 'chat';
|
|
23
|
+
}, [messages.length, activeChat]);
|
|
24
|
+
// Handler for creating new chat
|
|
25
|
+
const handleNewChat = useCallback(() => {
|
|
26
|
+
onCreateChat === null || onCreateChat === void 0 ? void 0 : onCreateChat();
|
|
27
|
+
}, [onCreateChat]);
|
|
28
|
+
// Handler for toggling history
|
|
29
|
+
const handleHistoryToggle = useCallback(() => {
|
|
30
|
+
setIsHistoryOpen((prev) => !prev);
|
|
31
|
+
}, []);
|
|
32
|
+
// Handler for closing
|
|
33
|
+
const handleClose = useCallback(() => {
|
|
34
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
35
|
+
}, [onClose]);
|
|
36
|
+
// Handler for selecting chat from history
|
|
37
|
+
const handleSelectChat = useCallback((chat) => {
|
|
38
|
+
if (chat) {
|
|
39
|
+
onSelectChat === null || onSelectChat === void 0 ? void 0 : onSelectChat(chat);
|
|
40
|
+
setIsHistoryOpen(false);
|
|
41
|
+
}
|
|
42
|
+
}, [onSelectChat]);
|
|
43
|
+
// Handler for history popup state changes
|
|
44
|
+
const handleHistoryOpenChange = useCallback((open) => {
|
|
45
|
+
setIsHistoryOpen(open);
|
|
46
|
+
}, []);
|
|
47
|
+
// Build baseActions for Header
|
|
48
|
+
const baseActions = useMemo(() => {
|
|
49
|
+
const actions = [];
|
|
50
|
+
if (showNewChat) {
|
|
51
|
+
actions.push(HeaderAction.NewChat);
|
|
52
|
+
}
|
|
53
|
+
if (showHistory) {
|
|
54
|
+
actions.push(HeaderAction.History);
|
|
55
|
+
}
|
|
56
|
+
if (showClose) {
|
|
57
|
+
actions.push(HeaderAction.Close);
|
|
58
|
+
}
|
|
59
|
+
return actions;
|
|
60
|
+
}, [showNewChat, showHistory, showClose]);
|
|
61
|
+
return {
|
|
62
|
+
// State
|
|
63
|
+
chatContentView,
|
|
64
|
+
isHistoryOpen,
|
|
65
|
+
activeChat,
|
|
66
|
+
// Refs
|
|
67
|
+
historyButtonRef,
|
|
68
|
+
// Handlers
|
|
69
|
+
handleNewChat,
|
|
70
|
+
handleHistoryToggle,
|
|
71
|
+
handleClose,
|
|
72
|
+
handleSelectChat,
|
|
73
|
+
handleHistoryOpenChange,
|
|
74
|
+
// Configuration
|
|
75
|
+
baseActions,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChatContainer';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type MessageListProps } from '../../organisms/MessageList';
|
|
2
|
+
import { type EmptyContainerProps } from '../EmptyContainer';
|
|
3
|
+
import './ChatContent.scss';
|
|
4
|
+
/**
|
|
5
|
+
* ChatContent display mode
|
|
6
|
+
*/
|
|
7
|
+
export type ChatContentView = 'empty' | 'chat';
|
|
8
|
+
/**
|
|
9
|
+
* Props for ChatContent component
|
|
10
|
+
*/
|
|
11
|
+
export interface ChatContentProps {
|
|
12
|
+
/** Display mode: 'empty' - EmptyContainer, 'chat' - MessageList */
|
|
13
|
+
view: ChatContentView;
|
|
14
|
+
/** Props for EmptyContainer (used when view='empty') */
|
|
15
|
+
emptyContainerProps?: EmptyContainerProps;
|
|
16
|
+
/** Props for MessageList (used when view='chat') */
|
|
17
|
+
messageListProps?: MessageListProps;
|
|
18
|
+
/** Additional CSS class */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** QA/test identifier */
|
|
21
|
+
qa?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* ChatContent - main chat content with state switching (EmptyContainer/MessageList).
|
|
25
|
+
*
|
|
26
|
+
* @param props - Component props
|
|
27
|
+
* @returns React component
|
|
28
|
+
*/
|
|
29
|
+
export declare function ChatContent(props: ChatContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import { MessageList } from '../../organisms/MessageList';
|
|
4
|
+
import { EmptyContainer } from '../EmptyContainer';
|
|
5
|
+
import './ChatContent.scss';
|
|
6
|
+
const b = block('chat-content');
|
|
7
|
+
/**
|
|
8
|
+
* ChatContent - main chat content with state switching (EmptyContainer/MessageList).
|
|
9
|
+
*
|
|
10
|
+
* @param props - Component props
|
|
11
|
+
* @returns React component
|
|
12
|
+
*/
|
|
13
|
+
export function ChatContent(props) {
|
|
14
|
+
const { view, emptyContainerProps, messageListProps, className, qa } = props;
|
|
15
|
+
const isEmptyView = view === 'empty';
|
|
16
|
+
return (_jsx("div", { className: b(null, className), "data-qa": qa, children: isEmptyView
|
|
17
|
+
? emptyContainerProps && _jsx(EmptyContainer, Object.assign({}, emptyContainerProps))
|
|
18
|
+
: messageListProps && (_jsx("div", { className: b('message-list-container'), children: _jsx(MessageList, Object.assign({}, messageListProps)) })) }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { ChatContent } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof ChatContent>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const EmptyState: Story;
|
|
8
|
+
export declare const EmptyStateWithSuggestions: Story;
|
|
9
|
+
export declare const ChatStateWithMessages: Story;
|
|
10
|
+
export declare const ChatStateWithActionsOnHover: Story;
|
|
11
|
+
export declare const WithLongMessages: Story;
|
|
12
|
+
export declare const WithManyMessages: Story;
|
|
13
|
+
export declare const Interactive: Story;
|
|
14
|
+
export declare const LongConversation: Story;
|