reachat 0.0.1 → 1.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.
Files changed (50) hide show
  1. package/README.md +86 -39
  2. package/dist/Chat.d.ts +58 -0
  3. package/dist/ChatContext.d.ts +18 -0
  4. package/dist/ChatInput.d.ts +42 -0
  5. package/dist/Markdown/CodeHighlighter.d.ts +25 -0
  6. package/dist/Markdown/Markdown.d.ts +11 -0
  7. package/dist/Markdown/Table.d.ts +5 -0
  8. package/dist/Markdown/index.d.ts +5 -0
  9. package/dist/Markdown/plugins/index.d.ts +1 -0
  10. package/dist/Markdown/plugins/remarkCve.d.ts +1 -0
  11. package/dist/Markdown/themes/dark.d.ts +501 -0
  12. package/dist/Markdown/themes/index.d.ts +2 -0
  13. package/dist/Markdown/themes/light.d.ts +499 -0
  14. package/dist/SessionMessages/MessageActions.d.ts +45 -0
  15. package/dist/SessionMessages/MessageFile.d.ts +14 -0
  16. package/dist/SessionMessages/MessageFiles.d.ts +11 -0
  17. package/dist/SessionMessages/MessageQuestion.d.ts +9 -0
  18. package/dist/SessionMessages/MessageResponse.d.ts +13 -0
  19. package/dist/SessionMessages/MessageSource.d.ts +10 -0
  20. package/dist/SessionMessages/MessageSources.d.ts +11 -0
  21. package/dist/SessionMessages/SessionEmpty.d.ts +6 -0
  22. package/dist/SessionMessages/SessionMessage.d.ts +15 -0
  23. package/dist/SessionMessages/SessionMessagePanel.d.ts +3 -0
  24. package/dist/SessionMessages/SessionMessages.d.ts +23 -0
  25. package/dist/SessionMessages/SessionMessagesHeader.d.ts +3 -0
  26. package/dist/SessionMessages/index.d.ts +12 -0
  27. package/dist/SessionsList/NewSessionButton.d.ts +10 -0
  28. package/dist/SessionsList/SessionGroups.d.ts +10 -0
  29. package/dist/SessionsList/SessionListItem.d.ts +22 -0
  30. package/dist/SessionsList/SessionsGroup.d.ts +10 -0
  31. package/dist/SessionsList/SessionsList.d.ts +3 -0
  32. package/dist/SessionsList/index.d.ts +5 -0
  33. package/dist/docs.json +1478 -0
  34. package/dist/index.d.ts +4 -5
  35. package/dist/index.js +1866 -3211
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.umd.cjs +1868 -3209
  38. package/dist/index.umd.cjs.map +1 -1
  39. package/dist/theme.d.ts +77 -1
  40. package/dist/types.d.ts +71 -17
  41. package/dist/utils.d.ts +7 -0
  42. package/dist/utils.spec.d.ts +1 -0
  43. package/package.json +38 -23
  44. package/dist/SessionInput.d.ts +0 -22
  45. package/dist/SessionListItem.d.ts +0 -11
  46. package/dist/SessionMessage.d.ts +0 -10
  47. package/dist/SessionMessages.d.ts +0 -9
  48. package/dist/Sessions.d.ts +0 -48
  49. package/dist/SessionsList.d.ts +0 -11
  50. package/dist/useLlm.d.ts +0 -3
