@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 @@
|
|
|
1
|
+
export const RELATIVE_DATE_THRESHOLD = 7; // 7 days
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import './ContentWrapper.scss';
|
|
4
|
+
const b = cn('content-wrapper');
|
|
5
|
+
export function ContentWrapper({ children, width, height }) {
|
|
6
|
+
return (_jsx("div", { className: b(), style: { width, height }, children: children }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContentWrapper } from './ContentWrapper';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ContentWrapper } from './ContentWrapper';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { DocsContainerProps } from '@storybook/addon-docs';
|
|
3
|
+
import './DocsDecorator.scss';
|
|
4
|
+
export interface DocsDecoratorProps extends React.PropsWithChildren<DocsContainerProps> {
|
|
5
|
+
}
|
|
6
|
+
export declare function DocsDecorator({ children, context }: DocsDecoratorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MobileProvider, ThemeProvider, getThemeType } from '@gravity-ui/uikit';
|
|
3
|
+
import { DocsContainer } from '@storybook/addon-docs';
|
|
4
|
+
import { themes } from '../../../.storybook/theme';
|
|
5
|
+
import { cn } from '../../utils/cn';
|
|
6
|
+
import './DocsDecorator.scss';
|
|
7
|
+
const b = cn('docs-decorator');
|
|
8
|
+
export function DocsDecorator({ children, context }) {
|
|
9
|
+
// @ts-expect-error
|
|
10
|
+
const theme = context.store.userGlobals.globals.theme;
|
|
11
|
+
return (_jsx("div", { className: b(), children: _jsx(DocsContainer, { context: context, theme: themes[getThemeType(theme)], children: _jsx(ThemeProvider, { theme: theme, children: _jsx(MobileProvider, { mobile: false, children: children }) }) }) }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './Showcase.scss';
|
|
2
|
+
type Props = React.PropsWithChildren<{
|
|
3
|
+
title?: string;
|
|
4
|
+
description?: React.ReactNode;
|
|
5
|
+
direction?: 'row' | 'column';
|
|
6
|
+
className?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function Showcase({ title, description, direction, className, children }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import './Showcase.scss';
|
|
4
|
+
const b = cn('showcase');
|
|
5
|
+
export function Showcase({ title, description, direction = 'row', className, children }) {
|
|
6
|
+
return (_jsxs("div", { className: b({ direction }, className), children: [title && _jsx("div", { className: b('title'), children: title }), description && _jsx("div", { className: b('description'), children: description }), _jsx("div", { className: b('content'), children: children })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Showcase } from './Showcase';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Showcase } from './Showcase';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../utils/cn';
|
|
3
|
+
import './ShowcaseItem.scss';
|
|
4
|
+
const b = cn('showcase-item');
|
|
5
|
+
export function ShowcaseItem({ title, children }) {
|
|
6
|
+
return (_jsxs("div", { className: b(), children: [_jsx("div", { className: b('title'), children: title }), _jsx("div", { className: b('content'), children: children })] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShowcaseItem } from './ShowcaseItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShowcaseItem } from './ShowcaseItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwapArea } from './SwapArea';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SwapArea } from './SwapArea';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
export interface UseDateFormatterOptions {
|
|
3
|
+
date: string | Date | number;
|
|
4
|
+
format?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface UseDateFormatterResult {
|
|
7
|
+
formattedDate: string;
|
|
8
|
+
formattedTime: string;
|
|
9
|
+
fullDate: string;
|
|
10
|
+
dateObject: Dayjs | null;
|
|
11
|
+
isValid: boolean;
|
|
12
|
+
diffDays: number | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Gets formatted date string based on format and relative flag
|
|
16
|
+
* @param dateObject - Dayjs date object
|
|
17
|
+
* @param format - Optional format string
|
|
18
|
+
* @param relative - Whether to use relative date formatting
|
|
19
|
+
* @returns Formatted date string
|
|
20
|
+
*/
|
|
21
|
+
export declare function getFormattedDate(dateObject: Dayjs, format?: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Gets formatted time string based on format and relative flag
|
|
24
|
+
* @param dateObject - Dayjs date object
|
|
25
|
+
* @param format - Optional format string
|
|
26
|
+
* @returns Formatted time string
|
|
27
|
+
*/
|
|
28
|
+
export declare function getFormattedTime(dateObject: Dayjs, format?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Hook for formatting dates
|
|
31
|
+
* @param options - Date formatting options
|
|
32
|
+
* @returns Formatted date string, full date for title, and validation info
|
|
33
|
+
*/
|
|
34
|
+
export declare function useDateFormatter(options: UseDateFormatterOptions): UseDateFormatterResult;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { RELATIVE_DATE_THRESHOLD } from '../../constants';
|
|
4
|
+
/**
|
|
5
|
+
* Gets the full date string for title attribute
|
|
6
|
+
* @param dateObject - Dayjs date object
|
|
7
|
+
* @returns Full formatted date string
|
|
8
|
+
*/
|
|
9
|
+
function getFullDate(dateObject) {
|
|
10
|
+
if (!dateObject.isValid()) {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
return new Intl.DateTimeFormat(undefined, {
|
|
14
|
+
dateStyle: 'full',
|
|
15
|
+
timeStyle: 'short',
|
|
16
|
+
}).format(dateObject.toDate());
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Gets formatted date string based on format and relative flag
|
|
20
|
+
* @param dateObject - Dayjs date object
|
|
21
|
+
* @param format - Optional format string
|
|
22
|
+
* @param relative - Whether to use relative date formatting
|
|
23
|
+
* @returns Formatted date string
|
|
24
|
+
*/
|
|
25
|
+
export function getFormattedDate(dateObject, format) {
|
|
26
|
+
if (!format) {
|
|
27
|
+
return dateObject.format('YYYY.MM.DD');
|
|
28
|
+
}
|
|
29
|
+
// Extract date part from custom format
|
|
30
|
+
// Remove common time format tokens (HH, H, hh, h, mm, ss, A, a, etc.)
|
|
31
|
+
const dateFormat = format.replace(/\s*(HH?|hh?|mm|ss|A|a|Z|z).*/g, '').trim();
|
|
32
|
+
if (!dateFormat) {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
return dateObject.format(dateFormat);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets formatted time string based on format and relative flag
|
|
39
|
+
* @param dateObject - Dayjs date object
|
|
40
|
+
* @param format - Optional format string
|
|
41
|
+
* @returns Formatted time string
|
|
42
|
+
*/
|
|
43
|
+
export function getFormattedTime(dateObject, format) {
|
|
44
|
+
if (!format) {
|
|
45
|
+
return dateObject.format('HH:mm');
|
|
46
|
+
}
|
|
47
|
+
// Extract time part from custom format
|
|
48
|
+
// Find the first time token and capture everything from there to the end
|
|
49
|
+
// This handles formats like "HH:mm", "HH-mm", "HH.mm", "HH~mm", "HH/mm", "HH\mm", etc.
|
|
50
|
+
// Time tokens: H, h (hours), m (minutes), s (seconds), A, a (AM/PM), Z, z (timezone)
|
|
51
|
+
const timeMatch = format.match(/(.*?)(\s*[HhmsAaZz](?:[HhmsAaZz]|[^HhmsAaZz])*)$/);
|
|
52
|
+
if (timeMatch && timeMatch[2]) {
|
|
53
|
+
const timeFormat = timeMatch[2].trim();
|
|
54
|
+
return dateObject.format(timeFormat);
|
|
55
|
+
}
|
|
56
|
+
return dateObject.format('HH:mm');
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Calculates the difference in days from today
|
|
60
|
+
* @param dateObject - Dayjs date object
|
|
61
|
+
* @returns Number of days difference
|
|
62
|
+
*/
|
|
63
|
+
function getDiffDays(dateObject) {
|
|
64
|
+
const now = dayjs();
|
|
65
|
+
const today = now.startOf('day');
|
|
66
|
+
const dateStart = dateObject.startOf('day');
|
|
67
|
+
const diffDays = today.diff(dateStart, 'day');
|
|
68
|
+
if (diffDays >= RELATIVE_DATE_THRESHOLD) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return today.diff(dateStart, 'day');
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Hook for formatting dates
|
|
75
|
+
* @param options - Date formatting options
|
|
76
|
+
* @returns Formatted date string, full date for title, and validation info
|
|
77
|
+
*/
|
|
78
|
+
export function useDateFormatter(options) {
|
|
79
|
+
const { date, format } = options;
|
|
80
|
+
return useMemo(() => {
|
|
81
|
+
const dateObject = dayjs(date);
|
|
82
|
+
if (!dateObject.isValid()) {
|
|
83
|
+
return {
|
|
84
|
+
formattedDate: '',
|
|
85
|
+
formattedTime: '',
|
|
86
|
+
fullDate: '',
|
|
87
|
+
dateObject: null,
|
|
88
|
+
isValid: false,
|
|
89
|
+
diffDays: null,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
fullDate: getFullDate(dateObject),
|
|
94
|
+
formattedDate: getFormattedDate(dateObject, format),
|
|
95
|
+
formattedTime: getFormattedTime(dateObject, format),
|
|
96
|
+
diffDays: getDiffDays(dateObject),
|
|
97
|
+
isValid: dateObject.isValid(),
|
|
98
|
+
dateObject: dateObject.isValid() ? dateObject : null,
|
|
99
|
+
};
|
|
100
|
+
}, [date, format]);
|
|
101
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Action } from '../types/common';
|
|
2
|
+
import type { ToolMessageProps } from '../types/tool';
|
|
3
|
+
export declare function useToolMessage(options: ToolMessageProps): {
|
|
4
|
+
isExpanded: boolean;
|
|
5
|
+
toggleExpanded: () => void;
|
|
6
|
+
headerActions: Action[];
|
|
7
|
+
footerActions: Action[];
|
|
8
|
+
footerContent: import("react").ReactNode;
|
|
9
|
+
showLoader: boolean;
|
|
10
|
+
isWaiting: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { ChevronDown, ChevronUp } from '@gravity-ui/icons';
|
|
4
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
5
|
+
import { i18n } from '../components/organisms/ToolMessage/i18n';
|
|
6
|
+
function getDefaultFooterActions(status, footerActions, onAccept, onReject) {
|
|
7
|
+
if (footerActions !== undefined) {
|
|
8
|
+
return footerActions;
|
|
9
|
+
}
|
|
10
|
+
switch (status) {
|
|
11
|
+
case 'waitingConfirmation':
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
label: i18n('action-reject'),
|
|
15
|
+
onClick: onReject,
|
|
16
|
+
view: 'outlined',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: i18n('action-accept'),
|
|
20
|
+
onClick: onAccept,
|
|
21
|
+
view: 'action',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
case 'waitingSubmission':
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
label: i18n('action-cancel'),
|
|
28
|
+
onClick: onReject,
|
|
29
|
+
view: 'outlined',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
default:
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function getDefaultFooterMessage(status, footerContent) {
|
|
37
|
+
if (footerContent) {
|
|
38
|
+
return footerContent;
|
|
39
|
+
}
|
|
40
|
+
switch (status) {
|
|
41
|
+
case 'waitingConfirmation':
|
|
42
|
+
return i18n('status-waiting-confirmation');
|
|
43
|
+
case 'waitingSubmission':
|
|
44
|
+
return i18n('status-waiting-submission');
|
|
45
|
+
default:
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function getShowLoader(status) {
|
|
50
|
+
return status === 'waitingConfirmation' || status === 'waitingSubmission';
|
|
51
|
+
}
|
|
52
|
+
function isWaitingTool(status) {
|
|
53
|
+
return status === 'waitingConfirmation' || status === 'waitingSubmission';
|
|
54
|
+
}
|
|
55
|
+
function getDefaultInitialExpanded(status, initialExpanded) {
|
|
56
|
+
if (initialExpanded !== undefined) {
|
|
57
|
+
return initialExpanded;
|
|
58
|
+
}
|
|
59
|
+
return status === 'waitingConfirmation' || status === 'waitingSubmission';
|
|
60
|
+
}
|
|
61
|
+
const defaultHeaderActions = [];
|
|
62
|
+
export function useToolMessage(options) {
|
|
63
|
+
const { footerActions, headerActions = defaultHeaderActions, bodyContent, status, footerContent, expandable = Boolean(bodyContent), initialExpanded, onAccept, onReject, } = options;
|
|
64
|
+
const [isExpanded, setIsExpanded] = useState(getDefaultInitialExpanded(status, initialExpanded));
|
|
65
|
+
const toggleExpanded = useCallback(() => {
|
|
66
|
+
setIsExpanded((prev) => !prev);
|
|
67
|
+
}, []);
|
|
68
|
+
const expandCollapseAction = useMemo(() => {
|
|
69
|
+
if (!expandable) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
label: isExpanded ? i18n('action-collapse') : i18n('action-expand'),
|
|
74
|
+
onClick: toggleExpanded,
|
|
75
|
+
icon: _jsx(Icon, { data: isExpanded ? ChevronUp : ChevronDown, size: 16 }),
|
|
76
|
+
};
|
|
77
|
+
}, [expandable, isExpanded, toggleExpanded]);
|
|
78
|
+
const finalHeaderActions = useMemo(() => {
|
|
79
|
+
return expandCollapseAction ? [...headerActions, expandCollapseAction] : headerActions;
|
|
80
|
+
}, [headerActions, expandCollapseAction]);
|
|
81
|
+
const finalFooterActions = useMemo(() => {
|
|
82
|
+
return getDefaultFooterActions(status, footerActions, onAccept, onReject);
|
|
83
|
+
}, [status, footerActions, onAccept, onReject]);
|
|
84
|
+
const finalFooterMessage = getDefaultFooterMessage(status, footerContent);
|
|
85
|
+
const showLoader = getShowLoader(status);
|
|
86
|
+
const isWaiting = isWaitingTool(status);
|
|
87
|
+
return {
|
|
88
|
+
isExpanded,
|
|
89
|
+
toggleExpanded,
|
|
90
|
+
headerActions: finalHeaderActions,
|
|
91
|
+
footerActions: finalFooterActions,
|
|
92
|
+
footerContent: finalFooterMessage,
|
|
93
|
+
showLoader,
|
|
94
|
+
isWaiting,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main export file for AI Chat library
|
|
3
|
+
*/
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './components/atoms';
|
|
6
|
+
export * from './components/molecules';
|
|
7
|
+
export * from './components/organisms';
|
|
8
|
+
export * from './components/templates';
|
|
9
|
+
export * from './components/pages';
|
|
10
|
+
export * from './hooks';
|
|
11
|
+
export * from './utils';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main export file for AI Chat library
|
|
3
|
+
*/
|
|
4
|
+
// === Types ===
|
|
5
|
+
export * from './types';
|
|
6
|
+
// === Atoms ===
|
|
7
|
+
export * from './components/atoms';
|
|
8
|
+
// === Molecules ===
|
|
9
|
+
export * from './components/molecules';
|
|
10
|
+
// === Organisms ===
|
|
11
|
+
export * from './components/organisms';
|
|
12
|
+
// === Templates ===
|
|
13
|
+
export * from './components/templates';
|
|
14
|
+
// === Pages ===
|
|
15
|
+
export * from './components/pages';
|
|
16
|
+
// === Hooks ===
|
|
17
|
+
export * from './hooks';
|
|
18
|
+
// === Utilities ===
|
|
19
|
+
export * from './utils';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ChatType = {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
createTime: string | null;
|
|
5
|
+
lastMessage?: string;
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
export type ChatStatus = 'submitted' | 'streaming' | 'ready' | 'error';
|
|
9
|
+
/**
|
|
10
|
+
* List item type for chat history that can be either a chat or a date header
|
|
11
|
+
*/
|
|
12
|
+
export type ListItemChatData = (ChatType & {
|
|
13
|
+
type: 'chat';
|
|
14
|
+
}) | {
|
|
15
|
+
type: 'date-header';
|
|
16
|
+
date: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { IconData } from '@gravity-ui/uikit';
|
|
3
|
+
import { ToolMessageProps } from './tool';
|
|
4
|
+
export type BaseMessageProps = {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
role: TMessageRole;
|
|
7
|
+
actions?: Array<{
|
|
8
|
+
type: string;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
icon?: IconData;
|
|
11
|
+
}>;
|
|
12
|
+
timestamp?: string;
|
|
13
|
+
showTimestamp?: boolean;
|
|
14
|
+
showActionsOnHover?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
qa?: string;
|
|
17
|
+
};
|
|
18
|
+
export type TMessageMetadata = Record<string, unknown>;
|
|
19
|
+
export type TSubmitData = {
|
|
20
|
+
content: string;
|
|
21
|
+
attachments?: File[];
|
|
22
|
+
metadata?: TMessageMetadata;
|
|
23
|
+
};
|
|
24
|
+
export type TMessageStatus = 'sending' | 'complete' | 'error' | 'streaming';
|
|
25
|
+
export type TMessageRole = 'user' | 'assistant' | 'system';
|
|
26
|
+
export type TMessageContent<Type extends string = string, Data = unknown> = {
|
|
27
|
+
id?: string;
|
|
28
|
+
type: Type;
|
|
29
|
+
data: Data;
|
|
30
|
+
};
|
|
31
|
+
export type TextMessageContentData = {
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
export type TextMessageContent = TMessageContent<'text', TextMessageContentData>;
|
|
35
|
+
export type ThinkingMessageContentData = {
|
|
36
|
+
title?: string;
|
|
37
|
+
content: string | string[];
|
|
38
|
+
status: 'thinking' | 'thought';
|
|
39
|
+
};
|
|
40
|
+
export type ThinkingMessageContent = TMessageContent<'thinking', ThinkingMessageContentData>;
|
|
41
|
+
export type ToolMessageContentData = ToolMessageProps;
|
|
42
|
+
export type ToolMessageContent = TMessageContent<'tool', ToolMessageContentData>;
|
|
43
|
+
export type TDefaultMessageContent = TextMessageContent | ThinkingMessageContent | ToolMessageContent;
|
|
44
|
+
export type TMessageContentUnion<TCustomMessageContent extends TMessageContent = never> = TDefaultMessageContent | TCustomMessageContent;
|
|
45
|
+
export type TAssistantMessageContent<TCustomMessageContent extends TMessageContent = never> = string | TMessageContentUnion<TCustomMessageContent> | TMessageContentUnion<TCustomMessageContent>[];
|
|
46
|
+
export type TBaseMessage<Metadata = TMessageMetadata> = Pick<BaseMessageProps, 'actions' | 'timestamp'> & {
|
|
47
|
+
id?: string;
|
|
48
|
+
status?: TMessageStatus;
|
|
49
|
+
error?: unknown;
|
|
50
|
+
metadata?: Metadata;
|
|
51
|
+
};
|
|
52
|
+
export type TUserMessage<Metadata = TMessageMetadata> = TBaseMessage<Metadata> & {
|
|
53
|
+
role: 'user';
|
|
54
|
+
content: string;
|
|
55
|
+
format?: 'plain' | 'markdown';
|
|
56
|
+
avatarUrl?: string;
|
|
57
|
+
};
|
|
58
|
+
export type TAssistantMessage<TCustomMessageContent extends TMessageContent = never, Metadata = TMessageMetadata> = TBaseMessage<Metadata> & {
|
|
59
|
+
role: 'assistant';
|
|
60
|
+
content: TAssistantMessageContent<TCustomMessageContent>;
|
|
61
|
+
};
|
|
62
|
+
export type TChatMessage<TCustomMessageContent extends TMessageContent = never, Metadata = TMessageMetadata> = TUserMessage<Metadata> | TAssistantMessage<TCustomMessageContent, Metadata>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Action } from './common';
|
|
2
|
+
export type ToolStatus = 'success' | 'error' | 'loading' | 'waitingConfirmation' | 'waitingSubmission';
|
|
3
|
+
export type ToolHeaderProps = {
|
|
4
|
+
toolIcon?: React.ReactNode;
|
|
5
|
+
toolName: string;
|
|
6
|
+
content?: React.ReactNode;
|
|
7
|
+
actions?: Action[];
|
|
8
|
+
status?: ToolStatus;
|
|
9
|
+
className?: string;
|
|
10
|
+
qa?: string;
|
|
11
|
+
};
|
|
12
|
+
export type ToolFooterProps = {
|
|
13
|
+
content?: React.ReactNode;
|
|
14
|
+
actions: Action[];
|
|
15
|
+
showLoader?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
qa?: string;
|
|
18
|
+
};
|
|
19
|
+
export type ToolMessageProps = {
|
|
20
|
+
toolName: string;
|
|
21
|
+
toolIcon?: React.ReactNode;
|
|
22
|
+
footerActions?: Action[];
|
|
23
|
+
headerActions?: Action[];
|
|
24
|
+
bodyContent?: React.ReactNode;
|
|
25
|
+
headerContent?: React.ReactNode;
|
|
26
|
+
footerContent?: React.ReactNode;
|
|
27
|
+
status?: ToolStatus;
|
|
28
|
+
expandable?: boolean;
|
|
29
|
+
initialExpanded?: boolean;
|
|
30
|
+
onAccept?: () => void;
|
|
31
|
+
onReject?: () => void;
|
|
32
|
+
className?: string;
|
|
33
|
+
qa?: string;
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat utilities
|
|
3
|
+
*/
|
|
4
|
+
import type { ListItemData } from '@gravity-ui/uikit';
|
|
5
|
+
import type { ChatType, ListItemChatData } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Groups chats by date
|
|
8
|
+
*
|
|
9
|
+
* @param chats - Array of chats to group
|
|
10
|
+
* @returns Map of date keys to chat arrays
|
|
11
|
+
*/
|
|
12
|
+
export declare function groupChatsByDate(chats: ChatType[]): Map<string, ChatType[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Filter function type for chat list
|
|
15
|
+
*/
|
|
16
|
+
export type ChatFilterFunction = (filter: string) => (item: ListItemData<ListItemChatData>) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Default filter function - searches in chat name and last message
|
|
19
|
+
*
|
|
20
|
+
* @param filter - Search query string
|
|
21
|
+
* @returns Function that filters list items
|
|
22
|
+
*/
|
|
23
|
+
export declare function defaultChatFilter(filter: string): (item: ListItemData<ListItemChatData>) => boolean;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Groups chats by date
|
|
6
|
+
*
|
|
7
|
+
* @param chats - Array of chats to group
|
|
8
|
+
* @returns Map of date keys to chat arrays
|
|
9
|
+
*/
|
|
10
|
+
export function groupChatsByDate(chats) {
|
|
11
|
+
const grouped = new Map();
|
|
12
|
+
chats.forEach((chat) => {
|
|
13
|
+
var _a;
|
|
14
|
+
if (!chat.createTime)
|
|
15
|
+
return;
|
|
16
|
+
const date = new Date(chat.createTime);
|
|
17
|
+
const dateKey = date.toDateString();
|
|
18
|
+
if (!grouped.has(dateKey)) {
|
|
19
|
+
grouped.set(dateKey, []);
|
|
20
|
+
}
|
|
21
|
+
(_a = grouped.get(dateKey)) === null || _a === void 0 ? void 0 : _a.push(chat);
|
|
22
|
+
});
|
|
23
|
+
return grouped;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Default filter function - searches in chat name and last message
|
|
27
|
+
*
|
|
28
|
+
* @param filter - Search query string
|
|
29
|
+
* @returns Function that filters list items
|
|
30
|
+
*/
|
|
31
|
+
export function defaultChatFilter(filter) {
|
|
32
|
+
return (item) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
// Skip date headers from filtering
|
|
35
|
+
if (item.type === 'date-header') {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const chat = item;
|
|
39
|
+
const lowerQuery = filter.toLowerCase();
|
|
40
|
+
return (chat.name.toLowerCase().includes(lowerQuery) ||
|
|
41
|
+
((_b = (_a = chat.lastMessage) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(lowerQuery)) !== null && _b !== void 0 ? _b : false));
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type CnMods = Record<string, string | boolean | undefined>;
|
|
2
|
+
export declare const NAMESPACE = "g-aikit-";
|
|
3
|
+
export declare const cn: import("@bem-react/classname").ClassNameInitilizer;
|
|
4
|
+
export declare const block: import("@bem-react/classname").ClassNameInitilizer;
|
|
5
|
+
export type CnBlock = ReturnType<typeof cn>;
|
|
6
|
+
/**
|
|
7
|
+
* Extracts modifiers part from className
|
|
8
|
+
* @param {string} className - The class name to extract modifiers from
|
|
9
|
+
* @returns {string} The modifiers part of the class name
|
|
10
|
+
*/
|
|
11
|
+
export declare function modsClassName(className: string): string;
|