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.
- package/README.md +86 -39
- package/dist/Chat.d.ts +58 -0
- package/dist/ChatContext.d.ts +18 -0
- package/dist/ChatInput.d.ts +42 -0
- package/dist/Markdown/CodeHighlighter.d.ts +25 -0
- package/dist/Markdown/Markdown.d.ts +11 -0
- package/dist/Markdown/Table.d.ts +5 -0
- package/dist/Markdown/index.d.ts +5 -0
- package/dist/Markdown/plugins/index.d.ts +1 -0
- package/dist/Markdown/plugins/remarkCve.d.ts +1 -0
- package/dist/Markdown/themes/dark.d.ts +501 -0
- package/dist/Markdown/themes/index.d.ts +2 -0
- package/dist/Markdown/themes/light.d.ts +499 -0
- package/dist/SessionMessages/MessageActions.d.ts +45 -0
- package/dist/SessionMessages/MessageFile.d.ts +14 -0
- package/dist/SessionMessages/MessageFiles.d.ts +11 -0
- package/dist/SessionMessages/MessageQuestion.d.ts +9 -0
- package/dist/SessionMessages/MessageResponse.d.ts +13 -0
- package/dist/SessionMessages/MessageSource.d.ts +10 -0
- package/dist/SessionMessages/MessageSources.d.ts +11 -0
- package/dist/SessionMessages/SessionEmpty.d.ts +6 -0
- package/dist/SessionMessages/SessionMessage.d.ts +15 -0
- package/dist/SessionMessages/SessionMessagePanel.d.ts +3 -0
- package/dist/SessionMessages/SessionMessages.d.ts +23 -0
- package/dist/SessionMessages/SessionMessagesHeader.d.ts +3 -0
- package/dist/SessionMessages/index.d.ts +12 -0
- package/dist/SessionsList/NewSessionButton.d.ts +10 -0
- package/dist/SessionsList/SessionGroups.d.ts +10 -0
- package/dist/SessionsList/SessionListItem.d.ts +22 -0
- package/dist/SessionsList/SessionsGroup.d.ts +10 -0
- package/dist/SessionsList/SessionsList.d.ts +3 -0
- package/dist/SessionsList/index.d.ts +5 -0
- package/dist/docs.json +1478 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.js +1866 -3211
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1868 -3209
- package/dist/index.umd.cjs.map +1 -1
- package/dist/theme.d.ts +77 -1
- package/dist/types.d.ts +71 -17
- package/dist/utils.d.ts +7 -0
- package/dist/utils.spec.d.ts +1 -0
- package/package.json +38 -23
- package/dist/SessionInput.d.ts +0 -22
- package/dist/SessionListItem.d.ts +0 -11
- package/dist/SessionMessage.d.ts +0 -10
- package/dist/SessionMessages.d.ts +0 -9
- package/dist/Sessions.d.ts +0 -48
- package/dist/SessionsList.d.ts +0 -11
- package/dist/useLlm.d.ts +0 -3
package/README.md
CHANGED
|
@@ -1,41 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
+
|
|
10
|
+
<a href="https://npm.im/reachat" target="_blank">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/reachat.svg" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://npm.im/reachat" target="_blank">
|
|
14
|
+
<img src="https://badgen.net/npm/dw/reachat" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/reaviz/reachat/blob/master/LICENSE">
|
|
17
|
+
<img src="https://badgen.now.sh/badge/license/apache2" />
|
|
18
|
+
</a>
|
|
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>
|
|
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
|
-
-
|
|
17
|
-
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 @@
|
|
|
1
|
+
export * from './remarkCve';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function remarkCve(): (tree: any, _file: any) => void;
|