package/README.md CHANGED
@@ -1,41 +1,88 @@
1
- # reachat
2
- 💬 Building Blocks for LLM UI
3
-
4
- ## Features
5
- - Markdown
6
- - Code block
7
- - CSV Table
8
- - JSON Block
9
- - Dynamic Links ( regex )
10
- - Source Support
11
- - Image Preview Support
12
- - File Upload Support
13
- - Typeahead
1
+ <div align="center">
2
+ <img width="650" src=".storybook/logo.png">
3
+ <br />
4
+ Building Blocks for LLM UI
5
+ <br /><br />
6
+ <a href="https://github.com/reaviz/reachat/actions/workflows/build.yml">
7
+ <img src="https://github.com/reaviz/reachat/actions/workflows/build.yml/badge.svg" />
8
+ </a>
9
+ &nbsp;
10
+ <a href="https://npm.im/reachat" target="_blank">
11
+ <img src="https://img.shields.io/npm/v/reachat.svg" />
12
+ </a>&nbsp;
13
+ <a href="https://npm.im/reachat" target="_blank">
14
+ <img src="https://badgen.net/npm/dw/reachat" />
15
+ </a>&nbsp;
16
+ <a href="https://github.com/reaviz/reachat/blob/master/LICENSE">
17
+ <img src="https://badgen.now.sh/badge/license/apache2" />
18
+ </a>&nbsp;
19
+ <a href="https://github.com/reaviz/reachat">
20
+ <img alt="GitHub stars" src="https://img.shields.io/github/stars/reaviz/reachat?style=social" />
21
+ </a>&nbsp;
22
+ <a href="https://discord.gg/tt8wGExq35" target="_blank">
23
+ <img src="https://img.shields.io/discord/773948315037073409?label=discord" />
24
+ </a>
25
+ </div>
26
+
27
+ ---
28
+
29
+ reachat is a UI library for building chat experiences. No more manually coding
30
+ all the components required to build LLM uis manually. Customize each component and
31
+ theme via Tailwind.
32
+
33
+ ## 🚀 Quick Links
34
+ - Checkout the [docs and demos](https://reachat.dev)
35
+ - Checkout the [storybook demos](https://storybook.reachat.dev)
36
+ - Learn about updates from the [changelog](CHANGELOG.md)
37
+
38
+ ## 💎 Other Projects
39
+
40
+ - [Reaflow](https://reaflow.dev?utm=reagraph) - Open-source library for workflow and diagram graphs.
41
+ - [Reablocks](https://reablocks.dev?utm=reagraph) - Open-source component library for React based on Tailwind.
42
+ - [Reaviz](https://reaviz.dev?utm=reagraph) - Open-source library for data visualizations for React.
43
+ - [Reagraph](https://reagraph.dev?utm=reaviz) - Open-source library for large webgl based network graphs.
44
+
45
+ ## 🪄 Features
46
+ - Console and Companion Modes
47
+ - Markdown Rendering
48
+ - GFM Styling
49
+ - Code Highlighting
50
+ - Tables
51
+ - JSON
52
+ - Lists
53
+ - Embeds ( Youtube )
54
+ - remark plugin support
55
+ - File Uploads
56
+ - Message Sources
57
+ - Animations
58
+ - Conversation Pagination
59
+ - Smart/Dynamic Grouping of Sessions
14
60
  - Keyboard shortcuts
61
+ - Animations via Framer Motion
62
+ - Responsive
15
63
  - Tailwind for Themeing
16
- - Polygot LLM Support - Vercel, OpenAI, Claude, Gemini
17
-
18
- ## Installation
19
- TODO
20
-
21
- ## Themeing
22
- TODO
23
-
24
- ## References
25
- - https://www.chatbotui.com/
26
- - https://llm-ui.com/
27
- - https://github.com/huggingface/chat-ui - Amazing clean UI with very good web search, my go to currently. (they added the ability to do it all locally very recently!)
28
- - https://github.com/oobabooga/text-generation-webui - Best overall, supports any model format and has many extensions
29
- - https://github.com/ParisNeo/lollms-webui/ - Has PDF, stable diffusion and web search integration
30
- - https://github.com/h2oai/h2ogpt - Has PDF, Web search, best for files ingestion (supports many file formats)
31
- - https://github.com/SillyTavern/SillyTavern - Best for custom characters and roleplay
32
- - https://github.com/NimbleBoxAI/ChainFury - Has great UI and web search (experimental)
33
- - https://github.com/nomic-ai/gpt4all - Basic UI that replicated ChatGPT
34
- - https://github.com/imartinez/privateGPT - Basic UI that replicated ChatGPT with PDF integration
35
- - https://github.com/LostRuins/koboldcpp - Easy to install and simple interface
36
- - LM Studio - Clean UI, focuses on GGUF format
37
- - https://github.com/lobehub/lobe-chat - Nice rich UI with the ability to load extensions for web search, TTS and more
38
- - https://github.com/ollama-webui/ollama-webui - ChatGPT like UI with easy way to download models
39
- - https://github.com/turboderp/exui - very fast and vram efficient
40
- - https://github.com/PromtEngineer/localGPT - Focuses on PDF files
41
- - https://github.com/shinomakoi/AI-Messenger - Supports EXLv2 and LLava
64
+ - Customizable via Slots
65
+
66
+ ## 📦 Install
67
+
68
+ To use reachat in your project, install it via npm/yarn:
69
+
70
+ ```
71
+ npm i reachat --save
72
+ ```
73
+
74
+ ## 🔭 Development
75
+
76
+ If you want to run reachat locally, its super easy!
77
+
78
+ - Clone the repository
79
+ - `npm i`
80
+ - `npm start`
81
+ - Browser opens to Storybook page
82
+
83
+ ## ❤️ Contributors & Credits
84
+
85
+ Thanks to all our contributors!
86
+
87
+ <a href="https://github.com/reaviz/reaviz/graphs/contributors"><img src="https://opencollective.com/reaviz/contributors.svg?width=890" /></a>
88
+
package/dist/Chat.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ import { CSSProperties, FC, PropsWithChildren } from 'react';
2
+ import { Session } from './types';
3
+ import { ChatTheme } from './theme';
4
+ import { PluggableList } from 'react-markdown/lib';
5
+
6
+ export interface ChatProps extends PropsWithChildren {
7
+ /**
8
+ * The style to apply to the root element.
9
+ */
10
+ style?: CSSProperties;
11
+ /**
12
+ * The class name to apply to the root element.
13
+ */
14
+ className?: string;
15
+ /**
16
+ * The type of prompt to display. Companion prompts are smaller and are
17
+ * meant to be displayed alongside other content. Full prompts are larger
18
+ * and are meant to be displayed on their own.
19
+ */
20
+ viewType?: 'companion' | 'console';
21
+ /**
22
+ * The list of sessions to display.
23
+ */
24
+ sessions: Session[];
25
+ /**
26
+ * The ID of the currently active session.
27
+ */
28
+ activeSessionId?: string;
29
+ /**
30
+ * Custom theme for the chat.
31
+ */
32
+ theme?: ChatTheme;
33
+ /**
34
+ * Remark plugins to apply to the request/response.
35
+ */
36
+ remarkPlugins?: PluggableList[];
37
+ /**
38
+ * Whether to display a loading state.
39
+ */
40
+ isLoading?: boolean;
41
+ /**
42
+ * Whether to disable the chat.
43
+ */
44
+ disabled?: boolean;
45
+ /**
46
+ * Callback function to handle when a session is selected.
47
+ */
48
+ onSelectSession?: (sessionId: string) => void;
49
+ /**
50
+ * Callback function to handle when a session is deleted.
51
+ */
52
+ onDeleteSession?: (sessionId: string) => void;
53
+ /**
54
+ * Callback function to handle creating a new session.
55
+ */
56
+ onNewSession?: () => void;
57
+ }
58
+ export declare const Chat: FC<ChatProps>;
@@ -0,0 +1,18 @@
1
+ import { Session } from './types';
2
+ import { ChatTheme } from './theme';
3
+ import { PluggableList } from 'react-markdown/lib';
4
+
5
+ export interface ChatContextProps {
6
+ sessions: Session[];
7
+ disabled?: boolean;
8
+ activeSessionId: string | null;
9
+ theme?: ChatTheme;
10
+ isLoading?: boolean;
11
+ isCompact?: boolean;
12
+ activeSession?: Session | null;
13
+ remarkPlugins?: PluggableList[];
14
+ selectSession?: (sessionId: string) => void;
15
+ deleteSession?: (sessionId: string) => void;
16
+ createSession?: () => void;
17
+ }
18
+ export declare const ChatContext: import('react').Context<ChatContextProps>;
@@ -0,0 +1,42 @@
1
+ import { FC, ReactElement } from 'react';
2
+
3
+ interface ChatInputProps {
4
+ /**
5
+ * Default value for the input field.
6
+ */
7
+ defaultValue?: string;
8
+ /**
9
+ * Allowed file types for upload.
10
+ */
11
+ allowedFiles?: string[];
12
+ /**
13
+ * Placeholder text for the input field.
14
+ */
15
+ placeholder?: string;
16
+ /**
17
+ * Icon to show for send.
18
+ */
19
+ sendIcon?: ReactElement;
20
+ /**
21
+ * Icon to show for send.
22
+ */
23
+ stopIcon?: ReactElement;
24
+ /**
25
+ * Icon to show for attach.
26
+ */
27
+ attachIcon?: ReactElement;
28
+ /**
29
+ * Callback function to handle sending a new message.
30
+ */
31
+ onSendMessage?: (message: string) => void;
32
+ /**
33
+ * Callback function to handle stopping the current action.
34
+ */
35
+ onStopMessage?: () => void;
36
+ /**
37
+ * Callback function to handle file upload.
38
+ */
39
+ onFileUpload?: (file: File) => void;
40
+ }
41
+ export declare const ChatInput: FC<ChatInputProps>;
42
+ export {};
@@ -0,0 +1,25 @@
1
+ import { FC, PropsWithChildren, ReactElement } from 'react';
2
+
3
+ export interface CodeHighlighterProps extends PropsWithChildren {
4
+ /**
5
+ * The class name to apply to the code block.
6
+ */
7
+ className?: string;
8
+ /**
9
+ * The language of the code block.
10
+ */
11
+ language?: string;
12
+ /**
13
+ * The class name to apply to the copy button.
14
+ */
15
+ copyClassName?: string;
16
+ /**
17
+ * Icon to show for copy.
18
+ */
19
+ copyIcon?: ReactElement;
20
+ /**
21
+ * The theme to use for the code block.
22
+ */
23
+ theme?: Record<string, string>;
24
+ }
25
+ export declare const CodeHighlighter: FC<CodeHighlighterProps>;
@@ -0,0 +1,11 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { PluggableList } from 'react-markdown/lib';
3
+
4
+ interface MarkdownWrapperProps extends PropsWithChildren {
5
+ /**
6
+ * Remark plugins to apply to the markdown content.
7
+ */
8
+ remarkPlugins?: PluggableList[];
9
+ }
10
+ export declare const Markdown: FC<MarkdownWrapperProps>;
11
+ export {};
@@ -0,0 +1,5 @@
1
+ import { default as React, FC, PropsWithChildren } from 'react';
2
+
3
+ export declare const TableComponent: FC<PropsWithChildren<React.HTMLAttributes<HTMLTableElement>>>;
4
+ export declare const TableHeaderCell: FC<PropsWithChildren<React.HTMLAttributes<HTMLTableHeaderCellElement>>>;
5
+ export declare const TableDataCell: FC<PropsWithChildren<React.HTMLAttributes<HTMLTableDataCellElement>>>;
@@ -0,0 +1,5 @@
1
+ export * from './Markdown';
2
+ export * from './Table';
3
+ export * from './CodeHighlighter';
4
+ export * from './plugins';
5
+ export * from './themes';
@@ -0,0 +1 @@
1
+ export * from './remarkCve';
@@ -0,0 +1 @@
1
+ export declare function remarkCve(): (tree: any, _file: any) => void;